mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update osd
This commit is contained in:
parent
407f137095
commit
3e2ad02767
5 changed files with 17 additions and 8 deletions
51
dashboard-ui/bower_components/emby-webcomponents/playback/remotecontrolautoplay.js
vendored
Normal file
51
dashboard-ui/bower_components/emby-webcomponents/playback/remotecontrolautoplay.js
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
define(['events', 'playbackManager'], function (events, playbackManager) {
|
||||
'use strict';
|
||||
|
||||
function transferPlayback(oldPlayer, newPlayer) {
|
||||
|
||||
oldPlayer.getPlayerState().then(function (state) {
|
||||
|
||||
var item = state.NowPlayingItem;
|
||||
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
|
||||
var playState = state.PlayState || {};
|
||||
|
||||
oldPlayer.stop();
|
||||
|
||||
var itemId = item.Id;
|
||||
var resumePositionTicks = playState.PositionTicks || 0;
|
||||
|
||||
playbackManager.play({
|
||||
ids: [itemId],
|
||||
startPositionTicks: resumePositionTicks
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
events.on(playbackManager, 'playerchange', function (e, newPlayer, newTarget, oldPlayer) {
|
||||
|
||||
if (!oldPlayer || !newPlayer) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!oldPlayer.isLocalPlayer) {
|
||||
console.log('Skipping remote control autoplay because oldPlayer is not a local player');
|
||||
return;
|
||||
}
|
||||
|
||||
if (newPlayer.isLocalPlayer) {
|
||||
console.log('Skipping remote control autoplay because newPlayer is a local player');
|
||||
return;
|
||||
}
|
||||
|
||||
// If playback is playing locally and a new player is activated, transfer the media to that player
|
||||
if (oldPlayer.isPlaying()) {
|
||||
transferPlayback(oldPlayer, newPlayer);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue