Skip to content

Commit

Permalink
fix: video not publishing on sfu migration
Browse files Browse the repository at this point in the history
  • Loading branch information
raviteja83 committed Jan 14, 2025
1 parent 0d5d9b3 commit 40df8eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
14 changes: 6 additions & 8 deletions packages/hms-video-store/src/media/tracks/HMSLocalAudioTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,12 @@ export class HMSLocalAudioTrack extends HMSAudioTrack {
}

clone(stream: HMSLocalStream) {
const track = new HMSLocalAudioTrack(
stream,
this.nativeTrack.clone(),
this.source!,
this.eventBus,
this.settings,
this.room,
);
const clonedTrack = this.nativeTrack.clone();
/**
* stream only becomes active when the track is added to it.
*/
stream.nativeStream.addTrack(clonedTrack);
const track = new HMSLocalAudioTrack(stream, clonedTrack, this.source!, this.eventBus, this.settings, this.room);
track.peerId = this.peerId;

if (this.pluginsManager.pluginsMap.size > 0) {
Expand Down
15 changes: 7 additions & 8 deletions packages/hms-video-store/src/media/tracks/HMSLocalVideoTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,13 @@ export class HMSLocalVideoTrack extends HMSVideoTrack {
}

clone(stream: HMSLocalStream) {
const track = new HMSLocalVideoTrack(
stream,
this.nativeTrack.clone(),
this.source!,
this.eventBus,
this.settings,
this.room,
);
const clonedTrack = this.nativeTrack.clone();
/**
* stream only becomes active when the track is added to it. If this is not added, after sfu migration, in non-simulcast case, the video will not be
* published to the server
*/
stream.nativeStream.addTrack(clonedTrack);
const track = new HMSLocalVideoTrack(stream, clonedTrack, this.source!, this.eventBus, this.settings, this.room);
track.peerId = this.peerId;

if (this.pluginsManager.pluginsMap.size > 0) {
Expand Down

0 comments on commit 40df8eb

Please sign in to comment.