Skip to content

Commit

Permalink
fix: add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
raviteja83 committed Dec 6, 2024
1 parent e053c9f commit 281601f
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,26 @@ export class AudioSinkManager {
audioEl.addEventListener('pause', this.handleAudioPaused);

audioEl.onerror = async () => {
HMSLogger.e(this.TAG, 'error on audio element', audioEl.error);
HMSLogger.e(this.TAG, 'error on audio element', audioEl?.error?.code);
const ex = ErrorFactory.TracksErrors.AudioPlaybackError(
`Audio playback error for track - ${track.trackId} code - ${audioEl?.error?.code}`,
);
this.eventBus.analytics.publish(AnalyticsEventFactory.audioPlaybackError(ex));
if (audioEl?.error?.code === MediaError.MEDIA_ERR_DECODE) {
// try to wait for main execution to complete first
this.removeAudioElement(audioEl, track);
console.error(audioEl);
await sleep(500);
console.error('retrying for trackId', track.trackId);
await this.handleTrackAdd({ track, peer, callListener: false });
console.error(
'after retry for trackId',
track.trackId,
'autoplayState',
this.state.autoplayFailed,
'autopausedTracks',
this.autoPausedTracks.values(),
);
if (!this.state.autoplayFailed) {
this.eventBus.analytics.publish(
AnalyticsEventFactory.audioRecovered('Audio recovered after media decode error'),
Expand Down

0 comments on commit 281601f

Please sign in to comment.