|
|
@ -151,6 +151,7 @@ player.vttThumbnails({
|
|
|
|
|
|
|
|
|
|
|
|
// Enable annotations
|
|
|
|
// Enable annotations
|
|
|
|
if (!video_data.params.listen && video_data.params.annotations) {
|
|
|
|
if (!video_data.params.listen && video_data.params.annotations) {
|
|
|
|
|
|
|
|
window.addEventListener('load', function (e) {
|
|
|
|
var video_container = document.getElementById('player');
|
|
|
|
var video_container = document.getElementById('player');
|
|
|
|
let xhr = new XMLHttpRequest();
|
|
|
|
let xhr = new XMLHttpRequest();
|
|
|
|
xhr.responseType = 'text';
|
|
|
|
xhr.responseType = 'text';
|
|
|
@ -190,6 +191,7 @@ if (!video_data.params.listen && video_data.params.annotations) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
xhr.send();
|
|
|
|
xhr.send();
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function increase_volume(delta) {
|
|
|
|
function increase_volume(delta) {
|
|
|
@ -234,25 +236,25 @@ function toggle_play() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const toggle_captions = (function() {
|
|
|
|
const toggle_captions = (function () {
|
|
|
|
let toggledTrack = null;
|
|
|
|
let toggledTrack = null;
|
|
|
|
const onChange = function(e) {
|
|
|
|
const onChange = function (e) {
|
|
|
|
toggledTrack = null;
|
|
|
|
toggledTrack = null;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const bindChange = function(onOrOff) {
|
|
|
|
const bindChange = function (onOrOff) {
|
|
|
|
player.textTracks()[onOrOff]('change', onChange);
|
|
|
|
player.textTracks()[onOrOff]('change', onChange);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// Wrapper function to ignore our own emitted events and only listen
|
|
|
|
// Wrapper function to ignore our own emitted events and only listen
|
|
|
|
// to events emitted by Video.js on click on the captions menu items.
|
|
|
|
// to events emitted by Video.js on click on the captions menu items.
|
|
|
|
const setMode = function(track, mode) {
|
|
|
|
const setMode = function (track, mode) {
|
|
|
|
bindChange('off');
|
|
|
|
bindChange('off');
|
|
|
|
track.mode = mode;
|
|
|
|
track.mode = mode;
|
|
|
|
window.setTimeout(function() {
|
|
|
|
window.setTimeout(function () {
|
|
|
|
bindChange('on');
|
|
|
|
bindChange('on');
|
|
|
|
}, 0);
|
|
|
|
}, 0);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
bindChange('on');
|
|
|
|
bindChange('on');
|
|
|
|
return function() {
|
|
|
|
return function () {
|
|
|
|
if (toggledTrack !== null) {
|
|
|
|
if (toggledTrack !== null) {
|
|
|
|
if (toggledTrack.mode !== 'showing') {
|
|
|
|
if (toggledTrack.mode !== 'showing') {
|
|
|
|
setMode(toggledTrack, 'showing');
|
|
|
|
setMode(toggledTrack, 'showing');
|
|
|
@ -422,7 +424,7 @@ window.addEventListener('keydown', e => {
|
|
|
|
|
|
|
|
|
|
|
|
// Add support for controlling the player volume by scrolling over it. Adapted from
|
|
|
|
// Add support for controlling the player volume by scrolling over it. Adapted from
|
|
|
|
// https://github.com/ctd1500/videojs-hotkeys/blob/bb4a158b2e214ccab87c2e7b95f42bc45c6bfd87/videojs.hotkeys.js#L292-L328
|
|
|
|
// https://github.com/ctd1500/videojs-hotkeys/blob/bb4a158b2e214ccab87c2e7b95f42bc45c6bfd87/videojs.hotkeys.js#L292-L328
|
|
|
|
(function() {
|
|
|
|
(function () {
|
|
|
|
const volumeStep = 0.05;
|
|
|
|
const volumeStep = 0.05;
|
|
|
|
const enableVolumeScroll = true;
|
|
|
|
const enableVolumeScroll = true;
|
|
|
|
const enableHoverScroll = true;
|
|
|
|
const enableHoverScroll = true;
|
|
|
@ -432,8 +434,8 @@ window.addEventListener('keydown', e => {
|
|
|
|
var volumeHover = false;
|
|
|
|
var volumeHover = false;
|
|
|
|
var volumeSelector = pEl.querySelector('.vjs-volume-menu-button') || pEl.querySelector('.vjs-volume-panel');
|
|
|
|
var volumeSelector = pEl.querySelector('.vjs-volume-menu-button') || pEl.querySelector('.vjs-volume-panel');
|
|
|
|
if (volumeSelector != null) {
|
|
|
|
if (volumeSelector != null) {
|
|
|
|
volumeSelector.onmouseover = function() { volumeHover = true; };
|
|
|
|
volumeSelector.onmouseover = function () { volumeHover = true; };
|
|
|
|
volumeSelector.onmouseout = function() { volumeHover = false; };
|
|
|
|
volumeSelector.onmouseout = function () { volumeHover = false; };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var mouseScroll = function mouseScroll(event) {
|
|
|
|
var mouseScroll = function mouseScroll(event) {
|
|
|
|