Skip to content

Instantly share code, notes, and snippets.

@rdp
Last active May 4, 2020 22:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdp/93c761b3524529e591e5286073545362 to your computer and use it in GitHub Desktop.
Save rdp/93c761b3524529e591e5286073545362 to your computer and use it in GitHub Desktop.
// attempt to fidn the first <video ... tag on the page:
function findFirstVideoTag() {
var all = document.getElementsByTagName("video");
if (all.length > 0)
return all[0];
else {
// iframes
var i, frames;
frames = document.getElementsByTagName("iframe");
for (i = 0; i < frames.length; ++i) {
try { var childDocument = frame.contentDocument } catch (e) { continue }; // skip ones we can't access :|
all = frames[i].contentDocument.document.getElementsByTagName("video");
if (all.length > 1)
return all[0];
}
return null;
}
}
video_element = findFirstVideoTag();
video_element.playbackRate = 3; // triple speed it
@rdp
Copy link
Author

rdp commented Sep 15, 2016

with amazon [google chrome OS X] to seek somewhere: b.pause(); b.currentTime = 3; // resumes playback at second 3

play() and pause() maybe after a seek or some thing? sometimes pause() after a seek makes it work?

@rdp
Copy link
Author

rdp commented Sep 18, 2016

playbackRate = 3; // triple speed, see also https://github.com/igrigorik/videospeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment