clwen
clwen

Reputation: 20929

Detect play event in youtube wrapped via MediaElement.js

I wrapped a youtube video into video tag via MediaElement.js:

<video id="v" width="640" height="360">
    <source src="http://www.youtube.com/watch?v=nOEw9iiopwI" type="video/youtube" >
</video>

It can be played correctly. I want to detect the play event (assume jQuery loaded):

$("#v").on('play', function() {
  console.log('play event entered');
  // do something more here
});

});

It seems the event can't be detected correctly. Is it because of the cross-origin issue? If so, theoretically I can build a proxy server for videos and then detect it correctly?

What I ultimately want to do is load the youtube clips into canvas. Any suggestion?

Upvotes: 0

Views: 1138

Answers (1)

Rid Iculous
Rid Iculous

Reputation: 3962

Try accessing 'video' directly

$('video').on('play', function() {
     alert('playing');
 );

Upvotes: 1

Related Questions