define(["./emby-apiclient/events.js","./common/playback/playbackmanager.js","./approuter.js"],function(_events,_playbackmanager,_approuter){var currentPlayer;function onPlaybackStart(e,state){onStateChanged.call(this,e,state)}function onStateChanged(event,state){var _state$NowPlayingItem;this.isLocalPlayer&&"Video"===(null==(_state$NowPlayingItem=state.NowPlayingItem)?void 0:_state$NowPlayingItem.MediaType)?state.IsBackgroundPlayback&&_approuter.default.setTransparency("backdrop"):_approuter.default.setTransparency("none")}function onPlaybackStopped(e,state){_approuter.default.setTransparency("none")}function bindToPlayer(player){player!==currentPlayer&&(function(){var player=currentPlayer;player&&(_events.default.off(player,"playbackstart",onPlaybackStart),_events.default.off(player,"statechange",onPlaybackStart),_events.default.off(player,"playbackstop",onPlaybackStopped),currentPlayer=null)}(),currentPlayer=player)&&(function(player){var state=_playbackmanager.default.getPlayerState(player);onStateChanged.call(player,{type:"init"},state)}(player),_events.default.on(player,"playbackstart",onPlaybackStart),_events.default.on(player,"statechange",onPlaybackStart),_events.default.on(player,"playbackstop",onPlaybackStopped))}_events.default.on(_playbackmanager.default,"playerchange",function(e,player){bindToPlayer(player)}),bindToPlayer(_playbackmanager.default.getCurrentPlayer())});