问题
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?
回答1:
Try accessing 'video' directly
$('video').on('play', function() {
alert('playing');
);
来源:https://stackoverflow.com/questions/14166857/detect-play-event-in-youtube-wrapped-via-mediaelement-js