Skip to content

Instantly share code, notes, and snippets.

@stefansundin
Last active April 25, 2017 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefansundin/b50bf29b02b028d6038fda7183b2f604 to your computer and use it in GitHub Desktop.
Save stefansundin/b50bf29b02b028d6038fda7183b2f604 to your computer and use it in GitHub Desktop.
Speed up the Wistia player automatically.
{
"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
}
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