1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

playlist fixes

This commit is contained in:
Luke Pulverenti 2013-06-07 13:23:23 -04:00
parent 6446cf2020
commit 356217a9b6
3 changed files with 27 additions and 21 deletions

View file

@ -6,10 +6,10 @@
<body> <body>
<div id="playlistPage" data-role="page" class="page libraryPage" data-theme="a"> <div id="playlistPage" data-role="page" class="page libraryPage" data-theme="a">
<div class="ui-bar-c parentName">Now Playing</div>
<div data-role="content"> <div data-role="content">
<div id="playlist" class="detailTableContainer"> <div id="playlist" class="detailTableContainer">
</div> </div>
</div> </div>
</div> </div>

View file

@ -19,7 +19,6 @@
var curentDurationTicks; var curentDurationTicks;
var isStaticStream; var isStaticStream;
var culturesPromise; var culturesPromise;
var isStopping;
self.playlist = []; self.playlist = [];
var currentPlaylistIndex = 0; var currentPlaylistIndex = 0;
@ -77,8 +76,8 @@
function onPlaybackStopped() { function onPlaybackStopped() {
isStopping = true; $(this).off('ended.playbackstopped');
currentTimeElement.empty(); currentTimeElement.empty();
var endTime = this.currentTime; var endTime = this.currentTime;
@ -90,9 +89,12 @@
var position = Math.floor(10000000 * endTime) + startTimeTicksOffset; var position = Math.floor(10000000 * endTime) + startTimeTicksOffset;
ApiClient.reportPlaybackStopped(Dashboard.getCurrentUserId(), currentItem.Id, position); ApiClient.reportPlaybackStopped(Dashboard.getCurrentUserId(), currentItem.Id, position);
}
function playNextAfterEnded() {
$(this).off('ended.playnext');
isStopping = false;
self.queuePlayNext(); self.queuePlayNext();
} }
@ -155,9 +157,10 @@
clearProgressInterval(); clearProgressInterval();
$(element).off('ended.playbackstopped').on("play.onceafterseek", function () { $(element).off('ended.playbackstopped').off('ended.playnext').on("play.onceafterseek", function () {
$(this).off('play.onceafterseek').on('ended.playbackstopped', onPlaybackStopped); $(this).off('play.onceafterseek').on('ended.playbackstopped', onPlaybackStopped).on('ended.playnext', playNextAfterEnded);
startProgressInterval(currentItem.Id); startProgressInterval(currentItem.Id);
sendProgressUpdate(currentItem.Id); sendProgressUpdate(currentItem.Id);
@ -443,7 +446,7 @@
setCurrentTime(getCurrentTicks(this), item, true); setCurrentTime(getCurrentTicks(this), item, true);
} }
}).on("ended.playbackstopped", onPlaybackStopped); }).on("ended.playbackstopped", onPlaybackStopped).on('ended.playnext', playNextAfterEnded);
currentItem = item; currentItem = item;
curentDurationTicks = item.RunTimeTicks; curentDurationTicks = item.RunTimeTicks;
@ -623,7 +626,7 @@
setCurrentTime(getCurrentTicks(this), item, true); setCurrentTime(getCurrentTicks(this), item, true);
} }
}).on("ended.playbackstopped", onPlaybackStopped); }).on("ended.playbackstopped", onPlaybackStopped).on('ended.playnext', playNextAfterEnded);
currentItem = item; currentItem = item;
curentDurationTicks = item.RunTimeTicks; curentDurationTicks = item.RunTimeTicks;
@ -810,7 +813,7 @@
self.playInternal = function (item, startPosition, user) { self.playInternal = function (item, startPosition, user) {
if (self.isPlaying() && !isStopping) { if (self.isPlaying()) {
self.stop(); self.stop();
} }
@ -937,13 +940,13 @@
}; };
self.removeFromPlaylist = function (index) { self.removeFromPlaylist = function (index) {
self.playlist.remove(index); self.playlist.remove(index);
}; };
// Gets or sets the current playlist index // Gets or sets the current playlist index
self.currentPlaylistIndex = function(i) { self.currentPlaylistIndex = function (i) {
if (i == null) { if (i == null) {
return currentPlaylistIndex; return currentPlaylistIndex;
@ -954,7 +957,7 @@
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().done(function (user) {
self.playInternal(newItem, 0, user); self.playInternal(newItem, 0, user);
self.currentPlaylistIndex = i; currentPlaylistIndex = i;
}); });
}; };
@ -966,7 +969,7 @@
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().done(function (user) {
self.playInternal(newItem, 0, user); self.playInternal(newItem, 0, user);
self.currentPlaylistIndex = newIndex; currentPlaylistIndex = newIndex;
}); });
}; };
@ -1027,14 +1030,16 @@
elem.pause(); elem.pause();
var jelem = $(elem).trigger('ended'); $(elem).off('ended.playnext').on('ended', function () {
elem.src = "";
jelem.remove(); $(this).remove();
elem.src = "";
currentMediaElement = null;
}).trigger('ended');
$('#nowPlayingBar').hide(); $('#nowPlayingBar').hide();
currentMediaElement = null;
}; };
self.isPlaying = function () { self.isPlaying = function () {

View file

@ -44,6 +44,7 @@
var index = parseInt(this.getAttribute('data-index')); var index = parseInt(this.getAttribute('data-index'));
MediaPlayer.currentPlaylistIndex(index); MediaPlayer.currentPlaylistIndex(index);
reloadPlaylist(page);
}).on('click', '.lnkRemove', function () { }).on('click', '.lnkRemove', function () {