custom-media: implement queueing and playback changes

This commit is contained in:
Calvin Montgomery 2017-08-08 20:35:17 -07:00
parent a6de8731b3
commit 04c9d48779
10 changed files with 93 additions and 21 deletions

View file

@ -545,6 +545,18 @@
}).appendTo(video);
});
}
if (data.meta.textTracks) {
data.meta.textTracks.forEach(function(track) {
var label;
label = track.name;
return $('<track/>').attr({
src: track.url,
kind: 'subtitles',
type: track.type,
label: label
}).appendTo(video);
});
}
_this.player = videojs(video[0], {
autoplay: true,
controls: true,
@ -1529,7 +1541,8 @@
vm: VideoJSPlayer,
hl: HLSPlayer,
sb: VideoJSPlayer,
tc: VideoJSPlayer
tc: VideoJSPlayer,
cm: VideoJSPlayer
};
window.loadMediaPlayer = function(data) {

View file

@ -56,6 +56,8 @@ function formatURL(data) {
return "https://streamable.com/" + data.id;
case "tc":
return "https://clips.twitch.tv/" + data.id;
case "cm":
return data.id;
default:
return "#";
}
@ -1413,6 +1415,12 @@ function parseMediaLink(url) {
type: "fi"
};
}
if ((m = url.match(/^cm:(.*)/))) {
return {
id: m[1],
type: "cm"
};
}
// Generic for the rest.
if ((m = url.match(/^([a-z]{2}):([^\?&#]+)/))) {
return {
@ -1430,6 +1438,11 @@ function parseMediaLink(url) {
msg: "Raw files must begin with 'https'. Plain http is not supported."
});
throw new Error("ERROR_QUEUE_HTTP");
} else if (tmp.match(/\.json$/)) {
return {
id: url,
type: "cm"
};
} else if (tmp.match(/\.(mp4|flv|webm|og[gv]|mp3|mov|m4a)$/)) {
return {
id: url,