Merge branch 'livekit' into toger5/connection-state-refactor

This commit is contained in:
Timo K
2025-12-10 13:49:06 +01:00
20 changed files with 1118 additions and 140 deletions

View File

@@ -271,12 +271,14 @@ export const createLocalMembership$ = ({
// - overwrite current publisher
scope.reconcile(localConnection$, async (connection) => {
if (connection !== null) {
publisher$.next(createPublisherFactory(connection));
const publisher = createPublisherFactory(connection);
publisher$.next(publisher);
// Clean-up callback
return Promise.resolve(async (): Promise<void> => {
await publisher.stopPublishing();
publisher.stopTracks();
});
}
return Promise.resolve(async (): Promise<void> => {
await publisher$?.value?.stopPublishing();
publisher$?.value?.stopTracks();
});
});
// Use reconcile here to not run concurrent createAndSetupTracks calls