Skip to content

Instantly share code, notes, and snippets.

@ohio813
Forked from dannyid/seek.js
Created February 26, 2016 09:09
Show Gist options
  • Save ohio813/867c2122ca747aae0250 to your computer and use it in GitHub Desktop.
Save ohio813/867c2122ca747aae0250 to your computer and use it in GitHub Desktop.
Netflix Seek
// The player
var player = netflix.cadmium.objects.videoPlayer();
// Metadata about current episode -- ID and url to get frame at a specific time
var episodeId = netflix.cadmium.metadata.getActiveVideo().episodeId;
var imgRoot = netflix.cadmium.metadata.getActiveVideo().progressImageRoot;
// Generates URL of preview image for given timestamp
function getFrame(timestamp) {
var t = Math.floor(timestamp/10000).toString(10);
var f = '00000'.slice(t.length) + t;
return imgRoot + f +'.jpg';
};
// Seek to time in milliseconds
player.seek(343931);
// Example: Get image of current time
getFrame(player.getCurrentTime());
@mjohnst
Copy link

mjohnst commented Mar 11, 2016

My window.netflix.cadmium.objects object doesn't have a videoPlayer() function. Did Netflix remove this?

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