player: support HLS vod for vidme (fixes #703)

- Upgrade videojs-contrib-hls to latest version
  - Update VideoJSPlayer to support "auto" quality tag to delegate to
    the HLS plugin for automatic quality selection
  - mediaquery change:
    9f5122e031
This commit is contained in:
Calvin Montgomery 2017-09-04 09:44:30 -07:00
parent 45d0e0b4c3
commit 97231e515c
4 changed files with 28 additions and 16 deletions

View file

@ -2,7 +2,7 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "3.47.2", "version": "3.47.3",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },

View file

@ -12,6 +12,7 @@ sortSources = (sources) ->
idx = 5 # 480p idx = 5 # 480p
qualityOrder = qualities.slice(idx).concat(qualities.slice(0, idx).reverse()) qualityOrder = qualities.slice(idx).concat(qualities.slice(0, idx).reverse())
qualityOrder.unshift('auto')
sourceOrder = [] sourceOrder = []
flvOrder = [] flvOrder = []
for quality in qualityOrder for quality in qualityOrder
@ -34,6 +35,12 @@ sortSources = (sources) ->
quality: source.quality quality: source.quality
) )
getSourceLabel = (source) ->
if source.quality is 'auto'
return 'auto'
else
return "#{source.quality}p #{source.type.split('/')[1]}"
waitUntilDefined(window, 'videojs', => waitUntilDefined(window, 'videojs', =>
videojs.options.flash.swf = '/video-js.swf' videojs.options.flash.swf = '/video-js.swf'
) )
@ -72,7 +79,7 @@ window.VideoJSPlayer = class VideoJSPlayer extends Player
src: source.src src: source.src
type: source.type type: source.type
res: source.quality res: source.quality
label: "#{source.quality}p #{source.type.split('/')[1]}" label: getSourceLabel(source)
).appendTo(video) ).appendTo(video)
) )

View file

@ -1,5 +1,5 @@
(function() { (function() {
var CUSTOM_EMBED_WARNING, CustomEmbedPlayer, DEFAULT_ERROR, DailymotionPlayer, EmbedPlayer, FilePlayer, GoogleDrivePlayer, GoogleDriveYouTubePlayer, HLSPlayer, ImgurPlayer, LivestreamPlayer, Player, RTMPPlayer, SmashcastPlayer, SoundCloudPlayer, TYPE_MAP, TwitchPlayer, UstreamPlayer, VideoJSPlayer, VimeoPlayer, YouTubePlayer, codecToMimeType, genParam, sortSources, var CUSTOM_EMBED_WARNING, CustomEmbedPlayer, DEFAULT_ERROR, DailymotionPlayer, EmbedPlayer, FilePlayer, GoogleDrivePlayer, GoogleDriveYouTubePlayer, HLSPlayer, ImgurPlayer, LivestreamPlayer, Player, RTMPPlayer, SmashcastPlayer, SoundCloudPlayer, TYPE_MAP, TwitchPlayer, UstreamPlayer, VideoJSPlayer, VimeoPlayer, YouTubePlayer, codecToMimeType, genParam, getSourceLabel, 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;
@ -462,6 +462,7 @@
idx = 5; idx = 5;
} }
qualityOrder = qualities.slice(idx).concat(qualities.slice(0, idx).reverse()); qualityOrder = qualities.slice(idx).concat(qualities.slice(0, idx).reverse());
qualityOrder.unshift('auto');
sourceOrder = []; sourceOrder = [];
flvOrder = []; flvOrder = [];
for (j = 0, len = qualityOrder.length; j < len; j++) { for (j = 0, len = qualityOrder.length; j < len; j++) {
@ -490,6 +491,14 @@
}); });
}; };
getSourceLabel = function(source) {
if (source.quality === 'auto') {
return 'auto';
} else {
return source.quality + "p " + (source.type.split('/')[1]);
}
};
waitUntilDefined(window, 'videojs', (function(_this) { waitUntilDefined(window, 'videojs', (function(_this) {
return function() { return function() {
return videojs.options.flash.swf = '/video-js.swf'; return videojs.options.flash.swf = '/video-js.swf';
@ -531,7 +540,7 @@
src: source.src, src: source.src,
type: source.type, type: source.type,
res: source.quality, res: source.quality,
label: source.quality + "p " + (source.type.split('/')[1]) label: getSourceLabel(source)
}).appendTo(video); }).appendTo(video);
}); });
if (data.meta.gdrive_subtitles) { if (data.meta.gdrive_subtitles) {

File diff suppressed because one or more lines are too long