diff --git a/main/ipc.js b/main/ipc.js index 3ac1fe71..08e3259e 100644 --- a/main/ipc.js +++ b/main/ipc.js @@ -27,6 +27,10 @@ function init () { ipcMain.on('setProgress', function (e, progress) { setProgress(progress) }) + + ipcMain.on('toggleFullScreen', function (e) { + windows.main.setFullScreen(!windows.main.isFullScreen()) + }) } function addTorrentFromPaste () { diff --git a/main/menu.js b/main/menu.js index ad05ab85..556f7bf8 100644 --- a/main/menu.js +++ b/main/menu.js @@ -8,7 +8,6 @@ function toggleFullScreen () { debug('toggleFullScreen') if (windows.main) { windows.main.setFullScreen(!windows.main.isFullScreen()) - onToggleFullScreen() } } diff --git a/renderer/index.css b/renderer/index.css index 524d4fca..dc16fb21 100644 --- a/renderer/index.css +++ b/renderer/index.css @@ -325,6 +325,16 @@ body.drag::before { margin: 5px auto; } +.player-controls .chromecast, +.player-controls .airplay, +.player-controls .fullscreen { + display: block; + width: 20px; + height: 20px; + margin: 5px; + float: right; +} + .player .scrub-bar:hover .loading-bar { height: 5px; margin-top: 6px; diff --git a/renderer/index.js b/renderer/index.js index 64b65b6b..c88bf163 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -163,6 +163,9 @@ function dispatch (action, ...args) { state.video.jumpToTime = args[0] /* seconds */ update() } + if (action === 'toggleFullScreen') { + electron.ipcRenderer.send('toggleFullScreen') + } } electron.ipcRenderer.on('addTorrent', function (e, torrentId) { diff --git a/renderer/views/player.js b/renderer/views/player.js index d8bdb88a..cb3b2431 100644 --- a/renderer/views/player.js +++ b/renderer/views/player.js @@ -53,9 +53,10 @@ function Player (state, dispatch) { function renderPlayerControls (state, dispatch) { var positionPercent = 100 * state.video.currentTime / state.video.duration var playbackCursorStyle = { left: 'calc(' + positionPercent + '% - 4px)' } + var torrent = state.view.torrentPlaying._torrent - return hx` -
+ var elements = [ + hx`
- dispatch('playPause')}> - ${state.video.isPaused ? 'play_arrow' : 'pause'} + ` + ] + if (state.view.devices.chromecast) { + elements.push(hx` + dispatch('openChromecast', torrent)}> + cast - - ` + `) + } + if (state.view.devices.airplay) { + elements.push(hx` + dispatch('openAirplay', torrent)}> + airplay + + `) + } + elements.push(hx` + dispatch('toggleFullScreen')}> + fullscreen + + `) + elements.push(hx` + dispatch('playPause')}> + ${state.video.isPaused ? 'play_arrow' : 'pause'} + + `) + + return hx`
${elements}
` // Handles a click or drag to scrub (jump to another position in the video) function handleScrub (e) { diff --git a/renderer/views/torrent-list.js b/renderer/views/torrent-list.js index e510d96c..ede1b111 100644 --- a/renderer/views/torrent-list.js +++ b/renderer/views/torrent-list.js @@ -44,26 +44,6 @@ function renderTorrent (state, dispatch, torrent) { ` ] - if (state.view.chromecast) { - elements.push(hx` - dispatch('openChromecast', torrent)}> - cast - - `) - } - - if (state.view.devices.airplay) { - elements.push(hx` - dispatch('openAirplay', torrent)}> - airplay - - `) - } - return hx`
${elements}
` }