File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " livekit-client " : patch
3+ ---
4+
5+ Emit MediaDeviceError only when acquiring tracks fails
Original file line number Diff line number Diff line change @@ -486,6 +486,16 @@ export default class LocalParticipant extends Participant {
486486 default :
487487 throw new TrackInvalidError ( source ) ;
488488 }
489+ } catch ( e : unknown ) {
490+ localTracks ?. forEach ( ( tr ) => {
491+ tr . stop ( ) ;
492+ } ) ;
493+ if ( e instanceof Error ) {
494+ this . emit ( ParticipantEvent . MediaDevicesError , e ) ;
495+ }
496+ throw e ;
497+ }
498+ try {
489499 const publishPromises : Array < Promise < LocalTrackPublication > > = [ ] ;
490500 for ( const localTrack of localTracks ) {
491501 this . log . info ( 'publishing track' , {
@@ -502,9 +512,6 @@ export default class LocalParticipant extends Participant {
502512 localTracks ?. forEach ( ( tr ) => {
503513 tr . stop ( ) ;
504514 } ) ;
505- if ( e instanceof Error && ! ( e instanceof TrackInvalidError ) ) {
506- this . emit ( ParticipantEvent . MediaDevicesError , e ) ;
507- }
508515 throw e ;
509516 } finally {
510517 this . pendingPublishing . delete ( source ) ;
You can’t perform that action at this time.
0 commit comments