Fix incorrect device ID being set in Receiver API object

This commit is contained in:
hensm
2022-04-16 05:34:32 +01:00
parent 69ce675e0d
commit 2001a9481b
4 changed files with 24 additions and 21 deletions

View File

@@ -83,7 +83,9 @@ export default class Session extends CastClient {
volume: status.volume,
appId: application.appId,
displayName: application.displayName,
receiverFriendlyName: friendlyName,
receiverId: this.receiverDevice.id,
receiverFriendlyName:
this.receiverDevice.friendlyName,
transportId: this.sessionId,
// TODO: Fix this
@@ -162,23 +164,25 @@ export default class Session extends CastClient {
) {
super();
super.connect(receiverDevice.host, {
onHeartbeat: () => {
// Include transport heartbeat with platform heartbeat
if (this.transportHeartbeat) {
this.transportHeartbeat.send({ type: "PING" });
super
.connect(receiverDevice.host, {
onHeartbeat: () => {
// Include transport heartbeat with platform heartbeat
if (this.transportHeartbeat) {
this.transportHeartbeat.send({ type: "PING" });
}
},
onReceiverMessage: message => {
this.onReceiverMessage(message);
}
},
onReceiverMessage: message => {
this.onReceiverMessage(message);
}
}).then(() => {
// Send a launch request and store the request ID for reference
this.launchRequestId = this.sendReceiverMessage({
type: "LAUNCH",
appId: this.appId
})
.then(() => {
// Send a launch request and store the request ID for reference
this.launchRequestId = this.sendReceiverMessage({
type: "LAUNCH",
appId: this.appId
});
});
});
// Handle client connection closed
this.client.on("close", () => {

View File

@@ -25,6 +25,7 @@ export interface CastSessionCreatedDetails extends CastSessionUpdatedDetails {
appId: string;
appImages: Image[];
displayName: string;
receiverId: string;
receiverFriendlyName: string;
senderApps: SenderApplication[];
transportId: string;

View File

@@ -5,10 +5,7 @@ import logger from "../../lib/logger";
import { ReceiverDevice } from "../../types";
import { ErrorCallback, SuccessCallback } from "../types";
import {
onMessage,
sendMessageResponse
} from "../eventMessageChannel";
import { onMessage, sendMessageResponse } from "../eventMessageChannel";
import {
AutoJoinPolicy,
@@ -262,7 +259,7 @@ onMessage(message => {
// TODO: Implement persistent per-origin receiver IDs
const receiver = new Receiver(
status.receiverFriendlyName, // label
status.receiverId, // label
status.receiverFriendlyName, // friendlyName
[Capability.VIDEO_OUT, Capability.AUDIO_OUT], // capabilities
status.volume // volume

View File

@@ -60,6 +60,7 @@ export interface CastSessionCreatedDetails extends CastSessionUpdatedDetails {
appId: string;
appImages: Image[];
displayName: string;
receiverId: string;
receiverFriendlyName: string;
senderApps: SenderApplication[];
transportId: string;