سؤال

I'm trying to make one instance of a popcorn player that I can pass around to different parts of the page. My goal is to change the source of the videos but maintain the same triggers bound to the video element.

I've created a fiddle demonstrating the situation, on 'ended' I change the src in the source tag. Then, I trigger the video to play again, but instead of it playing the new video in the updated source, it plays the previos video.

هل كانت مفيدة؟

المحلول

Use the load method before playing again.

$($('video').children()[0]).attr('src','http://www.808.dk/pics/video/gizmo.mp4');
$pop.load();
$pop.play();

You can see it working here

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top