mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge remote-tracking branch 'upstream/master' into es6
With conflicts
This commit is contained in:
commit
3713091382
165 changed files with 4194 additions and 2714 deletions
|
@ -1,9 +1,6 @@
|
|||
define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'playQueueManager', 'userSettings', 'globalize', 'connectionManager', 'loading', 'apphost', 'screenfull'], function (events, datetime, appSettings, itemHelper, pluginManager, PlayQueueManager, userSettings, globalize, connectionManager, loading, apphost, screenfull) {
|
||||
'use strict';
|
||||
|
||||
/** Delay time in ms for reportPlayback logging */
|
||||
const reportPlaybackLogDelay = 1e3;
|
||||
|
||||
function enableLocalPlaylistManagement(player) {
|
||||
|
||||
if (player.getPlaylist) {
|
||||
|
@ -43,12 +40,6 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
events.trigger(playbackManagerInstance, 'playerchange', [newPlayer, newTarget, previousPlayer]);
|
||||
}
|
||||
|
||||
/** Last invoked method */
|
||||
let reportPlaybackLastMethod;
|
||||
|
||||
/** Last invoke time of method */
|
||||
let reportPlaybackLastTime;
|
||||
|
||||
function reportPlayback(playbackManagerInstance, state, player, reportPlaylist, serverId, method, progressEventName) {
|
||||
|
||||
if (!serverId) {
|
||||
|
@ -69,14 +60,6 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
addPlaylistToPlaybackReport(playbackManagerInstance, info, player, serverId);
|
||||
}
|
||||
|
||||
const now = (new Date).getTime();
|
||||
|
||||
if (method !== reportPlaybackLastMethod || now - (reportPlaybackLastTime || 0) >= reportPlaybackLogDelay) {
|
||||
console.debug(method + '-' + JSON.stringify(info));
|
||||
reportPlaybackLastMethod = method;
|
||||
reportPlaybackLastTime = now;
|
||||
}
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
var reportPlaybackPromise = apiClient[method](info);
|
||||
// Notify that report has been sent
|
||||
|
@ -2097,6 +2080,7 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
state.PlayState.IsMuted = player.isMuted();
|
||||
state.PlayState.IsPaused = player.paused();
|
||||
state.PlayState.RepeatMode = self.getRepeatMode(player);
|
||||
state.PlayState.ShuffleMode = self.getQueueShuffleMode(player);
|
||||
state.PlayState.MaxStreamingBitrate = self.getMaxStreamingBitrate(player);
|
||||
|
||||
state.PlayState.PositionTicks = getCurrentTicks(player);
|
||||
|
@ -2877,11 +2861,11 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
}
|
||||
};
|
||||
|
||||
self.queue = function (options, player) {
|
||||
self.queue = function (options, player = this._currentPlayer) {
|
||||
queue(options, '', player);
|
||||
};
|
||||
|
||||
self.queueNext = function (options, player) {
|
||||
self.queueNext = function (options, player = this._currentPlayer) {
|
||||
queue(options, 'next', player);
|
||||
};
|
||||
|
||||
|
@ -2969,6 +2953,7 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
} else {
|
||||
self._playQueueManager.queue(items);
|
||||
}
|
||||
events.trigger(player, 'playlistitemadd');
|
||||
}
|
||||
|
||||
function onPlayerProgressInterval() {
|
||||
|
@ -3304,6 +3289,11 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
sendProgressUpdate(player, 'repeatmodechange');
|
||||
}
|
||||
|
||||
function onShuffleQueueModeChange() {
|
||||
var player = this;
|
||||
sendProgressUpdate(player, 'shufflequeuemodechange');
|
||||
}
|
||||
|
||||
function onPlaylistItemMove(e) {
|
||||
var player = this;
|
||||
sendProgressUpdate(player, 'playlistitemmove', true);
|
||||
|
@ -3358,6 +3348,7 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
events.on(player, 'unpause', onPlaybackUnpause);
|
||||
events.on(player, 'volumechange', onPlaybackVolumeChange);
|
||||
events.on(player, 'repeatmodechange', onRepeatModeChange);
|
||||
events.on(player, 'shufflequeuemodechange', onShuffleQueueModeChange);
|
||||
events.on(player, 'playlistitemmove', onPlaylistItemMove);
|
||||
events.on(player, 'playlistitemremove', onPlaylistItemRemove);
|
||||
events.on(player, 'playlistitemadd', onPlaylistItemAdd);
|
||||
|
@ -3370,6 +3361,7 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
events.on(player, 'unpause', onPlaybackUnpause);
|
||||
events.on(player, 'volumechange', onPlaybackVolumeChange);
|
||||
events.on(player, 'repeatmodechange', onRepeatModeChange);
|
||||
events.on(player, 'shufflequeuemodechange', onShuffleQueueModeChange);
|
||||
events.on(player, 'playlistitemmove', onPlaylistItemMove);
|
||||
events.on(player, 'playlistitemremove', onPlaylistItemRemove);
|
||||
events.on(player, 'playlistitemadd', onPlaylistItemAdd);
|
||||
|
@ -3655,6 +3647,14 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
this.seek(parseInt(ticks), player);
|
||||
};
|
||||
|
||||
PlaybackManager.prototype.seekMs = function (ms, player) {
|
||||
|
||||
player = player || this._currentPlayer;
|
||||
|
||||
var ticks = ms * 10000;
|
||||
this.seek(ticks, player);
|
||||
};
|
||||
|
||||
PlaybackManager.prototype.playTrailers = function (item) {
|
||||
|
||||
var player = this._currentPlayer;
|
||||
|
@ -3702,7 +3702,6 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
};
|
||||
|
||||
PlaybackManager.prototype.stop = function (player) {
|
||||
|
||||
player = player || this._currentPlayer;
|
||||
|
||||
if (player) {
|
||||
|
@ -3811,7 +3810,7 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
});
|
||||
};
|
||||
|
||||
PlaybackManager.prototype.shuffle = function (shuffleItem, player, queryOptions) {
|
||||
PlaybackManager.prototype.shuffle = function (shuffleItem, player) {
|
||||
|
||||
player = player || this._currentPlayer;
|
||||
if (player && player.shuffle) {
|
||||
|
@ -3878,6 +3877,7 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
'GoToSearch',
|
||||
'DisplayMessage',
|
||||
'SetRepeatMode',
|
||||
'SetShuffleQueue',
|
||||
'PlayMediaSource',
|
||||
'PlayTrailers'
|
||||
];
|
||||
|
@ -3911,9 +3911,7 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
return info ? info.supportedCommands : [];
|
||||
};
|
||||
|
||||
PlaybackManager.prototype.setRepeatMode = function (value, player) {
|
||||
|
||||
player = player || this._currentPlayer;
|
||||
PlaybackManager.prototype.setRepeatMode = function (value, player = this._currentPlayer) {
|
||||
if (player && !enableLocalPlaylistManagement(player)) {
|
||||
return player.setRepeatMode(value);
|
||||
}
|
||||
|
@ -3922,9 +3920,7 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
events.trigger(player, 'repeatmodechange');
|
||||
};
|
||||
|
||||
PlaybackManager.prototype.getRepeatMode = function (player) {
|
||||
|
||||
player = player || this._currentPlayer;
|
||||
PlaybackManager.prototype.getRepeatMode = function (player = this._currentPlayer) {
|
||||
if (player && !enableLocalPlaylistManagement(player)) {
|
||||
return player.getRepeatMode();
|
||||
}
|
||||
|
@ -3932,6 +3928,52 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
return this._playQueueManager.getRepeatMode();
|
||||
};
|
||||
|
||||
PlaybackManager.prototype.setQueueShuffleMode = function (value, player = this._currentPlayer) {
|
||||
if (player && !enableLocalPlaylistManagement(player)) {
|
||||
return player.setQueueShuffleMode(value);
|
||||
}
|
||||
|
||||
this._playQueueManager.setShuffleMode(value);
|
||||
events.trigger(player, 'shufflequeuemodechange');
|
||||
};
|
||||
|
||||
PlaybackManager.prototype.getQueueShuffleMode = function (player = this._currentPlayer) {
|
||||
if (player && !enableLocalPlaylistManagement(player)) {
|
||||
return player.getQueueShuffleMode();
|
||||
}
|
||||
|
||||
return this._playQueueManager.getShuffleMode();
|
||||
};
|
||||
|
||||
PlaybackManager.prototype.toggleQueueShuffleMode = function (player = this._currentPlayer) {
|
||||
let currentvalue;
|
||||
if (player && !enableLocalPlaylistManagement(player)) {
|
||||
currentvalue = player.getQueueShuffleMode();
|
||||
switch (currentvalue) {
|
||||
case 'Shuffle':
|
||||
player.setQueueShuffleMode('Sorted');
|
||||
break;
|
||||
case 'Sorted':
|
||||
player.setQueueShuffleMode('Shuffle');
|
||||
break;
|
||||
default:
|
||||
throw new TypeError('current value for shufflequeue is invalid');
|
||||
}
|
||||
} else {
|
||||
this._playQueueManager.toggleShuffleMode();
|
||||
}
|
||||
events.trigger(player, 'shufflequeuemodechange');
|
||||
};
|
||||
|
||||
PlaybackManager.prototype.clearQueue = function (clearCurrentItem = false, player = this._currentPlayer) {
|
||||
if (player && !enableLocalPlaylistManagement(player)) {
|
||||
return player.clearQueue(clearCurrentItem);
|
||||
}
|
||||
|
||||
this._playQueueManager.clearPlaylist(clearCurrentItem);
|
||||
events.trigger(player, 'playlistitemremove');
|
||||
};
|
||||
|
||||
PlaybackManager.prototype.trySetActiveDeviceName = function (name) {
|
||||
|
||||
name = normalizeName(name);
|
||||
|
@ -4000,6 +4042,9 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
case 'SetRepeatMode':
|
||||
this.setRepeatMode(cmd.Arguments.RepeatMode, player);
|
||||
break;
|
||||
case 'SetShuffleQueue':
|
||||
this.setQueueShuffleMode(cmd.Arguments.ShuffleMode, player);
|
||||
break;
|
||||
case 'VolumeUp':
|
||||
this.volumeUp(player);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue