Home › Forums › JavaScript › AnythingSlider: Using JW Player › Re: AnythingSlider: Using JW Player
My problem is that firebug thows the following error:
TypeError: jwplayer(…).setup is not a function
width: v[4],
I’ve tried everything, even downgrade jwplayer jscript but the nly thing i’ve got is 48 h. of work lost…..
Desperatly need help, this is my code:
')
jQuery(function($){
// Make a list of videos first
// ***********************
var flashplayer = "/jwplayer/jwplayer.flash.swf",
videos = [];
// videos.push([ id, file, image, height, width ]);
videos.push(["container1","/videos/marca-la-diferencia_v4.flv", "/previo-ventajas.jpg",392,960]);
videos.push(["container2","/videos/promocional.flv", "/previo-testimonio.jpg",392,960]);
// Set up players
$.each(videos, function(i, v) {
jwplayer(v[0]).setup({
file: v[1],
flashplayer: flashplayer,
image: v[2],
height: v[3],
width: v[4]
});
});
$('#slider').anythingSlider({
buildArrows : true, // If true, builds the forwards and backwards buttons
buildNavigation : true, // If true, builds a list of anchor links to link to each panel
buildStartStop : false, // If true, builds the start/stop button
resizeContents : true,
// pause all videos when changing slides
onSlideInit: function(e, slider) {
if (jwplayer) {
$.each(videos, function(i) {
jwplayer(i).pause(true);
});
}
},
// Only play a paused video when a slide comes into view
onSlideComplete: function(slider) {
if (jwplayer) {
$.each(videos, function(i, v) {
// find ID in panel
if (slider.$currentPage.find('#' + v[0]).length && jwplayer(v[0]).getState() === 'PAUSED') {
jwplayer(v[0]).play();
}
});
}
},
// *********** Video ***********
// return true if video is playing or false if not
isVideoPlaying: function(slider) {
if (jwplayer) {
// jwplayer object is wrapped in #{id}_wrapper
var vid = slider.$currentPage.find('[id$=_wrapper]'),
jwid = (vid.length) ? vid.attr('id').replace(/_wrapper/, '') : '';
if (vid.find('#' + jwid).length && jwplayer(jwid).getState() === 'PLAYING') {
return true;
}
}
return false;
}
});
});