Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue-1470: fullscreen hook + inview control #163

Merged
merged 8 commits into from
Jun 29, 2017
3 changes: 2 additions & 1 deletion js/adapt-contrib-media.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ define([
'core/js/adapt',
'core/js/views/componentView',
'libraries/mediaelement-and-player',
'libraries/mediaelement-and-player-accessible-captions'
'libraries/mediaelement-and-player-accessible-captions',
'libraries/mediaelement-fullscreen-hook'
], function(Adapt, ComponentView) {

var froogaloopAdded = false;
Expand Down
36 changes: 36 additions & 0 deletions libraries/mediaelement-fullscreen-hook.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
define([
'core/js/adapt',
'libraries/mediaelement-and-player'
], function(Adapt) {

var rawPrototype = $.extend({}, mejs.MediaElementPlayer.prototype);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this file could use a quick summary of what it's doing somewhere e.g. 'fixes a bug (adaptlearning/adapt_framework#1478) where the media player going into/coming out of full-screen mode would trigger inview on components below it; we therefore need to switch off inview when entering full screen mode and switch it back on again shortly after exiting it'

$.extend(mejs.MediaElementPlayer.prototype, {

exitFullScreen: function() {

Adapt.trigger("media:fullscreen:exit", this);

var returnValue = rawPrototype.exitFullScreen.apply(this, arguments);

// Wait for browser to settle coming down from full screen.
_.delay(function() {
$.inview.unlock("mediaelement");
}, 500);

return returnValue;

},

enterFullScreen: function() {

Adapt.trigger("media:fullscreen:enter", this);

$.inview.lock("mediaelement");

return rawPrototype.enterFullScreen.apply(this, arguments);

}

});

});