Last active
April 25, 2017 20:21
-
-
Save stefansundin/b50bf29b02b028d6038fda7183b2f604 to your computer and use it in GitHub Desktop.
Speed up the Wistia player automatically.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Wistia auto-speed", | |
"version": "1.0", | |
"description": "Automatically speed up Wistia embeds to 1.5x, and select the best quality.", | |
"content_scripts": [ | |
{ | |
"matches": [ | |
"*://*.wistia.com/medias/*", | |
"*://fast.wistia.net/embed/iframe/*" | |
], | |
"js": ["wistia.js"], | |
"run_at": "document_end", | |
"all_frames": true | |
} | |
], | |
"manifest_version": 2 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var speed = "1.5x"; | |
var timer1 = setInterval(function() { | |
var button = document.querySelector(`button[title='${speed}']`); | |
if (button) { | |
console.log(`Playback speed to ${speed}.`); | |
clearInterval(timer1); | |
button.click(); | |
} | |
}, 1000); | |
var timer2 = setInterval(function() { | |
var button = document.querySelector(`button[title='1080p']`) || document.querySelector(`button[title='720p']`); | |
if (button) { | |
console.log(`Playback quality to ${button.title}.`); | |
clearInterval(timer2); | |
button.click(); | |
} | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment