Added functionality to show captions on "CC" button mousemove.
When auto-show/auto-hide is disabled, the captions will be shown when the user will move the mouse over the "CC" button. They will then auto-hide after a while if the user doesn't continue to move the mouse over the "CC" button, or over the captions themselves, or use the keyboard to select a specific caption. If the mouse pointer is not over the captions or the "CC" button, they will hide after a while. This is the key in the fix for bug BLD-355: Transcript hovers over over videoplayer itself for PKU videos.
This commit is contained in:
@@ -312,8 +312,6 @@ function (VideoPlayer) {
|
||||
availableQualities: ['hd720', 'hd1080', 'highres']
|
||||
};
|
||||
|
||||
console.log('this.config.autohideHtml5 = ' + this.config.autohideHtml5);
|
||||
|
||||
// Check if the YT test timeout has been set. If not, or it is in
|
||||
// improper format, then set to default value.
|
||||
tempYtTestTimeout = parseInt(this.el.data('yt-test-timeout'), 10);
|
||||
|
||||
@@ -157,13 +157,25 @@ function () {
|
||||
this.el.on('keydown', this.videoCaption.autoShowCaptions);
|
||||
|
||||
// Moving slider on subtitles is not a mouse move,
|
||||
// but captions and controls should be showed.
|
||||
// but captions and controls should be shown.
|
||||
this.videoCaption.subtitlesEl.on(
|
||||
'scroll', this.videoCaption.autoShowCaptions
|
||||
);
|
||||
this.videoCaption.subtitlesEl.on(
|
||||
'scroll', this.videoControl.showControls
|
||||
);
|
||||
} else if (!this.config.autohideHtml5) {
|
||||
// this.videoCaption.subtitlesEl.on('mousemove', this.videoCaption.autoShowCaptions);
|
||||
this.videoCaption.subtitlesEl.on('keydown', this.videoCaption.autoShowCaptions);
|
||||
|
||||
this.videoCaption.hideSubtitlesEl.on('mousemove', this.videoCaption.autoShowCaptions);
|
||||
this.videoCaption.hideSubtitlesEl.on('keydown', this.videoCaption.autoShowCaptions);
|
||||
|
||||
// Moving slider on subtitles is not a mouse move,
|
||||
// but captions should not be auto-hidden.
|
||||
this.videoCaption.subtitlesEl.on(
|
||||
'scroll', this.videoCaption.autoShowCaptions
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,6 +334,10 @@ function () {
|
||||
}
|
||||
|
||||
function onMovement() {
|
||||
if (!this.config.autohideHtml5) {
|
||||
this.videoCaption.autoShowCaptions();
|
||||
}
|
||||
|
||||
this.videoCaption.onMouseEnter();
|
||||
}
|
||||
|
||||
@@ -343,6 +359,14 @@ function () {
|
||||
this.videoCaption.autoHideCaptions,
|
||||
this.videoCaption.fadeOutTimeout
|
||||
);
|
||||
} else if (!this.config.autohideHtml5) {
|
||||
this.videoCaption.fadeOutTimeout = this.config.fadeOutTimeout;
|
||||
this.videoCaption.subtitlesEl.addClass('html5');
|
||||
|
||||
this.captionHideTimeout = setTimeout(
|
||||
this.videoCaption.autoHideCaptions,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
this.videoCaption.hideCaptions(this.hide_captions);
|
||||
@@ -656,6 +680,21 @@ function () {
|
||||
this.videoCaption.hideCaptions(false);
|
||||
} else {
|
||||
this.videoCaption.hideCaptions(true);
|
||||
|
||||
// In the case when captions are not auto-hidden based on mouse
|
||||
// movement anywhere on the video, we must hide them explicitly
|
||||
// after the "CC" button has been clicked (to hide captions).
|
||||
//
|
||||
// Otherwise, in order for the captions to disappear again, the
|
||||
// user must move the mouse button over the "CC" button, or over
|
||||
// the captions themselves. In this case, an "autoShow" will be
|
||||
// triggered, and after a timeout, an "autoHide".
|
||||
if (!this.config.autohideHtml5) {
|
||||
this.captionHideTimeout = setTimeout(
|
||||
this.videoCaption.autoHideCaptions(),
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -722,7 +761,10 @@ function () {
|
||||
|
||||
function setSubtitlesHeight() {
|
||||
var height = 0;
|
||||
if ((this.videoType === 'html5') && (this.config.autohideHtml5)) {
|
||||
if (
|
||||
((this.videoType === 'html5') && (this.config.autohideHtml5)) ||
|
||||
(!this.config.autohideHtml5)
|
||||
){
|
||||
// on page load captionHidden = undefined
|
||||
if (
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user