Last active
August 29, 2015 14:00
-
-
Save dmlap/2b965286cd69ca89a1a3 to your computer and use it in GitHub Desktop.
An example player configuration that allows for custom plugin initialization.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The player configuration: | |
*/ | |
{ | |
/* include plugins through the `scripts` property... */ | |
"scripts": [ | |
'http://www.londonlive.co.uk/player/plugins/share-panel.js', | |
'http://www.londonlive.co.uk/player/plugins/age-gate.js', | |
'http://www.londonlive.co.uk/player/plugins/poster.js', | |
'http://www.londonlive.co.uk/player/plugins/logo-badge.js', | |
'http://players.brightcove.com/videojs-ima3/videojs.ima3.min.js', | |
/* The HLS plugin is included by default. Without specifying media, it will just sit there waiting | |
to be initialized by the page. */ | |
/* BC analytics is configured by default, so you don't need to add it here. */ | |
], | |
"stylesheets": [ | |
"https://players.brightcove.com/videojs-ima3/videojs.ima3.min.css" | |
], | |
/* Only initialize a subset of the plugins. The others we'll trigger from the embedding page */ | |
"plugins": [{ | |
"name": "age-gate" | |
}, { | |
"name": "logo-badge" | |
}, { | |
"name": "ima3", | |
/* You can override the default ad URL by specifying options here. If you need to change the ad tag | |
parameters per-request, you could leave this plugin out and initialize it from the page */ | |
"options": { | |
"serverURL": "http://ads.net/custom?key1=a&key2=b", | |
"adSwf": "https://players.brightcove.com/videojs-ima3/VideoJSIMA3.swf" | |
} | |
}] | |
/* Note that there is no `media` property, since you'll be handling that through the page */ | |
} | |
/** | |
* On your site, you can manually initialize the rest of the plugins: | |
*/ | |
var player = videojs('#video-player'); | |
if (useLowResStream) { | |
player.hls('http://www.londonlive.co.uk/videos/low.m3u8'); | |
} else { | |
player.hls('http://www.londonlive.co.uk/videos/high.m3u8'); | |
} | |
// we could initialize other plugins that require page interaction here, too: | |
player.sharePanel('Like us on Facebook!') | |
/** | |
* I would recommend removing the default play button through CSS included before your player | |
* in the page: | |
* | |
* .vjs-play-control { display: none; } | |
* | |
* If there are issues with that, we could look into exposing the video.js initialization options | |
* to prevent the button from being created to begin with. | |
*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment