diff --git a/renderer/index.css b/renderer/index.css index 1bf15e8d..e9d7e185 100644 --- a/renderer/index.css +++ b/renderer/index.css @@ -317,30 +317,6 @@ input { box-shadow: 1px 1px 1px 0px rgba(0,0,0,0.1); } -/* - * PLAYER - */ - -.player { - position: absolute; - width: 100%; - height: 100%; - background-color: #000; -} - -.player .letterbox { - width: 100%; - height: 100%; - display: flex; - background-size: cover; - background-position: center center; -} - -.player video { - display: block; - width: 100%; -} - /* * TORRENT LIST */ @@ -562,6 +538,28 @@ body.drag .torrent-placeholder span { text-align: right; } +/* + * PLAYER + */ + +.player { + position: absolute; + width: 100%; + height: 100%; + background-color: #000; +} + +.player .letterbox { + width: 100%; + height: 100%; + display: flex; +} + +.player video { + display: block; + width: 100%; +} + /* * PLAYER CONTROLS */ @@ -712,6 +710,17 @@ body.drag .torrent-placeholder span { * MEDIA OVERLAY / AUDIO DETAILS */ +.media-overlay-background { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + display: flex; + background-size: cover; + background-position: center center; +} + .media-overlay { max-width: calc(100% - 80px); white-space: nowrap; diff --git a/renderer/index.js b/renderer/index.js index 69fd9298..9b56ebde 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -258,6 +258,7 @@ function dispatch (action, ...args) { playPause() } if (action === 'play') { + if (state.location.pending()) return state.location.go({ url: 'player', onbeforeload: function (cb) { diff --git a/renderer/lib/location-history.js b/renderer/lib/location-history.js index 09122948..91f555f7 100644 --- a/renderer/lib/location-history.js +++ b/renderer/lib/location-history.js @@ -4,6 +4,7 @@ function LocationHistory () { if (!new.target) return new LocationHistory() this._history = [] this._forward = [] + this._pending = null } LocationHistory.prototype.go = function (page) { @@ -13,9 +14,12 @@ LocationHistory.prototype.go = function (page) { } LocationHistory.prototype._go = function (page) { + if (this._pending) return if (page.onbeforeload) { + this._pending = page page.onbeforeload((err) => { if (err) return + this._pending = null this._history.push(page) }) } else { @@ -59,3 +63,7 @@ LocationHistory.prototype.hasBack = function () { LocationHistory.prototype.hasForward = function () { return this._forward.length > 0 } + +LocationHistory.prototype.pending = function () { + return this._pending +} diff --git a/renderer/views/player.js b/renderer/views/player.js index 3aee668e..ab156412 100644 --- a/renderer/views/player.js +++ b/renderer/views/player.js @@ -70,16 +70,9 @@ function renderMedia (state) { mediaTag.tagName = mediaType // Show the media. - // Video fills the window, centered with black bars if necessary - // Audio gets a static poster image and a summary of the file metadata. - var isAudio = mediaType === 'audio' - var style = { - backgroundImage: isAudio ? cssBackgroundImagePoster(state) : '' - } return hx`