Skip to content

Commit

Permalink
Fire event on track restart (#511)
Browse files Browse the repository at this point in the history
* Fire event on track restart

* Add changeset
  • Loading branch information
davidliu committed Nov 17, 2022
1 parent cb67610 commit c8e8438
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-olives-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-client': patch
---

Track event for track restart
4 changes: 4 additions & 0 deletions src/room/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,10 @@ export enum TrackEvent {
Message = 'message',
Muted = 'muted',
Unmuted = 'unmuted',
/**
* Only fires on LocalTracks
*/
Restarted = 'restarted',
Ended = 'ended',
Subscribed = 'subscribed',
Unsubscribed = 'unsubscribed',
Expand Down
1 change: 1 addition & 0 deletions src/room/track/LocalTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export default abstract class LocalTrack extends Track {

this.mediaStream = mediaStream;
this.constraints = constraints;
this.emit(TrackEvent.Restarted, this);
return this;
}

Expand Down
1 change: 1 addition & 0 deletions src/room/track/Track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ export type TrackEventCallbacks = {
message: () => void;
muted: (track?: any) => void;
unmuted: (track?: any) => void;
restarted: (track?: any) => void;
ended: (track?: any) => void;
updateSettings: () => void;
updateSubscription: () => void;
Expand Down

0 comments on commit c8e8438

Please sign in to comment.