mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update audio playback
This commit is contained in:
parent
c9e2f5a871
commit
b4112621f5
49 changed files with 66 additions and 103 deletions
File diff suppressed because one or more lines are too long
1
dashboard-ui/bower_components/emby-webcomponents/playback/playqueuemanager.js
vendored
Normal file
1
dashboard-ui/bower_components/emby-webcomponents/playback/playqueuemanager.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
define([],function(){"use strict";function addUniquePlaylistItemId(item){item.PlaylistItemId||(item.PlaylistItemId="playlistItem"+currentId,currentId++)}function findPlaylistIndex(playlistItemId,list){for(var i=0,length=list.length;i<length;i++)if(list[i].PlaylistItemId===playlistItemId)return i;return-1}function PlayQueueManager(){this._playlist=[]}function moveInArray(array,from,to){array.splice(to,0,array.splice(from,1)[0])}var currentId=0;return PlayQueueManager.prototype.getPlaylist=function(){return this._playlist.slice(0)},PlayQueueManager.prototype.setPlaylist=function(items){items=items.slice(0);for(var i=0,length=items.length;i<length;i++)addUniquePlaylistItemId(items[i]);this._playlist=items},PlayQueueManager.prototype.queue=function(items){for(var i=0,length=items.length;i<length;i++)addUniquePlaylistItemId(items[i]),this._playlist.push(items[i])},PlayQueueManager.prototype.queueNext=function(items){this.queue(items)},PlayQueueManager.prototype.getCurrentPlaylistIndex=function(){return findPlaylistIndex(this.getCurrentPlaylistItemId(),this._playlist)},PlayQueueManager.prototype.getCurrentPlaylistItemId=function(){return this._currentPlaylistItemId},PlayQueueManager.prototype.setPlaylistState=function(playlistItemId,playlistIndex){this._currentPlaylistItemId=playlistItemId},PlayQueueManager.prototype.removeFromPlaylist=function(playlistItemIds){var playlist=this.getPlaylist();if(playlist.length<=playlistItemIds.length)return{result:"empty"};var currentPlaylistItemId=this.getCurrentPlaylistItemId(),isCurrentIndex=playlistItemIds.indexOf(currentPlaylistItemId)!==-1;return this._playlist=playlist.filter(function(item){return playlistItemIds.indexOf(item.PlaylistItemId)===-1}),{result:"removed",isCurrentIndex:isCurrentIndex}},PlayQueueManager.prototype.movePlaylistItem=function(playlistItemId,newIndex){for(var oldIndex,playlist=this.getPlaylist(),i=0,length=playlist.length;i<length;i++)if(playlist[i].PlaylistItemId===playlistItemId){oldIndex=i;break}if(oldIndex===-1||oldIndex===newIndex)return{result:"noop"};if(newIndex>=playlist.length)throw new Error("newIndex out of bounds");return moveInArray(playlist,oldIndex,newIndex),this._playlist=playlist,{result:"moved",playlistItemId:playlistItemId,newIndex:newIndex}},PlayQueueManager.prototype.reset=function(){this._playlist=[],this._currentPlaylistItemId=null},PlayQueueManager});
|
Loading…
Add table
Add a link
Reference in a new issue