Fix mediaquery for contentType

This commit is contained in:
calzoneman 2015-07-06 11:21:52 -07:00
parent 87c1112508
commit e40db5f27e
2 changed files with 3 additions and 19 deletions

View File

@ -1,11 +1,3 @@
fixContentType = (contentType) ->
# TODO: In mediaquery, fix Google Drive/Google+ to return video/mp4,
# video/webm so this is unnecessary
if /^(video|audio)\//.test(contentType)
return contentType
else
return "video/#{contentType}"
sortSources = (sources) -> sortSources = (sources) ->
if not sources if not sources
console.error('sortSources() called with null source list') console.error('sortSources() called with null source list')
@ -25,7 +17,7 @@ sortSources = (sources) ->
flv = [] flv = []
nonflv = [] nonflv = []
sources[quality].forEach((source) -> sources[quality].forEach((source) ->
source.contentType = fixContentType(source.contentType) source.contentType = source.contentType
source.quality = quality source.quality = quality
if source.contentType == 'video/flv' if source.contentType == 'video/flv'
flv.push(source) flv.push(source)

View File

@ -1,5 +1,5 @@
(function() { (function() {
var CUSTOM_EMBED_WARNING, CustomEmbedPlayer, DEFAULT_ERROR, DailymotionPlayer, EmbedPlayer, FilePlayer, HITBOX_ERROR, HitboxPlayer, ImgurPlayer, LivestreamPlayer, Player, RTMPPlayer, SoundCloudPlayer, TYPE_MAP, TwitchPlayer, UstreamPlayer, VideoJSPlayer, VimeoPlayer, YouTubePlayer, codecToMimeType, fixContentType, genParam, sortSources, var CUSTOM_EMBED_WARNING, CustomEmbedPlayer, DEFAULT_ERROR, DailymotionPlayer, EmbedPlayer, FilePlayer, HITBOX_ERROR, HitboxPlayer, ImgurPlayer, LivestreamPlayer, Player, RTMPPlayer, SoundCloudPlayer, TYPE_MAP, TwitchPlayer, 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;
@ -444,14 +444,6 @@
})(Player); })(Player);
fixContentType = function(contentType) {
if (/^(video|audio)\//.test(contentType)) {
return contentType;
} else {
return "video/" + contentType;
}
};
sortSources = function(sources) { sortSources = function(sources) {
var flv, flvOrder, i, idx, len, nonflv, pref, qualities, quality, qualityOrder, sourceOrder; var flv, flvOrder, i, idx, len, nonflv, pref, qualities, quality, qualityOrder, sourceOrder;
if (!sources) { if (!sources) {
@ -473,7 +465,7 @@
flv = []; flv = [];
nonflv = []; nonflv = [];
sources[quality].forEach(function(source) { sources[quality].forEach(function(source) {
source.contentType = fixContentType(source.contentType); source.contentType = source.contentType;
source.quality = quality; source.quality = quality;
if (source.contentType === 'video/flv') { if (source.contentType === 'video/flv') {
return flv.push(source); return flv.push(source);