mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 10:58:20 -07:00
fixed github #208 - Web client - Playback check-ins are still sent if video fails to play
fixed github #209 - Web client - playback check-ins not sent for audio
This commit is contained in:
parent
461ed8c2b2
commit
cfbb089031
@ -57,17 +57,28 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(".itemAudio").on("ended", function () {
|
$(".itemAudio").on("ended", function () {
|
||||||
|
MediaPlayer.stopAudio(item.Id);
|
||||||
|
|
||||||
Playlist.playNext();
|
Playlist.playNext();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".itemAudio").on("volumechange", function () {
|
$(".itemAudio").on("volumechange", function () {
|
||||||
|
|
||||||
localStorage.setItem("volume", this.volume);
|
localStorage.setItem("volume", this.volume);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".itemAudio").on("play", updateAudioProgress(item.Id));
|
||||||
|
|
||||||
return $('audio', nowPlayingBar)[0];
|
return $('audio', nowPlayingBar)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateAudioProgress(itemId) {
|
||||||
|
ApiClient.reportPlaybackStart(Dashboard.getCurrentUserId(), itemId);
|
||||||
|
|
||||||
|
currentProgressInterval = setInterval(function () {
|
||||||
|
ApiClient.reportPlaybackProgress(Dashboard.getCurrentUserId(), itemId, $(".itemAudio").currentTime);
|
||||||
|
}, 30000);
|
||||||
|
}
|
||||||
|
|
||||||
function playVideo(items, startPosition) {
|
function playVideo(items, startPosition) {
|
||||||
//stop/kill videoJS
|
//stop/kill videoJS
|
||||||
if (currentMediaElement) self.stop();
|
if (currentMediaElement) self.stop();
|
||||||
@ -193,7 +204,7 @@
|
|||||||
localStorage.setItem("volume", this.volume());
|
localStorage.setItem("volume", this.volume());
|
||||||
});
|
});
|
||||||
|
|
||||||
(this).addEvent("play", updateProgress);
|
(this).addEvent("play", updateProgress(item.Id));
|
||||||
|
|
||||||
(this).addEvent("ended", function () {
|
(this).addEvent("ended", function () {
|
||||||
MediaPlayer.stopVideo();
|
MediaPlayer.stopVideo();
|
||||||
@ -201,13 +212,14 @@
|
|||||||
Playlist.playNext();
|
Playlist.playNext();
|
||||||
});
|
});
|
||||||
|
|
||||||
ApiClient.reportPlaybackStart(Dashboard.getCurrentUserId(), item.Id);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $('video', nowPlayingBar)[0];
|
return $('video', nowPlayingBar)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateProgress() {
|
function updateProgress(itemId) {
|
||||||
|
ApiClient.reportPlaybackStart(Dashboard.getCurrentUserId(), itemId);
|
||||||
|
|
||||||
currentProgressInterval = setInterval(function () {
|
currentProgressInterval = setInterval(function () {
|
||||||
var player = _V_("videoWindow");
|
var player = _V_("videoWindow");
|
||||||
|
|
||||||
@ -361,6 +373,8 @@
|
|||||||
//player.tech.destroy();
|
//player.tech.destroy();
|
||||||
player.destroy();
|
player.destroy();
|
||||||
} else {
|
} else {
|
||||||
|
self.stopAudio();
|
||||||
|
|
||||||
elem.pause();
|
elem.pause();
|
||||||
elem.src = "";
|
elem.src = "";
|
||||||
}
|
}
|
||||||
@ -390,6 +404,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.stopAudio = function () {
|
||||||
|
var itemString = $(".itemAudio source").attr('src').match(new RegExp("Audio/[0-9a-z\-]+", "g"));
|
||||||
|
var itemId = itemString[0].replace("Audio/", "");
|
||||||
|
|
||||||
|
ApiClient.reportPlaybackStopped(Dashboard.getCurrentUserId(), itemId, $(".itemAudio").currentTime);
|
||||||
|
|
||||||
|
if (currentProgressInterval) {
|
||||||
|
clearTimeout(currentProgressInterval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.isPlaying = function () {
|
self.isPlaying = function () {
|
||||||
return currentMediaElement;
|
return currentMediaElement;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user