Add HLS support (and upgrade Video.JS)
This commit is contained in:
parent
da99ea8288
commit
d06c614ccc
|
@ -19,6 +19,7 @@ var order = [
|
||||||
'ustream.coffee',
|
'ustream.coffee',
|
||||||
'imgur.coffee',
|
'imgur.coffee',
|
||||||
'gdrive-youtube.coffee',
|
'gdrive-youtube.coffee',
|
||||||
|
'hls.coffee',
|
||||||
'update.coffee'
|
'update.coffee'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
23
player/hls.coffee
Normal file
23
player/hls.coffee
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
window.HLSPlayer = class HLSPlayer extends VideoJSPlayer
|
||||||
|
constructor: (data) ->
|
||||||
|
if not (this instanceof HLSPlayer)
|
||||||
|
return new HLSPlayer(data)
|
||||||
|
|
||||||
|
@setupMeta(data)
|
||||||
|
super(data)
|
||||||
|
|
||||||
|
load: (data) ->
|
||||||
|
@setupMeta(data)
|
||||||
|
super(data)
|
||||||
|
|
||||||
|
setupMeta: (data) ->
|
||||||
|
data.meta.direct =
|
||||||
|
# Quality is required for data.meta.direct processing but doesn't
|
||||||
|
# matter here because it's dictated by the stream. Arbitrarily
|
||||||
|
# choose 480.
|
||||||
|
480: [
|
||||||
|
{
|
||||||
|
link: data.id
|
||||||
|
contentType: 'application/x-mpegURL'
|
||||||
|
}
|
||||||
|
]
|
|
@ -15,6 +15,7 @@ TYPE_MAP =
|
||||||
us: UstreamPlayer
|
us: UstreamPlayer
|
||||||
im: ImgurPlayer
|
im: ImgurPlayer
|
||||||
vm: VideoJSPlayer
|
vm: VideoJSPlayer
|
||||||
|
hl: HLSPlayer
|
||||||
|
|
||||||
window.loadMediaPlayer = (data) ->
|
window.loadMediaPlayer = (data) ->
|
||||||
try
|
try
|
||||||
|
|
|
@ -457,6 +457,13 @@ var Getters = {
|
||||||
callback(false, media);
|
callback(false, media);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/* HLS stream */
|
||||||
|
hl: function (id, callback) {
|
||||||
|
var title = "Livestream";
|
||||||
|
var media = new Media(id, title, "--:--", "hl");
|
||||||
|
callback(false, media);
|
||||||
|
},
|
||||||
|
|
||||||
/* imgur.com albums */
|
/* imgur.com albums */
|
||||||
im: function (id, callback) {
|
im: function (id, callback) {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -249,3 +249,4 @@ html(lang="en")
|
||||||
script(defer, src="/js/sc.js")
|
script(defer, src="/js/sc.js")
|
||||||
script(defer, src="/js/froogaloop.min.js")
|
script(defer, src="/js/froogaloop.min.js")
|
||||||
script(defer, src="/js/video.js")
|
script(defer, src="/js/video.js")
|
||||||
|
script(defer, src="/js/videojs-contrib-hls.min.js")
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
(function() {
|
(function() {
|
||||||
var CUSTOM_EMBED_WARNING, CustomEmbedPlayer, DEFAULT_ERROR, DailymotionPlayer, EmbedPlayer, FilePlayer, GoogleDriveYouTubePlayer, HITBOX_ERROR, HitboxPlayer, ImgurPlayer, LivestreamPlayer, Player, RTMPPlayer, SoundCloudPlayer, TYPE_MAP, TwitchPlayer, USTREAM_ERROR, UstreamPlayer, VideoJSPlayer, VimeoPlayer, YouTubePlayer, codecToMimeType, genParam, sortSources,
|
var CUSTOM_EMBED_WARNING, CustomEmbedPlayer, DEFAULT_ERROR, DailymotionPlayer, EmbedPlayer, FilePlayer, GoogleDriveYouTubePlayer, HITBOX_ERROR, HLSPlayer, HitboxPlayer, ImgurPlayer, LivestreamPlayer, Player, RTMPPlayer, SoundCloudPlayer, TYPE_MAP, TwitchPlayer, USTREAM_ERROR, UstreamPlayer, VideoJSPlayer, VimeoPlayer, YouTubePlayer, codecToMimeType, genParam, sortSources,
|
||||||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||||
hasProp = {}.hasOwnProperty;
|
hasProp = {}.hasOwnProperty;
|
||||||
|
|
||||||
|
@ -1257,6 +1257,37 @@
|
||||||
|
|
||||||
})(Player);
|
})(Player);
|
||||||
|
|
||||||
|
window.HLSPlayer = HLSPlayer = (function(superClass) {
|
||||||
|
extend(HLSPlayer, superClass);
|
||||||
|
|
||||||
|
function HLSPlayer(data) {
|
||||||
|
if (!(this instanceof HLSPlayer)) {
|
||||||
|
return new HLSPlayer(data);
|
||||||
|
}
|
||||||
|
this.setupMeta(data);
|
||||||
|
HLSPlayer.__super__.constructor.call(this, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
HLSPlayer.prototype.load = function(data) {
|
||||||
|
this.setupMeta(data);
|
||||||
|
return HLSPlayer.__super__.load.call(this, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
HLSPlayer.prototype.setupMeta = function(data) {
|
||||||
|
return data.meta.direct = {
|
||||||
|
480: [
|
||||||
|
{
|
||||||
|
link: data.id,
|
||||||
|
contentType: 'application/x-mpegURL'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
return HLSPlayer;
|
||||||
|
|
||||||
|
})(VideoJSPlayer);
|
||||||
|
|
||||||
TYPE_MAP = {
|
TYPE_MAP = {
|
||||||
yt: YouTubePlayer,
|
yt: YouTubePlayer,
|
||||||
vi: VimeoPlayer,
|
vi: VimeoPlayer,
|
||||||
|
@ -1273,7 +1304,8 @@
|
||||||
hb: HitboxPlayer,
|
hb: HitboxPlayer,
|
||||||
us: UstreamPlayer,
|
us: UstreamPlayer,
|
||||||
im: ImgurPlayer,
|
im: ImgurPlayer,
|
||||||
vm: VideoJSPlayer
|
vm: VideoJSPlayer,
|
||||||
|
hl: HLSPlayer
|
||||||
};
|
};
|
||||||
|
|
||||||
window.loadMediaPlayer = function(data) {
|
window.loadMediaPlayer = function(data) {
|
||||||
|
|
|
@ -1366,6 +1366,13 @@ function parseMediaLink(url) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((m = url.match(/(.*\.m3u8)/))) {
|
||||||
|
return {
|
||||||
|
id: m[1],
|
||||||
|
type: "hl"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/* Shorthand URIs */
|
/* Shorthand URIs */
|
||||||
// To catch Google Plus by ID alone
|
// To catch Google Plus by ID alone
|
||||||
if ((m = url.match(/^(?:gp:)?(\d{21}_\d{19}_\d{19})/))) {
|
if ((m = url.match(/^(?:gp:)?(\d{21}_\d{19}_\d{19})/))) {
|
||||||
|
|
6950
www/js/video.js
6950
www/js/video.js
File diff suppressed because it is too large
Load diff
12
www/js/videojs-contrib-hls.min.js
vendored
Normal file
12
www/js/videojs-contrib-hls.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue