Commit eb583434 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

Keep player around when emptied but the website tells us it's actually just paused

Requires "Enhanced media controls" to be enabled in extension settings to work

BUG: 402324

Differential Revision: https://phabricator.kde.org/D20724
parent 44f251b4
......@@ -156,6 +156,9 @@ var pendingActivePlayer;
var playerMetadata = {};
var playerCallbacks = [];
// Playback state communicated via media sessions api
var playerPlaybackState = "";
var players = [];
var pendingSeekingUpdate = 0;
......@@ -365,6 +368,12 @@ function registerPlayer(player) {
// playlist is now empty or being reloaded, stop player
// e.g. when using Ajax page navigation and the user nagivated away
player.addEventListener("emptied", function () {
// When the player is emptied but the website tells us it's just "paused"
// keep it around (Bug 402324: Soundcloud does this)
if (player === activePlayer && playerPlaybackState === "paused") {
return;
}
// could have its own signal but for compat it's easier just to pretend to have stopped
sendPlayerInfo(player, "stopped");
});
......@@ -698,6 +707,7 @@ function loadMediaSessionsShim() {
} else if (action === "playbackState") {
var playbackState = json.payload;
playerPlaybackState = playbackState;
if (activePlayer) {
if (playbackState === "playing") {
playerPlaying(activePlayer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment