updated functionality to save video speed via existing control panel video

This commit is contained in:
Apoorv Saxena
2014-06-08 02:59:21 +05:30
parent 5a7bb9e0a6
commit 81d4bc8797
4 changed files with 11 additions and 114 deletions

View File

@@ -8,18 +8,17 @@ chrome.extension.sendMessage({}, function(response) {
this.video = target;
this.initializeControls();
this.speedIndicator.textContent = this.getSpeed();
this.video.addEventListener('ratechange', function(event) {
this.speedIndicator.textContent = this.getSpeed();
}.bind(this));
chrome.storage.sync.get('speed', function(storage) {
target.playbackRate = storage.speed;
});
chrome.storage.onChanged.addListener(function(storage) {
if(storage.speed) {
target.playbackRate = storage.speed.newValue;
}
});
var speed = storage.speed ? storage.speed : '1.00';
target.playbackRate = speed;
this.speedIndicator.textContent = speed;
}.bind(this));
this.video.addEventListener('ratechange', function(event) {
var speed = this.getSpeed();
this.speedIndicator.textContent = speed;
chrome.storage.sync.set({'speed': speed});
}.bind(this));
};
tc.videoController.prototype.getSpeed = function() {