Remove un-necessary transport field, already accessible from connection
This commit is contained in:
@@ -563,7 +563,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
/**
|
/**
|
||||||
* The transport over which we should be actively publishing our media.
|
* The transport over which we should be actively publishing our media.
|
||||||
*/
|
*/
|
||||||
private readonly localTransport$: Behavior<Async<LivekitTransport> | null> =
|
private readonly localTransport$: Behavior<Async<LivekitTransport>> =
|
||||||
this.scope.behavior(
|
this.scope.behavior(
|
||||||
this.transports$.pipe(
|
this.transports$.pipe(
|
||||||
map((transports) => transports?.local ?? null),
|
map((transports) => transports?.local ?? null),
|
||||||
@@ -571,38 +571,30 @@ export class CallViewModel extends ViewModel {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
private readonly localConnectionAndTransport$ = this.scope.behavior(
|
private readonly localConnection$: Behavior<Async<PublishConnection>> =
|
||||||
this.localTransport$.pipe(
|
this.scope.behavior(
|
||||||
map(
|
this.localTransport$.pipe(
|
||||||
(transport) =>
|
map(
|
||||||
transport &&
|
(transport) =>
|
||||||
mapAsync(transport, (transport) => {
|
transport &&
|
||||||
const opts: ConnectionOpts = {
|
mapAsync(transport, (transport) => {
|
||||||
transport,
|
const opts: ConnectionOpts = {
|
||||||
client: this.matrixRTCSession.room.client,
|
transport,
|
||||||
scope: this.scope,
|
client: this.matrixRTCSession.room.client,
|
||||||
remoteTransports$: this.remoteTransports$,
|
scope: this.scope,
|
||||||
};
|
remoteTransports$: this.remoteTransports$,
|
||||||
return {
|
};
|
||||||
connection: new PublishConnection(
|
return new PublishConnection(
|
||||||
opts,
|
opts,
|
||||||
this.mediaDevices,
|
this.mediaDevices,
|
||||||
this.muteStates,
|
this.muteStates,
|
||||||
this.e2eeLivekitOptions(),
|
this.e2eeLivekitOptions(),
|
||||||
this.scope.behavior(this.trackProcessorState$),
|
this.scope.behavior(this.trackProcessorState$),
|
||||||
),
|
);
|
||||||
transport,
|
}),
|
||||||
};
|
),
|
||||||
}),
|
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
|
||||||
|
|
||||||
private readonly localConnection$ = this.scope.behavior(
|
|
||||||
this.localConnectionAndTransport$.pipe(
|
|
||||||
map((value) => value && mapAsync(value, ({ connection }) => connection)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
public readonly livekitConnectionState$ = this.scope.behavior(
|
public readonly livekitConnectionState$ = this.scope.behavior(
|
||||||
this.localConnection$.pipe(
|
this.localConnection$.pipe(
|
||||||
@@ -813,11 +805,11 @@ export class CallViewModel extends ViewModel {
|
|||||||
}[]
|
}[]
|
||||||
>(
|
>(
|
||||||
// TODO: Move this logic into Connection/PublishConnection if possible
|
// TODO: Move this logic into Connection/PublishConnection if possible
|
||||||
this.localConnectionAndTransport$
|
this.localConnection$
|
||||||
.pipe(
|
.pipe(
|
||||||
switchMap((values) => {
|
switchMap((values) => {
|
||||||
if (values?.state !== "ready") return [];
|
if (values?.state !== "ready") return [];
|
||||||
const localConnection = values.value.connection;
|
const localConnection = values.value;
|
||||||
const memberError = (): never => {
|
const memberError = (): never => {
|
||||||
throw new Error("No room member for call membership");
|
throw new Error("No room member for call membership");
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user