Add crossorigin attribute for custom media with text tracks

Mitigates #702
This commit is contained in:
Calvin Montgomery 2017-08-21 20:06:07 -07:00
parent 0885a619b9
commit 7c897d91db
2 changed files with 15 additions and 4 deletions

View File

@ -47,9 +47,16 @@ window.VideoJSPlayer = class VideoJSPlayer extends Player
loadPlayer: (data) -> loadPlayer: (data) ->
waitUntilDefined(window, 'videojs', => waitUntilDefined(window, 'videojs', =>
attrs =
width: '100%'
height: '100%'
if @mediaType == 'cm' and data.meta.textTracks
attrs.crossorigin = 'anonymous'
video = $('<video/>') video = $('<video/>')
.addClass('video-js vjs-default-skin embed-responsive-item') .addClass('video-js vjs-default-skin embed-responsive-item')
.attr(width: '100%', height: '100%') .attr(attrs)
removeOld(video) removeOld(video)
@sources = sortSources(data.meta.direct) @sources = sortSources(data.meta.direct)

View File

@ -509,11 +509,15 @@
VideoJSPlayer.prototype.loadPlayer = function(data) { VideoJSPlayer.prototype.loadPlayer = function(data) {
return waitUntilDefined(window, 'videojs', (function(_this) { return waitUntilDefined(window, 'videojs', (function(_this) {
return function() { return function() {
var video; var attrs, video;
video = $('<video/>').addClass('video-js vjs-default-skin embed-responsive-item').attr({ attrs = {
width: '100%', width: '100%',
height: '100%' height: '100%'
}); };
if (_this.mediaType === 'cm' && data.meta.textTracks) {
attrs.crossorigin = 'anonymous';
}
video = $('<video/>').addClass('video-js vjs-default-skin embed-responsive-item').attr(attrs);
removeOld(video); removeOld(video);
_this.sources = sortSources(data.meta.direct); _this.sources = sortSources(data.meta.direct);
if (_this.sources.length === 0) { if (_this.sources.length === 0) {