Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Clear previous video on page



var VideoPlayer = {

setup: function(element, sources, thumbnail, id, test)
{
jwplayer("myElement").remove();
jwplayer("myElement2").setup
({
height: <?php echo $this->height; ?>,
width:<?php echo $this->width; ?>,
flashplayer: "<?php echo ($this->assetsUrl.'/jwplayer.flash.swf');?>",
sources:
[
{ file: "<?php echo $vidRoot;?>mp4SD/"+test+"sd.mp4"},
{ file: "<?php echo $vidRoot;?>mp4HD/"+test+"hd.mp4"},
{ file: "<?php echo $vidRoot;?>webmSD/"+test+"sd.webm"},
{ file: "<?php echo $vidRoot;?>webmHD/"+test+"hd.webm"},
{ file: "<?php echo $vidRoot;?>flv/"+test+".flv"},
]
});
}
};


There are 2 video elements on the page.
The first one is the main video that is loaded at launch.
Call it main_vid1.

It's easy enough to load and remove main_vid1.


Now the second video element on the page comes from a set of thumbnails related to the main_vid.
Could call them thumbnail_vids.

When loading a 3rd or 4th thumbnail_vid the player just stops working.

I figure I need to remove the element and reload... but I don't know how to clear the previous video as the id for the thumbnail vid is sent via jquery from clicking on the thumbnail.



4 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

Do you have a link to where you are trying to do this?

matthew

User  
0 rated :

Can't provide a link as it is all on local machine as dev. I figured maybe it could work if I provided a new ID for each iteration of video shown from the thumbnail.

matthew

User  
0 rated :

Ah wait, I seem to have it all working by just using the exact same video element ID. Seems that it can just be overloaded with no problem

Ethan Feldman

JW Player Support Agent  
0 rated :

Yes, you can definitely do that.

This question has received the maximum number of answers.