Search code examples
javascripthtmljquerynetflix

Seek to a point in a Netflix video


I am creating a sync web-extension and I would like to modify the current time of the video. So I detected the <video> and I do this for changing the time code:

video.currentTime=5;

but netflix automatically put an error on the screen: https://prnt.sc/sm0ro9 and https://prnt.sc/sm0sev

I got the same error with this.video.currentTime=5;

I know that the video.currenttime is working because in screen 1 we can see that netflix send the exact timecode to me.

Does someone know how I can edit the timecode ?


Solution

  • Ok so thanks to Paul I found the answer: I need to inject this code in the page:

    const videoPlayer = netflix.appContext.state.playerApp.getAPI().videoPlayer;
    const player=videoPlayer.getVideoPlayerBySessionId(videoPlayer.getAllPlayerSessionIds()[0]);
    

    And if I want to seek:

    player.seek(1091243)
    

    (it go to 18min)

    Thanks for help guys.