Skip to content

Commit

Permalink
Nanootv: Use pressToPlay to hide squash overlay for login
Browse files Browse the repository at this point in the history
In case of a login redirect the squash overlay prevents the user to
insert the credentials. It is also not possible to click the overlay
away, since it is only possible to do so, when setting the player state
to PLAYING. Thus the workaround with temporarily setting pressToPlay to
true works for this scenario. In order for the controls to be rendered
the pressToPlay state has to be set to false afterwards.
  • Loading branch information
tobiasreischmann committed Jan 29, 2021
1 parent 0943928 commit 967bde6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/nanoo-tv.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ H5P.VideoNanooTv = (function ($) {
text: l10n.loading
}).appendTo($wrapper);

// Initialize pressToPlay in order to hide squash overlay in case of a login redirect.
self.pressToPlay = true;

/**
* Create a new nanoo.tv player
*
Expand All @@ -48,7 +51,7 @@ H5P.VideoNanooTv = (function ($) {
src: videoPath,
width: width,
height: width * (9/16),
allow: "accelerometer; autoplay; fullscreen",
allow: "accelerometer; fullscreen",
});
$placeholder.replaceWith(player);

Expand All @@ -61,10 +64,14 @@ H5P.VideoNanooTv = (function ($) {
duration = data.data.value;
// The current event listener is no longer needed.
window.removeEventListener("message", listenLoaded, false);
// Reset pressToPlay to false in order to show overlays again, after player has loaded.
self.pressToPlay = false;
// Initialize relevant variables, event listeners and a heartbeat for querying the currentTime.
self.loaded(id);
self.trigger('loaded');
self.trigger('ready');
// Trigger stateChange will case the Interactive video overlay to be shown.
self.trigger('stateChange');
} else {
// Retry to query the duration after a short break.
setTimeout(document.getElementById(id).contentWindow.postMessage({
Expand Down

0 comments on commit 967bde6

Please sign in to comment.