Domanda

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.

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top