Commit 74cbe119 by Valera Rozuvan

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.
parent 812b085b
...@@ -312,8 +312,6 @@ function (VideoPlayer) { ...@@ -312,8 +312,6 @@ function (VideoPlayer) {
availableQualities: ['hd720', 'hd1080', 'highres'] 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 // Check if the YT test timeout has been set. If not, or it is in
// improper format, then set to default value. // improper format, then set to default value.
tempYtTestTimeout = parseInt(this.el.data('yt-test-timeout'), 10); tempYtTestTimeout = parseInt(this.el.data('yt-test-timeout'), 10);
......
...@@ -157,13 +157,25 @@ function () { ...@@ -157,13 +157,25 @@ function () {
this.el.on('keydown', this.videoCaption.autoShowCaptions); this.el.on('keydown', this.videoCaption.autoShowCaptions);
// Moving slider on subtitles is not a mouse move, // 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( this.videoCaption.subtitlesEl.on(
'scroll', this.videoCaption.autoShowCaptions 'scroll', this.videoCaption.autoShowCaptions
); );
this.videoCaption.subtitlesEl.on( this.videoCaption.subtitlesEl.on(
'scroll', this.videoControl.showControls '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 () { ...@@ -322,6 +334,10 @@ function () {
} }
function onMovement() { function onMovement() {
if (!this.config.autohideHtml5) {
this.videoCaption.autoShowCaptions();
}
this.videoCaption.onMouseEnter(); this.videoCaption.onMouseEnter();
} }
...@@ -343,6 +359,14 @@ function () { ...@@ -343,6 +359,14 @@ function () {
this.videoCaption.autoHideCaptions, this.videoCaption.autoHideCaptions,
this.videoCaption.fadeOutTimeout 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); this.videoCaption.hideCaptions(this.hide_captions);
...@@ -656,6 +680,21 @@ function () { ...@@ -656,6 +680,21 @@ function () {
this.videoCaption.hideCaptions(false); this.videoCaption.hideCaptions(false);
} else { } else {
this.videoCaption.hideCaptions(true); 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 () { ...@@ -722,7 +761,10 @@ function () {
function setSubtitlesHeight() { function setSubtitlesHeight() {
var height = 0; 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 // on page load captionHidden = undefined
if ( if (
( (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment