Skip to content

Commit

Permalink
Only emit TrackStreamStateChanged events on changed stream state
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasIO committed Jul 25, 2024
1 parent 2573a57 commit 99f87c3
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/room/Room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1446,14 +1446,17 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
if (!pub || !pub.track) {
return;
}
pub.track.streamState = Track.streamStateFromProto(streamState.state);
participant.emit(ParticipantEvent.TrackStreamStateChanged, pub, pub.track.streamState);
this.emitWhenConnected(
RoomEvent.TrackStreamStateChanged,
pub,
pub.track.streamState,
participant,
);
const newStreamState = Track.streamStateFromProto(streamState.state);
if (newStreamState !== pub.track.streamState) {
pub.track.streamState = newStreamState;
participant.emit(ParticipantEvent.TrackStreamStateChanged, pub, pub.track.streamState);
this.emitWhenConnected(
RoomEvent.TrackStreamStateChanged,
pub,
pub.track.streamState,
participant,
);
}
});
};

Expand Down

0 comments on commit 99f87c3

Please sign in to comment.