When viewing youtube.com, can I control the videos from Chrome Dev Console?

google-chrome, javascript, youtube

Solution

If you are using HTML5-based player, you can interact with the `<video>` element directly using its DOM API, as you've been told in Toni's answer.

If you are using Flash-based player, you can interact with it using YouTube JavaScript Player API. The player element seems to have id `movie_player`, and I don't have any problems using API methods right on YouTube.com:

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

Also, don't get confused by `$`, there's no jQuery.

Problem

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

Original source