-
Notifications
You must be signed in to change notification settings - Fork 214
Description
Today, localParticipant.publishTrack(track) returns a promise while localParticipant.unpublishTrack(track) does not. Being unable to await a promise results in bug reports like #1227. I also wonder if this is why issues like #656 and #1007 were created.
This is especially problematic when a consumer's application uses the same custom track name such as "camera" or "screen" for both the just-unpublished and newly-published tracks because Twilio throws an error when a single participant publishes two tracks using the same name.
Twilio-Video users can work around this issue in a number of ways including
- Append random characters to the end of hard-coded track names then manage those extra characters as you see fit
- Catch
publishTrackerrors, check if they're due to a duplicate track issue, wait for an arbitrary delay, then attempt to publish again
It would be great if Twilio instead provided some means of knowing when a track is fully unpublished.
To avoid breaking changes, perhaps a new unpublishTrackAsync method could be introduced.
Thank you!