Issue #308 hide menu in fullscreen mode on Windows

This commit is contained in:
Akinwale Ariwodola 2017-07-02 09:00:22 +01:00
parent f6ad6e7ba7
commit 98e25bee45

View file

@ -1,3 +1,4 @@
const { remote } = require("electron");
import React from "react"; import React from "react";
import { Thumbnail } from "component/common"; import { Thumbnail } from "component/common";
import player from "render-media"; import player from "render-media";
@ -25,6 +26,15 @@ class VideoPlayer extends React.PureComponent {
const renderMediaCallback = err => { const renderMediaCallback = err => {
if (err) this.setState({ unplayable: true }); 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( player.append(
this.file(), this.file(),
@ -42,6 +52,10 @@ class VideoPlayer extends React.PureComponent {
once: true, once: true,
} }
); );
mediaElement.addEventListener(
"webkitfullscreenchange",
win32FullScreenChange.bind(this)
);
} }
} }