Hi,
I have the following code, which loads a new video when a button si clicked. The thing is that the script is not very good and I am tring to find a different and better solution to do this.
The videos names are passed trough value attribute.But this loads a new flash player every time I click a button.
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
$(document).ready(function(){
$(".video").click(function(){
var selected=$(this).attr("value");
jwplayer('mediaspace').setup({
'flashplayer': 'player.swf',
'file': selected,
'streamer': 'rtmp://myserver/folder',
'controlbar': 'bottom',
'width': '470',
'height': '290'
});
});
});
</script>
<a href="javascript:void(0);"><img src="btn1.jpg" width="71" height="106" class="video" value="video.mp4"/></a>
<a href="javascript:void(0);"><img src="btn2.jpg" width="71" height="106" class="video" value="video2.mp4"/></a>
Thanks.
why not use the load feature of the JWPlayer.
For example
onclick="$jw('div1').load({image:'images/image.jpg',levels:[{file: 'video/Jelly Trip.mp4'},{file: 'video/Jelly Trip.ogv'}]}).play();"from the above example: