Skip to content

Commit

Permalink
fix: use player fullscreenchange event so fullscreen toggle works o…
Browse files Browse the repository at this point in the history
…n Safari (#2)
  • Loading branch information
brandonocasey committed Jul 27, 2017
1 parent 280a339 commit 05c0f23
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ const vr = function(options) {
videoEl.style.display = 'none';

// Handle window resizes
function onWindowResize() {
function onWindowResize(event) {
const width = player.currentWidth();
const height = player.currentHeight();

Expand All @@ -364,8 +364,9 @@ const vr = function(options) {
camera.updateProjectionMatrix();
}

window.addEventListener('resize', onWindowResize, false);
player.on('fullscreenchange', onWindowResize);
window.addEventListener('vrdisplaypresentchange', onWindowResize, true);
window.addEventListener('resize', onWindowResize, true);

function onVRRequestPresent() {
manager.enterVRMode_();
Expand Down

0 comments on commit 05c0f23

Please sign in to comment.