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

fix-cast-with-localhost-server

This commit is contained in:
Sky-High 2023-08-08 21:23:09 +02:00
parent 26b83efc95
commit 51eeef00a6

View file

@ -335,16 +335,25 @@ class CastPlayer {
apiClient = ServerConnections.currentApiClient();
}
/* If serverAddress is localhost,this address can not be used for the cast receiver device.
* Use the local address (ULA, Unique Local Address) in that case.
*/
const srvAddress = apiClient.serverAddress();
const srvLocalAddress = srvAddress.startsWith('http://localhost') || srvAddress.startsWith('http://127.') || srvAddress.startsWith('http://[::1]')
? apiClient.serverInfo().LocalAddress : srvAddress;
message = Object.assign(message, {
userId: apiClient.getCurrentUserId(),
deviceId: apiClient.deviceId(),
accessToken: apiClient.accessToken(),
serverAddress: apiClient.serverAddress(),
serverAddress: srvLocalAddress,
serverId: apiClient.serverId(),
serverVersion: apiClient.serverVersion(),
receiverName: receiverName
});
console.debug('cc: message{'+message.command+'; '+srvAddress+' -> '+srvLocalAddress+'}');
const bitrateSetting = appSettings.maxChromecastBitrate();
if (bitrateSetting) {
message.maxBitrate = bitrateSetting;