Merge pull request #319 from akinwale/issue308

Issue #308 hide menu in fullscreen mode on Windows
This commit is contained in:
Jeremy Kauffman 2017-07-02 11:18:45 -04:00 committed by GitHub
commit d8e867aa5a

View file

@ -1,3 +1,4 @@
const { remote } = require("electron");
import React from "react";
import { Thumbnail } from "component/common";
import player from "render-media";
@ -25,6 +26,15 @@ class VideoPlayer extends React.PureComponent {
const renderMediaCallback = err => {
if (err) this.setState({ unplayable: true });
};
// Handle fullscreen change for the Windows platform
const win32FullScreenChange = e => {
const win = remote.BrowserWindow.getFocusedWindow();
if ("win32" === process.platform) {
win.setMenu(
document.webkitIsFullScreen ? null : remote.Menu.getApplicationMenu()
);
}
};
player.append(
this.file(),
@ -42,6 +52,10 @@ class VideoPlayer extends React.PureComponent {
once: true,
}
);
mediaElement.addEventListener(
"webkitfullscreenchange",
win32FullScreenChange.bind(this)
);
}
}