Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed51edc

Browse files
authored
Resolve publication promise with publication (#1477)
1 parent 1a5a966 commit ed51edc

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/room/participant/LocalParticipant.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,12 @@ export default class LocalParticipant extends Participant {
875875
track: getLogContextFromTrack(track),
876876
});
877877
const onSignalConnected = async () => {
878-
return this.publish(track, opts, isStereo).then(resolve).catch(reject);
878+
try {
879+
const publication = await this.publish(track, opts, isStereo);
880+
resolve(publication);
881+
} catch (e) {
882+
reject(e);
883+
}
879884
};
880885
setTimeout(() => {
881886
this.engine.off(EngineEvent.SignalConnected, onSignalConnected);
@@ -892,7 +897,12 @@ export default class LocalParticipant extends Participant {
892897
reject(new PublishTrackError('publishing rejected as engine closed', 499));
893898
});
894899
} else {
895-
return await this.publish(track, opts, isStereo);
900+
try {
901+
const publication = await this.publish(track, opts, isStereo);
902+
resolve(publication);
903+
} catch (e) {
904+
reject(e);
905+
}
896906
}
897907
} catch (e) {
898908
reject(e);

0 commit comments

Comments
 (0)