When watching youtube.com, is it possible to control video from the Chrome Dev console?

I want to be able to pause and play videos from the JavaScript console in Chrome DevTools. Is it possible?

+6
source share
3 answers

If you are using an HTML5-based player, you can interact with the <video> element using your DOM API , as Tony told you in the answer.

If you use a Flash player, you can interact with it using the YouTube JavaScript Player API . The player element seems to have id movie_player , and I have no problem using the API methods directly on YouTube.com:

 $('#movie_player').playVideo(); $('#movie_player').seekTo(60); $('#movie_player').pauseVideo(); 

Also, don't confuse $ , no jQuery.

+9
source

When viewed using an HTML5 player,

 $('.video-stream').play() $('.video-stream').pause() 

OR

 $('video').play() $('video').pause() 

Contact here .

When viewing using a Flash player,

 player.playVideo() player.pauseVideo() 

Contact here .

+3
source

This will depend on whether you are using html5 or a flash player.

I don’t think you can talk with a flash player, but html5 is possible.

You can either send a click event to the html5-client buttons, or use the video () and pause () methods directly.

http://www.w3schools.com/tags/ref_av_dom.asp

 $("video").play(); $("video").pause(); //seems like jquery has some support of its own for these basic functions too 
+1
source

All Articles