mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
chromecast updates
This commit is contained in:
parent
2e25b47fb2
commit
f6995379a2
5 changed files with 41 additions and 161 deletions
|
@ -211,6 +211,11 @@
|
|||
$(this).trigger('connect');
|
||||
|
||||
MediaController.setActivePlayer(PlayerName);
|
||||
|
||||
this.sendMessage({
|
||||
options: {},
|
||||
command: 'Identify'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -288,6 +293,22 @@
|
|||
});
|
||||
};
|
||||
|
||||
var endpointInfo;
|
||||
function getEndpointInfo() {
|
||||
|
||||
if (endpointInfo) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
deferred.resolveWith(null, [endpointInfo]);
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
return ApiClient.getJSON(ApiClient.getUrl('System/Endpoint')).done(function (info) {
|
||||
|
||||
endpointInfo = info;
|
||||
});
|
||||
}
|
||||
|
||||
CastPlayer.prototype.sendMessage = function (message) {
|
||||
|
||||
var player = this;
|
||||
|
@ -299,19 +320,18 @@
|
|||
serverAddress: ApiClient.serverAddress()
|
||||
});
|
||||
|
||||
// If the user is on localhost we need a different address to send to the receiver
|
||||
var address = message.serverAddress.toLowerCase();
|
||||
if (address.indexOf('localhost') != -1 || address.indexOf('127.0.0') != -1) {
|
||||
getEndpointInfo().done(function (endpoint) {
|
||||
|
||||
ApiClient.getSystemInfo().done(function (info) {
|
||||
if (endpoint.IsLocal || endpoint.IsInNetwork) {
|
||||
ApiClient.getSystemInfo().done(function (info) {
|
||||
|
||||
message.serverAddress = info.WanAddress;
|
||||
message.serverAddress = info.LocalAddress;
|
||||
player.sendMessageInternal(message);
|
||||
});
|
||||
} else {
|
||||
player.sendMessageInternal(message);
|
||||
});
|
||||
|
||||
} else {
|
||||
player.sendMessageInternal(message);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
CastPlayer.prototype.sendMessageInternal = function (message) {
|
||||
|
@ -375,18 +395,8 @@
|
|||
return;
|
||||
}
|
||||
|
||||
switch (this.castPlayerState) {
|
||||
case PLAYER_STATE.LOADED:
|
||||
case PLAYER_STATE.PAUSED:
|
||||
this.currentMediaSession.play(null,
|
||||
this.mediaCommandSuccessCallback.bind(this, "playing started for " + this.currentMediaSession.sessionId),
|
||||
this.errorHandler);
|
||||
this.currentMediaSession.addUpdateListener(this.mediaStatusUpdateHandler);
|
||||
this.castPlayerState = PLAYER_STATE.PLAYING;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.currentMediaSession.play(null, this.mediaCommandSuccessCallback.bind(this, "playing started for " + this.currentMediaSession.sessionId), this.errorHandler);
|
||||
//this.currentMediaSession.addUpdateListener(this.mediaStatusUpdateHandler);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -398,12 +408,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.castPlayerState == PLAYER_STATE.PLAYING) {
|
||||
this.castPlayerState = PLAYER_STATE.PAUSED;
|
||||
this.currentMediaSession.pause(null,
|
||||
this.mediaCommandSuccessCallback.bind(this, "paused " + this.currentMediaSession.sessionId),
|
||||
this.errorHandler);
|
||||
}
|
||||
this.currentMediaSession.pause(null, this.mediaCommandSuccessCallback.bind(this, "paused " + this.currentMediaSession.sessionId), this.errorHandler);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -719,8 +724,7 @@
|
|||
"Mute",
|
||||
"Unmute",
|
||||
"ToggleMute",
|
||||
"SetVolume",
|
||||
"DisplayContent"]
|
||||
"SetVolume"]
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue