Video player polish

No header on Linux and OSX, just a back button on mouseover

ESC exits fullscreen, or if already not in fullscreen, goes back

More accurate scrub position

Removed the calc(100% -38x) hack, replaced with flexbox
This commit is contained in:
DC
2016-03-05 06:12:02 -08:00
parent 59b3bd04a9
commit e4f2716d06
4 changed files with 49 additions and 5 deletions

View File

@@ -17,7 +17,12 @@ function App (state, dispatch) {
}
}
var header = state.view.isFullScreen ? null : Header(state, dispatch)
// Show the header only when we're outside of fullscreen
// Also don't show it in the video player except in OSX
var isOSX = process.platform === 'darwin'
var isVideo = state.view.url === '/player'
var isFullScreen = state.view.isFullScreen
var header = !isFullScreen && (!isVideo || isOSX) ? Header(state, dispatch) : null
return hx`
<div class="app">

View File

@@ -54,7 +54,7 @@ function Player (state, dispatch) {
// TODO: cast buttons
function renderPlayerControls (state, dispatch) {
var positionPercent = 100 * state.video.currentTime / state.video.duration
var playbackCursorStyle = { left: 'calc(' + positionPercent + '% - 6px)' }
var playbackCursorStyle = { left: 'calc(' + positionPercent + '% - 8px)' }
var torrent = state.view.torrentPlaying._torrent
var elements = [
@@ -75,6 +75,7 @@ function renderPlayerControls (state, dispatch) {
</i>
`
]
// If we've detected a Chromecast or AppleTV, the user can play video there
if (state.view.devices.chromecast) {
elements.push(hx`
<i.icon.chromecast
@@ -93,6 +94,16 @@ function renderPlayerControls (state, dispatch) {
</i>
`)
}
// On OSX, the back button is in the title bar of the window; see app.js
// On other platforms, we render one over the video on mouseover
if(process.platform !== 'darwin') {
elements.push(hx`
<i.icon.back
onclick=${() => dispatch('back')}>
chevron_left
</i>
`)
}
elements.push(hx`
<i class="icon play-pause" onclick=${() => dispatch('playPause')}>
${state.video.isPaused ? 'play_arrow' : 'pause'}