Update to changes in the sdk.

- plain tracks instead of media$
This commit is contained in:
Timo K.
2026-10-14 10:23:29 +02:00
committed by Timo
parent 52aaf84c3e
commit 7c5d1324e7
19 changed files with 358 additions and 259 deletions
+4 -5
View File
@@ -7,9 +7,9 @@ Please see LICENSE in the repository root for full details.
*/
import {
type AudioMediaTrack,
type Behavior,
type ObservableScope,
trackBySource$,
} from "@element-hq/matrixrtc-sdk";
import { combineLatest, map, of, switchMap } from "rxjs";
import { logger } from "matrix-js-sdk/lib/logger";
@@ -20,7 +20,6 @@ import {
type BaseUserMediaViewModel,
createBaseUserMedia,
} from "./UserMediaViewModel";
import { memberTrack$ } from "./MemberMediaViewModel";
export interface RemoteUserMediaViewModel
extends BaseUserMediaViewModel, VolumeControls {
@@ -44,11 +43,11 @@ export function createRemoteUserMedia(
const waitingForMedia$ = scope.behavior(
combineLatest(
[inputs.focusUrl$, inputs.media$],
[inputs.focusUrl$, inputs.member.tracks$],
// Without a transport the user is not attempting to publish anywhere
// and so we shouldn't expect media. (They might be a subscribe-only bot
// for example.)
(focusUrl, media) => focusUrl !== undefined && media === null,
(focusUrl, tracks) => focusUrl !== undefined && tracks === null,
),
);
waitingForMedia$.pipe(scope.bind()).subscribe((waiting) => {
@@ -60,7 +59,7 @@ export function createRemoteUserMedia(
...createVolumeControls(scope, {
pretendToBeDisconnected$,
sink$: scope.behavior(
memberTrack$<AudioMediaTrack>(scope, inputs.media$, "microphone").pipe(
trackBySource$(scope, inputs.member.tracks$, "microphone").pipe(
map((track) => (volume: number) => track?.setVolume(volume)),
),
),