5 <title>Chorus Video Player
</title>
7 <link href=
"lib/video-js/video-js.min.css" rel=
"stylesheet">
8 <link href=
"lib/video-js/plugins/videojs-chromecast/videojs-chromecast.css?01217" rel=
"stylesheet">
10 <script src=
"lib/jquery/jquery-3.5.1.min.js"></script>
11 <script type=
"text/javascript" src=
"lib/video-js/plugins/videojs-chromecast/cast_sender.js"></script>
16 function getParameterByName(name
) {
17 name
= name
.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
18 var regex
= new RegExp("[\\?&]" + name
+ "=([^&#]*)"),
19 results
= regex
.exec(location
.search
);
20 return results
== null ? "" : decodeURIComponent(results
[1].replace(/\+/g, " "));
22 function getBaseURL() {
23 var parts
= window
.location
.href
.split('videoPlayer.html');
24 return parts
[0].replace(/\/\s*$/, '');
28 var src
= getParameterByName('src'),
29 player
= getParameterByName('player'),
30 yt
= getParameterByName('yt'),
31 bg
= getParameterByName('bg'),
37 // Do we have something to play?
40 // Make the html5 player
41 if(player
== 'html5'){
42 $player
= $('<video>', {
44 "class": "video-js vjs-default-skin",
45 "controls": "controls",
47 "autoplay": "autoplay",
48 "data-setup": JSON
.stringify({}),
49 "poster": getBaseURL() + bg
51 $player
.append($('<source>', {
53 "src": getBaseURL() + '/' + src
55 $player
.attr('width', width
).attr('height', height
);
58 // Make the VLC player.
60 $player
= $('<embed>', {
61 "type": "application/x-vlc-plugin",
62 "pluginspage": "http://www.videolan.org",
63 "version": "VideoLAN.VLCPlugin.2",
71 // Make the divX player.
73 $player
= $('<object>', {
75 "classid": "clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616",
78 "codebase": "http://go.divx.com/plugin/DivXBrowserPlugin.cab"
80 $player
.append($('<param>', {name
: 'custommode', value
: 'none'}));
81 $player
.append($('<param>', {name
: 'previewImage', value
: ''}));
82 $player
.append($('<param>', {name
: 'autoPlay', value
: 'true'}));
83 $player
.append($('<param>', {name
: 'src', value
: '/' + src
}));
84 $player
.append($('<embed>', {
92 pluginspage
: 'http://go.divx.com/plugin/download/'
97 $(document
).ready(function(){
99 // update download link
100 $('.dl').attr('href', src
);
102 $('#stream').click(function(e
){
103 e
.preventDefault($(this).attr('href'));
104 console
.log($(this).attr('href'));
105 window
.location
= $(this).attr('href');
111 .on('change', function(e
){
112 var url
= 'videoPlayer.html?player=' + $(this).val() + '&src=' + encodeURIComponent(src
) + '&bg=' + encodeURIComponent(bg
);
113 window
.location
= url
;
119 // If playing a youtube video.
120 $player
= $('<iframe>', {
123 src
: 'https://www.youtube.com/embed/' + yt
+ '?rel=0&showinfo=0&autoplay=1&iv_load_policy=3',
125 allowfullscreen
: 'allowfullscreen',
126 allow
: 'autoplay; encrypted-media'
128 $(document
).ready(function(){
129 $('#switch-player').empty();
130 $('#download').empty();
134 <style type=
"text/css">
139 margin: 0; background: #000; padding: 0; overflow: hidden
; color: #333;
143 text-decoration: none
;
153 font: 12px Arial
, Helvetica
, "Nimbus Sans L", sans-serif
;
155 padding: 5px 10px 0 0;
160 padding: 5px 0 0 10px;
180 padding-bottom: 56.25%; /* 16:9 */
193 .vjs-error .vjs-error-display .vjs-modal-dialog-content {
194 background: rgba
(0,0,0,0.5);
201 .vjs-error .vjs-error-display:before {
207 <div class=
"player-wrapper">
210 <div id=
"player-actions">
212 <a href=
"" title=
"Force download of this video" class=
"dl" id=
"download" download
>Download
</a> -
213 <a href=
"" title=
"Navigate to video so the browser can try and native stream it. Some browsers may still download" class=
"dl" id=
"stream">Stream
</a>
215 <select id=
"switch-player">
216 <option value=
"html5">html5
</option>
217 <option value=
"vlc">VLC Web player
</option>
218 <option value=
"divx">DivX Webplayer
</option>
222 <script> $('#player').prepend($player
);</script>
223 <script src=
"lib/video-js/video.min.js"></script>
224 <script src=
"lib/video-js/plugins/videojs-chromecast/videojs-chromecast.min.js"></script>