最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

html - Control Netflix player using JavaScript - Stack Overflow

programmeradmin0浏览0评论

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!

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!

Share Improve this question edited Jun 27, 2018 at 11:25 user7637745 9852 gold badges14 silver badges27 bronze badges asked Nov 20, 2015 at 15:34 user4878556user4878556 1
  • Netflix offers keyboard shortcuts (helpflix./en/node/24855) for most of the controls you have mentioned. Perhaps you could just fire a keyboard event? stackoverflow./questions/961532/…. The only thing you'll be able to do is seek to a particular time. – luc122c Commented Oct 12, 2017 at 8:39
Add a ment  | 

1 Answer 1

Reset to default 5

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

media = document.getElementsByTagName("video")[0];

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();
发布评论

评论列表(0)

  1. 暂无评论