diff --git a/src/state/CallViewModel.ts b/src/state/CallViewModel.ts index 341f2286..7d703b53 100644 --- a/src/state/CallViewModel.ts +++ b/src/state/CallViewModel.ts @@ -505,7 +505,7 @@ export class CallViewModel extends ViewModel { map((connections) => [...connections.values()].map((c) => ({ room: c.livekitRoom, - url: c.localTransport.livekit_service_url, + url: c.transport.livekit_service_url, isLocal: c instanceof PublishConnection, })), ), @@ -650,7 +650,7 @@ export class CallViewModel extends ViewModel { return { livekitRoom: c.livekitRoom, - url: c.localTransport.livekit_service_url, + url: c.transport.livekit_service_url, participants, }; }), @@ -1758,13 +1758,11 @@ export class CallViewModel extends ViewModel { .pipe(this.scope.bind()) .subscribe(({ start, stop }) => { for (const c of stop) { - logger.info( - `Disconnecting from ${c.localTransport.livekit_service_url}`, - ); + logger.info(`Disconnecting from ${c.transport.livekit_service_url}`); c.stop().catch((err) => { // TODO: better error handling logger.error( - `Fail to stop connection to ${c.localTransport.livekit_service_url}`, + `Fail to stop connection to ${c.transport.livekit_service_url}`, err, ); }); @@ -1772,9 +1770,7 @@ export class CallViewModel extends ViewModel { for (const c of start) { c.start().then( () => - logger.info( - `Connected to ${c.localTransport.livekit_service_url}`, - ), + logger.info(`Connected to ${c.transport.livekit_service_url}`), (e) => { // 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 @@ -1786,7 +1782,7 @@ export class CallViewModel extends ViewModel { this._configError$.next(e); } logger.error( - `Failed to start connection to ${c.localTransport.livekit_service_url}`, + `Failed to start connection to ${c.transport.livekit_service_url}`, e, ); }, diff --git a/src/state/Connection.ts b/src/state/Connection.ts index 2f294057..e9a17608 100644 --- a/src/state/Connection.ts +++ b/src/state/Connection.ts @@ -118,7 +118,7 @@ export class Connection { try { this._focusConnectionState$.next({ state: "FetchingConfig", - focus: this.localTransport, + focus: this.transport, }); const { url, jwt } = await this.getSFUConfigWithOpenID(); // If we were stopped while fetching the config, don't proceed to connect @@ -126,7 +126,7 @@ export class Connection { this._focusConnectionState$.next({ state: "ConnectingToLkRoom", - focus: this.localTransport, + focus: this.transport, }); try { await this.livekitRoom.connect(url, jwt); @@ -157,14 +157,14 @@ export class Connection { this._focusConnectionState$.next({ state: "ConnectedToLkRoom", - focus: this.localTransport, + focus: this.transport, connectionState: this.livekitRoom.state, }); } catch (error) { this._focusConnectionState$.next({ state: "FailedToStart", error: error instanceof Error ? error : new Error(`${error}`), - focus: this.localTransport, + focus: this.transport, }); throw error; } @@ -173,8 +173,8 @@ export class Connection { protected async getSFUConfigWithOpenID(): Promise { return await getSFUConfigWithOpenID( this.client, - this.localTransport.livekit_service_url, - this.localTransport.livekit_alias, + this.transport.livekit_service_url, + this.transport.livekit_alias, ); } /** @@ -188,7 +188,7 @@ export class Connection { await this.livekitRoom.disconnect(); this._focusConnectionState$.next({ state: "Stopped", - focus: this.localTransport, + focus: this.transport, }); this.stopped = true; } @@ -201,9 +201,9 @@ export class Connection { public readonly publishingParticipants$: Behavior; /** - * The focus server to connect to. + * The media transport to connect to. */ - public readonly localTransport: LivekitTransport; + public readonly transport: LivekitTransport; private readonly client: OpenIDClientParts; /** @@ -219,7 +219,7 @@ export class Connection { ) { const { transport, client, scope, remoteTransports$ } = opts; - this.localTransport = transport; + this.transport = transport; this.client = client; const participantsIncludingSubscribers$ = scope.behavior( @@ -235,7 +235,7 @@ export class Connection { // Find all members that claim to publish on this connection .flatMap(({ membership, transport }) => transport.livekit_service_url === - this.localTransport.livekit_service_url + this.transport.livekit_service_url ? [membership] : [], )