2

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 ?

misterben
  • 7,455
  • 2
  • 26
  • 47
Zarbi4734
  • 61
  • 9
  • Apparently, just like YouTube's `player.seekTo` method exposed on the player's DOM element Netflix uses its own methods to control the video. You'll have to reverse-engineer the page scripts. Also look for existing attempts like [this one](https://stackoverflow.com/a/39703888). – wOxxOm May 23 '20 at 04:50
  • @wOxxOm I tried the 'netflix.cadmium.UiEvents.events.resize[1].scope.events.dragend[1].handler(null, {value: 600, pointerEventData: {playing: false}});' (error:Uncaught TypeError: Cannot read property 'UiEvents' of undefined ) But it's not working and the netflix.cadmium is no more existing... – Zarbi4734 May 23 '20 at 11:31
  • Ok so I made some research and I found that I need to: Jiggle the mouse so the playback controls appear. Wait 10ms for the UI to respond .1ms is apparently not enough Simulate the cursor hovering over the playback slider so the thumbnail preview appears, because apparently the playback slider doesn’t respond to input unless the preview is visible. Wait 10ms for the UI to respond Click on the playback slider (called a “scrubber control” in the minified Netflix code) at the appropriate position to seek the video. So I need JQuery. But the problem is that I don't know how to do this... – Zarbi4734 May 23 '20 at 11:42
  • Have you tried this: https://stackoverflow.com/a/46816934/9487478 ? – Paul May 24 '20 at 09:51
  • @Paul I tried the netflix.cadmium.UiEvents.events.resize[1].scope.events.dragend[1].handler(null, {value: 999, pointerEventData: {playing: false}}); Put I have an error: VM48:1 Uncaught TypeError: Cannot read property 'UiEvents' of undefined at – Zarbi4734 May 24 '20 at 15:20

1 Answers1

4

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.

Zarbi4734
  • 61
  • 9