Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Popcorn changing source

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.

like image 607
captDaylight Avatar asked Dec 22 '25 00:12

captDaylight


1 Answers

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

like image 158
jbalsas Avatar answered Dec 23 '25 13:12

jbalsas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!