Skip to content

Commit

Permalink
Fix promise for webkitEnterFullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Oct 27, 2023
1 parent 554082f commit 455394b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion custom_components/webrtc/www/webrtc-camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,13 @@ class WebRTCCamera extends VideoRTC {
fullscreen.icon = document.fullscreenElement ? 'mdi:fullscreen-exit' : 'mdi:fullscreen';
});
} else if (video.webkitEnterFullscreen) {
this.requestFullscreen = () => video.webkitEnterFullscreen();
this.requestFullscreen = () => new Promise((resolve, reject) => {
try {
video.webkitEnterFullscreen();
} catch (e) {
reject(e);
}
});
video.addEventListener('webkitendfullscreen', () => {
setTimeout(() => this.play(), 1000); // fix bug in iOS
});
Expand Down

0 comments on commit 455394b

Please sign in to comment.