I have a Netflix account and I looked under the hood of my video player running inside Google Chrome. Netflix calls its video player βCadmium,β and javascript provides all the functions and event handlers you might expect, such as play, pause, pause, mute, etc. I am creating a small Chrome extension that would let me name these cadmium players, but the hard part for me is figuring out how to instantiate the player so that I can start making calls. Javascript is large, complex, and somewhat obscure. As soon as I can create an instance of this player, I think making calls in a function will be easy.
Here is the corresponding js snippet:
muteOn: function() { this.savedVolume = this.getVolume(), this.updateVolumeDisplay(0), this.scrubber.updatePercent(0), this.muted = !0, this.videoPlayer.setMuted(this.muted) }
In Chrome dev tools, I can set a breakpoint inside this block, and execution gets to the breakpoint when I press the Mute button on the netflix video player. Netflix js (unsurprisingly) is very confused by renaming methods. I tried to go through the code in the debugger and finished a hundred rabbit holes, I could never find my way to the top of the stack so that I could make the same call (at the top of the stack) to mimic the user by pressing the mute button. I also tried using a soft click on the mute button on the UI player that would suit my needs equally well, but they have serious defense mechanisms that rotate me like the top.
Since there are more than 100 thousand javascript lines, and I'm not sure which fragments will be relevant to this post, I would like to suggest you download Netflix in Chrome, open the developer tools, play a movie and check the pause or mute. Interacting with these video player controls takes you to a maze of javascript, which Iβm trying to understand how I can use to control aspects of the player programmatically (just from the dev tools at the moment it's good). Another important thing I need to find out is how to request a video player to determine the current elapsed video playback time.
Any ideas how I can crack this nut? (Thanks in advance!)
javascript netflix
Herrimancoder
source share