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
41 changes: 41 additions & 0 deletions libraries/mediaelement-fullscreen-hook.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
define([
'core/js/adapt',
'libraries/mediaelement-and-player'
], function(Adapt) {

// 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

var mepPrototype = $.extend({}, mejs.MediaElementPlayer.prototype);
$.extend(mejs.MediaElementPlayer.prototype, {

exitFullScreen: function() {

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

var returnValue = mepPrototype.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 mepPrototype.enterFullScreen.apply(this, arguments);

}

});

});