3

I'm trying to build a chrome extension to synchronize Netflix viewing lobbies. The extension injects a script into the Netflix tab when the user navigates to a /watch/ url.

https://github.com/jonnylin13/LongDistance/blob/dev/extension/controller.js

I was able to get the play/pause/seek functions with the following code to work, but for some reason when I ran it today the netflix object started returning undefined. I assume they must have changed something just today, because it had been working fine in the past.

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

Is there a certain way that they can hide the netflix object from the injected script? It still exists when I call it from the debug console.

Any tips would be appreciated, I just want to know if there are known methods to do something like this so I can try and think of a way around it.

I've tried manually setting a timeout and then looking for the netflix object, but it still returns undefined -- so I'm doubtful it has anything to do with loading.

jonooo
  • 65
  • 2
  • 8
  • Not sure why it worked in the past, AFAICT it should never have because to access a page variable your content script needs to [insert a DOM script element](https://stackoverflow.com/a/9517879). – wOxxOm Apr 30 '19 at 04:36
  • @wOxxOm Thanks, I'll try injecting via a content script. Very strange that it was working previously... – jonooo Apr 30 '19 at 06:07

0 Answers0