AirenSoft / OvenPlayer

OvenPlayer is JavaScript-based LLHLS and WebRTC Player for OvenMediaEngine.
https://OvenMediaEngine.com/ovenplayer
MIT License
499 stars 123 forks source link

Full screen not working in iOS 17 Safari with WebRTC #398

Closed bchah closed 6 months ago

bchah commented 8 months ago

When attempting to toggle fullscreen with either the button or double-tap on iOS 17, nothing happens except that this error appears in the web inspector:

Unhandled Promise Rejection: InvalidStateError: Context is closed - WebRTC.js:67

It seems to relate to the audioContext.resume() method. The error only occurs one time rather than for each press. I was able to reproduce it on the OvenPlayer demo site. Can anybody else reproduce this?

bchah commented 7 months ago

@SangwonOh any idea what could be the cause?

bchah commented 7 months ago

@SangwonOh Is there any help available for this? My iPhone users cant go fullscreen anymore. It's likely affecting your OvenStudio LLHLS product too so it's worth looking into.

SangwonOh commented 7 months ago

@bchah I'll find out as soon as possible

SangwonOh commented 7 months ago

@bchah Full screen seems to work well in iOS 17.1.1. There are no errors in my inspector. ðŸĪ” Which iOS version are you using?

getroot commented 7 months ago

My iPhone is 17.2 beta3, and full screen works fine on my phone as well.

bchah commented 7 months ago

I have no idea why, but I can easily reproduce this on multiple iPhones running the latest iOS release 17.1.1. It's not an issue on iOS 16, or iPadOS.

Here is an iPhone 15 and iPhone 12 both on the same iOS (the web inspector at the end is from the 15):

https://github.com/AirenSoft/OvenPlayer/assets/33604674/1d889fd5-c84f-458b-8b78-b20fa1fb746e

Even stranger is, I found a workaround for now. If you hit the error then reload the page, the player will go fullscreen when you hit play:

https://github.com/AirenSoft/OvenPlayer/assets/33604674/81705cff-8d4a-4d16-bacf-fab46e8ebd8c

SangwonOh commented 7 months ago

@bchah Hi 😀 It's very strange. I made some code change. Could you test this alpha version?

https://cdn.jsdelivr.net/npm/ovenplayer@0.10.3-3.alpha-1/dist/ovenplayer.min.js

bchah commented 7 months ago

Thank you @SangwonOh - the good news is, 0.10.33 does not cause an error in the Web Inspector ðŸ˜ļ The bad news is, the problem is still happening where the player does not go fullscreen ðŸ˜ŋ I will look closer in a debugger and see what has changed about the code flow in Safari 17 (iOS 17). It could be something with the webkitEnterFullScreen API. 🍎ðŸĪŠ

bchah commented 6 months ago

@SangwonOh This issue seems to be resolved by iOS 17.2 ðŸ˜