diff --git a/inject.js b/inject.js index 2ceceb7..255d811 100644 --- a/inject.js +++ b/inject.js @@ -8,9 +8,16 @@ chrome.extension.sendMessage({}, function(response) { this.video = target; this.initializeControls(); - this.speedIndicator.textContent = this.getSpeed(); + chrome.storage.sync.get('speed', function(storage) { + var speed = storage.speed ? storage.speed : '1.00'; + target.playbackRate = speed; + this.speedIndicator.textContent = speed; + }.bind(this)); + this.video.addEventListener('ratechange', function(event) { - this.speedIndicator.textContent = this.getSpeed(); + var speed = this.getSpeed(); + this.speedIndicator.textContent = speed; + chrome.storage.sync.set({'speed': speed}); }.bind(this)); }; diff --git a/manifest.json b/manifest.json index 6c24c51..825f091 100755 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "HTML5 Video Playback Speed Controller", - "version": "0.1.1", + "version": "0.1.2", "manifest_version": 2, "description": "Lean in and speed up your video learning with handy shortcuts to accelerate, slow-down, and rewind your video via your keyboard.", "homepage_url": "https://github.com/igrigorik/videospeed", @@ -9,7 +9,7 @@ "48": "icons/icon48.png", "128": "icons/icon128.png" }, - "permissions": [ "activeTab" ], + "permissions": [ "activeTab", "storage" ], "content_scripts": [{ "all_frames": true, "matches": [ "http://*/*", "https://*/*"], @@ -17,4 +17,4 @@ "js": [ "inject.js" ] } ] -} +} \ No newline at end of file