Skip to content

Instantly share code, notes, and snippets.

@datt
Last active December 29, 2015 17:29
Show Gist options
  • Select an option

  • Save datt/7704443 to your computer and use it in GitHub Desktop.

Select an option

Save datt/7704443 to your computer and use it in GitHub Desktop.
Initialize jwplayer for showing video on a element.
function displayVideo(elementID, options) {
var defaults;
defaults = {
height: 347,
width: 624,
swfPath: '/jwplayer/jwplayer.flash.swf',
controls: false,
autostart: true
};
var settings = $.extend({}, defaults, options);
if ($("#" + elementID).length > 0) {
jwplayer(elementID).setup({
flashplayer: settings['swfPath'],
controls: settings['controls'],
file: settings['url'],
height: settings['height'],
width: settings['width'],
autostart: settings['autostart']
});
return true;
} else {
alert("No html element found for initializing video.");
return false;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment