define(["events","playbackManager"],function(events,playbackManager){"use strict";functiontransferPlayback(oldPlayer,newPlayer){playbackManager.getPlayerState(oldPlayer).then(function(state){varitem=state.NowPlayingItem;if(item){varplayState=state.PlayState||{};playbackManager.stop(oldPlayer).then(function(){varresumePositionTicks=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)returnoldPlayer.isLocalPlayer?newPlayer.isLocalPlayer?voidconsole.log("Skipping remote control autoplay because newPlayer is a local player"):voidtransferPlayback(oldPlayer,newPlayer):voidconsole.log("Skipping remote control autoplay because oldPlayer is not a local player")})});