Rename 'localTransport' to 'transport', since it's often remote
This commit is contained in:
@@ -505,7 +505,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
map((connections) =>
|
map((connections) =>
|
||||||
[...connections.values()].map((c) => ({
|
[...connections.values()].map((c) => ({
|
||||||
room: c.livekitRoom,
|
room: c.livekitRoom,
|
||||||
url: c.localTransport.livekit_service_url,
|
url: c.transport.livekit_service_url,
|
||||||
isLocal: c instanceof PublishConnection,
|
isLocal: c instanceof PublishConnection,
|
||||||
})),
|
})),
|
||||||
),
|
),
|
||||||
@@ -650,7 +650,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
livekitRoom: c.livekitRoom,
|
livekitRoom: c.livekitRoom,
|
||||||
url: c.localTransport.livekit_service_url,
|
url: c.transport.livekit_service_url,
|
||||||
participants,
|
participants,
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
@@ -1758,13 +1758,11 @@ export class CallViewModel extends ViewModel {
|
|||||||
.pipe(this.scope.bind())
|
.pipe(this.scope.bind())
|
||||||
.subscribe(({ start, stop }) => {
|
.subscribe(({ start, stop }) => {
|
||||||
for (const c of stop) {
|
for (const c of stop) {
|
||||||
logger.info(
|
logger.info(`Disconnecting from ${c.transport.livekit_service_url}`);
|
||||||
`Disconnecting from ${c.localTransport.livekit_service_url}`,
|
|
||||||
);
|
|
||||||
c.stop().catch((err) => {
|
c.stop().catch((err) => {
|
||||||
// TODO: better error handling
|
// TODO: better error handling
|
||||||
logger.error(
|
logger.error(
|
||||||
`Fail to stop connection to ${c.localTransport.livekit_service_url}`,
|
`Fail to stop connection to ${c.transport.livekit_service_url}`,
|
||||||
err,
|
err,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -1772,9 +1770,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
for (const c of start) {
|
for (const c of start) {
|
||||||
c.start().then(
|
c.start().then(
|
||||||
() =>
|
() =>
|
||||||
logger.info(
|
logger.info(`Connected to ${c.transport.livekit_service_url}`),
|
||||||
`Connected to ${c.localTransport.livekit_service_url}`,
|
|
||||||
),
|
|
||||||
(e) => {
|
(e) => {
|
||||||
// We only want to report fatal errors `_configError$` for the publish connection.
|
// We only want to report fatal errors `_configError$` for the publish connection.
|
||||||
// If there is an error with another connection, it will not terminate the call and will be displayed
|
// If there is an error with another connection, it will not terminate the call and will be displayed
|
||||||
@@ -1786,7 +1782,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
this._configError$.next(e);
|
this._configError$.next(e);
|
||||||
}
|
}
|
||||||
logger.error(
|
logger.error(
|
||||||
`Failed to start connection to ${c.localTransport.livekit_service_url}`,
|
`Failed to start connection to ${c.transport.livekit_service_url}`,
|
||||||
e,
|
e,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ export class Connection {
|
|||||||
try {
|
try {
|
||||||
this._focusConnectionState$.next({
|
this._focusConnectionState$.next({
|
||||||
state: "FetchingConfig",
|
state: "FetchingConfig",
|
||||||
focus: this.localTransport,
|
focus: this.transport,
|
||||||
});
|
});
|
||||||
const { url, jwt } = await this.getSFUConfigWithOpenID();
|
const { url, jwt } = await this.getSFUConfigWithOpenID();
|
||||||
// If we were stopped while fetching the config, don't proceed to connect
|
// If we were stopped while fetching the config, don't proceed to connect
|
||||||
@@ -126,7 +126,7 @@ export class Connection {
|
|||||||
|
|
||||||
this._focusConnectionState$.next({
|
this._focusConnectionState$.next({
|
||||||
state: "ConnectingToLkRoom",
|
state: "ConnectingToLkRoom",
|
||||||
focus: this.localTransport,
|
focus: this.transport,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await this.livekitRoom.connect(url, jwt);
|
await this.livekitRoom.connect(url, jwt);
|
||||||
@@ -157,14 +157,14 @@ export class Connection {
|
|||||||
|
|
||||||
this._focusConnectionState$.next({
|
this._focusConnectionState$.next({
|
||||||
state: "ConnectedToLkRoom",
|
state: "ConnectedToLkRoom",
|
||||||
focus: this.localTransport,
|
focus: this.transport,
|
||||||
connectionState: this.livekitRoom.state,
|
connectionState: this.livekitRoom.state,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this._focusConnectionState$.next({
|
this._focusConnectionState$.next({
|
||||||
state: "FailedToStart",
|
state: "FailedToStart",
|
||||||
error: error instanceof Error ? error : new Error(`${error}`),
|
error: error instanceof Error ? error : new Error(`${error}`),
|
||||||
focus: this.localTransport,
|
focus: this.transport,
|
||||||
});
|
});
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
@@ -173,8 +173,8 @@ export class Connection {
|
|||||||
protected async getSFUConfigWithOpenID(): Promise<SFUConfig> {
|
protected async getSFUConfigWithOpenID(): Promise<SFUConfig> {
|
||||||
return await getSFUConfigWithOpenID(
|
return await getSFUConfigWithOpenID(
|
||||||
this.client,
|
this.client,
|
||||||
this.localTransport.livekit_service_url,
|
this.transport.livekit_service_url,
|
||||||
this.localTransport.livekit_alias,
|
this.transport.livekit_alias,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -188,7 +188,7 @@ export class Connection {
|
|||||||
await this.livekitRoom.disconnect();
|
await this.livekitRoom.disconnect();
|
||||||
this._focusConnectionState$.next({
|
this._focusConnectionState$.next({
|
||||||
state: "Stopped",
|
state: "Stopped",
|
||||||
focus: this.localTransport,
|
focus: this.transport,
|
||||||
});
|
});
|
||||||
this.stopped = true;
|
this.stopped = true;
|
||||||
}
|
}
|
||||||
@@ -201,9 +201,9 @@ export class Connection {
|
|||||||
public readonly publishingParticipants$: Behavior<PublishingParticipant[]>;
|
public readonly publishingParticipants$: Behavior<PublishingParticipant[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The focus server to connect to.
|
* The media transport to connect to.
|
||||||
*/
|
*/
|
||||||
public readonly localTransport: LivekitTransport;
|
public readonly transport: LivekitTransport;
|
||||||
|
|
||||||
private readonly client: OpenIDClientParts;
|
private readonly client: OpenIDClientParts;
|
||||||
/**
|
/**
|
||||||
@@ -219,7 +219,7 @@ export class Connection {
|
|||||||
) {
|
) {
|
||||||
const { transport, client, scope, remoteTransports$ } = opts;
|
const { transport, client, scope, remoteTransports$ } = opts;
|
||||||
|
|
||||||
this.localTransport = transport;
|
this.transport = transport;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
|
|
||||||
const participantsIncludingSubscribers$ = scope.behavior(
|
const participantsIncludingSubscribers$ = scope.behavior(
|
||||||
@@ -235,7 +235,7 @@ export class Connection {
|
|||||||
// Find all members that claim to publish on this connection
|
// Find all members that claim to publish on this connection
|
||||||
.flatMap(({ membership, transport }) =>
|
.flatMap(({ membership, transport }) =>
|
||||||
transport.livekit_service_url ===
|
transport.livekit_service_url ===
|
||||||
this.localTransport.livekit_service_url
|
this.transport.livekit_service_url
|
||||||
? [membership]
|
? [membership]
|
||||||
: [],
|
: [],
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user