First separation commit.
Added LICENSE, README.md, CONTRIBUTORS.md
This commit is contained in:
parent
09513af31b
commit
4678528d00
657 changed files with 422 additions and 0 deletions
22
src/bower_components/emby-webcomponents/playback/remotecontrolautoplay.js
vendored
Normal file
22
src/bower_components/emby-webcomponents/playback/remotecontrolautoplay.js
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
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 || {},
|
||||
resumePositionTicks = playState.PositionTicks || 0;
|
||||
playbackManager.stop(oldPlayer).then(function() {
|
||||
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")
|
||||
})
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue