Skip to content

Commit

Permalink
Merge pull request mediaelement#708 from rickharris/master
Browse files Browse the repository at this point in the history
Align timing of captions with show/hide controls.
  • Loading branch information
johndyer committed Jan 23, 2013
2 parents d8141cf + ec326b8 commit ff4d0d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/js/mep-feature-tracks.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@
if (!player.options.alwaysShowControls) {
// move with controls
player.container
.bind('mouseenter', function () {
.bind('controlsshown', function () {
// push captions above controls
player.container.find('.mejs-captions-position').addClass('mejs-captions-position-hover');

})
.bind('mouseleave', function () {
.bind('controlshidden', function () {
if (!media.paused) {
// move back to normal place
player.container.find('.mejs-captions-position').removeClass('mejs-captions-position-hover');
Expand Down
11 changes: 10 additions & 1 deletion src/js/mep-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@

// create MediaElement shim
mejs.MediaElement(t.$media[0], meOptions);

// controls are shown when loaded
t.container.trigger('controlsshown');
},

showControls: function(doAnimation) {
Expand All @@ -351,7 +354,10 @@
if (doAnimation) {
t.controls
.css('visibility','visible')
.stop(true, true).fadeIn(200, function() {t.controlsAreVisible = true;});
.stop(true, true).fadeIn(200, function() {
t.controlsAreVisible = true;
t.container.trigger('controlsshown');
});

// any additional controls people might add and want to hide
t.container.find('.mejs-control')
Expand All @@ -369,6 +375,7 @@
.css('display','block');

t.controlsAreVisible = true;
t.container.trigger('controlsshown');
}

t.setControlsSize();
Expand All @@ -391,6 +398,7 @@
.css('display','block');

t.controlsAreVisible = false;
t.container.trigger('controlshidden');
});

// any additional controls people might add and want to hide
Expand All @@ -412,6 +420,7 @@
.css('display','block');

t.controlsAreVisible = false;
t.container.trigger('controlshidden');
}
},

Expand Down

0 comments on commit ff4d0d3

Please sign in to comment.