1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
This commit is contained in:
Luke Pulverenti 2013-04-28 13:39:31 -04:00
commit 9d42877d91

View file

@ -57,17 +57,28 @@
});
$(".itemAudio").on("ended", function () {
MediaPlayer.stopAudio(item.Id);
Playlist.playNext();
});
$(".itemAudio").on("volumechange", function () {
localStorage.setItem("volume", this.volume);
});
$(".itemAudio").on("play", updateAudioProgress(item.Id));
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) {
//stop/kill videoJS
if (currentMediaElement) self.stop();
@ -193,7 +204,7 @@
localStorage.setItem("volume", this.volume());
});
(this).addEvent("play", updateProgress);
(this).addEvent("play", updateProgress(item.Id));
(this).addEvent("ended", function () {
MediaPlayer.stopVideo();
@ -201,13 +212,14 @@
Playlist.playNext();
});
ApiClient.reportPlaybackStart(Dashboard.getCurrentUserId(), item.Id);
});
return $('video', nowPlayingBar)[0];
}
function updateProgress() {
function updateProgress(itemId) {
ApiClient.reportPlaybackStart(Dashboard.getCurrentUserId(), itemId);
currentProgressInterval = setInterval(function () {
var player = _V_("videoWindow");
@ -361,6 +373,8 @@
//player.tech.destroy();
player.destroy();
} else {
self.stopAudio();
elem.pause();
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 () {
return currentMediaElement;
};