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

improve report playback stop when user closes the browser

This commit is contained in:
Luke Pulverenti 2017-09-17 02:13:20 -04:00
parent 8fe2874195
commit 91ba1d2a13
12 changed files with 14 additions and 20 deletions

View file

@ -1 +1 @@
define(["events","playbackManager"],function(events,playbackManager){"use strict";function transferPlayback(oldPlayer,newPlayer){playbackManager.getPlayerState(oldPlayer).then(function(state){var item=state.NowPlayingItem;if(item){var playState=state.PlayState||{};playbackManager.stop(oldPlayer).then(function(){var resumePositionTicks=playState.PositionTicks||0;playbackManager.play({ids:[item.Id],serverId:item.ServerId,startPositionTicks:resumePositionTicks},newPlayer)})}})}events.on(playbackManager,"playerchange",function(e,newPlayer,newTarget,oldPlayer){if(oldPlayer&&newPlayer)return oldPlayer.isLocalPlayer?newPlayer.isLocalPlayer?void console.log("Skipping remote control autoplay because newPlayer is a local player"):void transferPlayback(oldPlayer,newPlayer):void console.log("Skipping remote control autoplay because oldPlayer is not a local player")})});
define(["events","playbackManager"],function(events,playbackManager){"use strict";function transferPlayback(oldPlayer,newPlayer){var state=playbackManager.getPlayerState(oldPlayer),item=state.NowPlayingItem;if(item){var playState=state.PlayState||{};playbackManager.stop(oldPlayer).then(function(){var resumePositionTicks=playState.PositionTicks||0;playbackManager.play({ids:[item.Id],serverId:item.ServerId,startPositionTicks:resumePositionTicks},newPlayer)})}}events.on(playbackManager,"playerchange",function(e,newPlayer,newTarget,oldPlayer){if(oldPlayer&&newPlayer)return oldPlayer.isLocalPlayer?newPlayer.isLocalPlayer?void console.log("Skipping remote control autoplay because newPlayer is a local player"):void transferPlayback(oldPlayer,newPlayer):void console.log("Skipping remote control autoplay because oldPlayer is not a local player")})});