I'm getting the TypeError in a function that calls the jwplayer( element ).setup( ... ) API function. In my call to jwplayer(element ).setup, the element variable is set to the value returned by $( 'audio-player' ).last()[ 0 ], which at the time of the call I know contains a reference to the tag that I want the jwplayer to connect to.
Unfortunately, I can't find the API documentation for jwPlayer version 5.10.2295. so I can't determine what possible parameter types the jwplayer call are supporte. However, in other examples of jwplayer(...).setup(...) calls, I've seen a string containing the class name is passed and the file and other properties are hard-coded, something that I don't want to do. In my case I have several places where I want to embed the jwplayer, and of course each place has a different song or video that is to be played, so I don't see how passing in a class name used by multiple tags would work.
Is it possible to pass a specific div object to jwplayer and assign the properties using variables as follows:
function show_player( element, video_url, video_image ) {
jwplayer( element ).setup( {
flashplayer: '/Resources/public/miscjslibs/jwplayer/player.swf',
file: video_url,
image: video_image,
height: 26,
width: 480,
controlbar: 'bottom',
autostart: true
} );
}
Each place were I want to use jwplayer I would use the following:
show_player( $audioPlayers.last()[ 0 ],.
"https://www.youtube.com/embed/uMsOIWa-gHE',
'http://img.youtube.com/vi/uMsOIWa-gHE/0.jpg" );
I've embedded hard-coded strings for the parameters here, but they are actually values from a php script, and are unique to each call. Additionally, the $audioPlayers.last()[ 0 ] references the just before the in each place where the jwplayer is to be embedded.
Thank you,
Ron Brown
↧