mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
better handling of playback stop
This commit is contained in:
parent
5833a82e4b
commit
a1b70df3cc
1 changed files with 29 additions and 7 deletions
|
@ -569,7 +569,7 @@
|
||||||
|
|
||||||
// viblast can help us here
|
// viblast can help us here
|
||||||
//return true;
|
//return true;
|
||||||
return window.MediaSource != null && !browserInfo.firefox;
|
return window.MediaSource != null;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.changeStream = function (ticks, params) {
|
self.changeStream = function (ticks, params) {
|
||||||
|
@ -1518,6 +1518,11 @@
|
||||||
|
|
||||||
Events.off(mediaRenderer, 'ended', self.playNextAfterEnded);
|
Events.off(mediaRenderer, 'ended', self.playNextAfterEnded);
|
||||||
|
|
||||||
|
var stopTranscoding = false;
|
||||||
|
if (!currentProgressInterval) {
|
||||||
|
stopTranscoding = true;
|
||||||
|
}
|
||||||
|
|
||||||
mediaRenderer.stop();
|
mediaRenderer.stop();
|
||||||
|
|
||||||
Events.trigger(mediaRenderer, "ended");
|
Events.trigger(mediaRenderer, "ended");
|
||||||
|
@ -1530,10 +1535,17 @@
|
||||||
|
|
||||||
self.currentMediaRenderer = null;
|
self.currentMediaRenderer = null;
|
||||||
self.currentItem = null;
|
self.currentItem = null;
|
||||||
self.currentMediaSource = null;
|
|
||||||
self.currentSubtitleStreamIndex = null;
|
self.currentSubtitleStreamIndex = null;
|
||||||
self.streamInfo = {};
|
self.streamInfo = {};
|
||||||
|
|
||||||
|
self.currentMediaSource = null;
|
||||||
|
|
||||||
|
if (stopTranscoding) {
|
||||||
|
ApiClient.stopActiveEncodings();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
self.currentMediaRenderer = null;
|
self.currentMediaRenderer = null;
|
||||||
self.currentItem = null;
|
self.currentItem = null;
|
||||||
|
@ -1767,14 +1779,24 @@
|
||||||
Events.trigger(self, 'playstatechange', [state]);
|
Events.trigger(self, 'playstatechange', [state]);
|
||||||
};
|
};
|
||||||
|
|
||||||
window.addEventListener("beforeunload", function () {
|
function onAppClose() {
|
||||||
|
|
||||||
// Try to report playback stopped before the browser closes
|
// Try to report playback stopped before the browser closes
|
||||||
if (self.currentItem && self.currentMediaRenderer && currentProgressInterval) {
|
if (self.currentItem && self.currentMediaRenderer) {
|
||||||
|
|
||||||
|
if (currentProgressInterval) {
|
||||||
|
|
||||||
self.onPlaybackStopped.call(self.currentMediaRenderer);
|
self.onPlaybackStopped.call(self.currentMediaRenderer);
|
||||||
|
} else {
|
||||||
|
ApiClient.stopActiveEncodings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("beforeunload", onAppClose);
|
||||||
|
|
||||||
|
if (browserInfo.safari) {
|
||||||
|
document.addEventListener("pause", onAppClose);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
function sendProgressUpdate() {
|
function sendProgressUpdate() {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue