Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.

3 fixes #51

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions dist/videojs-chromecast.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,16 @@ var ChromeCastButton = (function (_Button) {
tracks.push(track);
}
mediaInfo.textTrackStyle = new chrome.cast.media.TextTrackStyle();
mediaInfo.textTrackStyle.foregroundColor = '#FFFFFF';
mediaInfo.textTrackStyle.backgroundColor = '#00000060';
mediaInfo.textTrackStyle.edgeType = chrome.cast.media.TextTrackEdgeType.DROP_SHADOW;
mediaInfo.textTrackStyle.windowType = chrome.cast.media.TextTrackWindowType.ROUNDED_CORNERS;

// Update the font to a more generic ux ( Used netflix as example )
mediaInfo.textTrackStyle = new chrome.cast.media.TextTrackStyle();
mediaInfo.textTrackStyle.fontFamily = 'Arial'
mediaInfo.textTrackStyle.foregroundColor = '#FFFFFF';
mediaInfo.textTrackStyle.backgroundColor = '#00000000';
mediaInfo.textTrackStyle.fontScale = '1.1'
mediaInfo.textTrackStyle.edgeColor = '#00000099'
mediaInfo.textTrackStyle.edgeType = chrome.cast.media.TextTrackEdgeType.DROP_SHADOW;

}
// Load/Add audio tracks

Expand Down Expand Up @@ -261,6 +267,15 @@ var ChromeCastButton = (function (_Button) {
loadRequest.autoplay = true;
loadRequest.currentTime = this.player_.currentTime();

// Set active track by selected subtitle
var activeTrack = 0
document.querySelectorAll('.vjs-menu-content > .vjs-captions-menu-item').forEach(function(el, i) {
if (el.classList.contains('vjs-selected')) {
activeTrack = (i + 1)
}
})
loadRequest.activeTrackIds = [activeTrack];

this.apiSession.loadMedia(loadRequest, this.onMediaDiscovered.bind(this), this.castError.bind(this));
this.apiSession.addUpdateListener(this.onSessionUpdate.bind(this));
}
Expand Down Expand Up @@ -473,7 +488,7 @@ var Chromecast = (function (_Tech) {
_createClass(Chromecast, [{
key: 'createEl',
value: function createEl() {
var el = _videoJs2['default'].createEl('div', {
var el = _videoJs2['default'].dom.createEl('div', {
id: this.options_.techId,
className: 'vjs-tech vjs-tech-chromecast'
});
Expand Down Expand Up @@ -1008,4 +1023,4 @@ exports['default'] = plugin;
module.exports = exports['default'];
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./videojs-chromecast":3}]},{},[4])(4)
});
});