문제

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