Skip to content

Instantly share code, notes, and snippets.

@rdp
Forked from dannyid/seek.js
Created September 25, 2016 04:23
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 rdp/38e4314680bdce2225c2613331306e83 to your computer and use it in GitHub Desktop.
Save rdp/38e4314680bdce2225c2613331306e83 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());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment