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.