Skip to content

Commit

Permalink
fix: try indefinitely until played
Browse files Browse the repository at this point in the history
  • Loading branch information
raviteja83 committed May 17, 2024
1 parent 2fe6a13 commit 6554367
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { HMSIntersectionObserver } from '../../utils/intersection-observer';
import HMSLogger from '../../utils/logger';
import { HMSResizeObserver } from '../../utils/resize-observer';
import { isBrowser } from '../../utils/support';
import { sleep } from '../../utils/timer-utils';

/**
* This class is to manager video elements for video tracks.
Expand Down Expand Up @@ -87,10 +88,11 @@ export class VideoElementManager {
if (document.visibilityState === 'visible') {
for (const element of this.videoElements) {
if (element.paused) {
element.oncanplay = async () => {
console.log('playing video element', this.track.trackId);
while (element.paused) {
sleep(1000);
console.log('playing video element');
await element.play();
};
}
}
}
}
Expand Down

0 comments on commit 6554367

Please sign in to comment.