Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Control Netflix player using JavaScript

I would like to make a Chrome extension that is able to control the Netflix player.

The current Netflix player is written in HTML5 as far as I can tell, so I was wondering if there is a way to control the player, e.g. play, pause, volume control and changing the position of the video.

I've tried using this to control the playing and pausing functions and it works.

document.getElementsByClassName("player-control-button player-play-pause")[0].click();

I've also tried using but then I just get an error saying that videoPlayer() isn't a function

netflix.cadmium.objects.videoPlayer();

Is there something similar I can do to change the volume and the position of the video?

Thanks!

like image 827
mhsjlw Avatar asked Nov 20 '15 15:11

mhsjlw


1 Answers

First get the <video> element as variable e.g. by:

media = document.getElementById("netflixVideoPlayer");

After that you can control the volume. To mute the sound:

media.volume = 0

Turn the volume to 100%:

media.volume = 1

Turn the volume to 60%:

media.volume = 0.6

Start the video:

media.start();

Pause the video:

media.pause();
like image 185
mfrischbutter Avatar answered Sep 22 '22 06:09

mfrischbutter