BabylonJS / Extensions

Extensions for Babylon.js
175 stars 154 forks source link

need to interact with camera to play YouTube video on iPhone #276

Closed v3vr closed 3 months ago

v3vr commented 4 months ago

Hello, It appears that to play YouTube video on iPhone, user needs to interact with the camera; otherwise clicking on the YouTube video is ignored

How to reproduce

Open the repo's playground https://www.babylonjs-playground.com/#Y2LIXI#44

It works as expected on a desktop. However, on iPhone, when I click on the youtube video, nothing happens. If I slightly rotate the camera (even by one degree) and click on the video again, it starts to play.

Note: while the video is playing, I can continue to manipulate the camera, which is GREAT!

yuripourre commented 4 months ago

@v3vr I just checked on my Google Pixel 7 and the YouTube video doesn't play at all. Even rotating the camera.

sebavan commented 3 months ago

@ericwood73 this might be a good candidate for you ?

ericwood73 commented 3 months ago

@v3vr I just checked on my Google Pixel 7 and the YouTube video doesn't play at all. Even rotating the camera.

I just tried on my Pixel 7 and it worked for me. Could you try again? Maybe it was YT?

ericwood73 commented 3 months ago

It seems pointermove doesn't trigger on ios if the user just taps. I added a listener for touchstart on ios and that allows the user to interact with the iframe after an initial touch. I tried triggering the event manually, but iOS would have none of it. Unfortunately, I think this is the best we are going to be able to do on iOS.

yuripourre commented 3 months ago

@v3vr I just checked on my Google Pixel 7 and the YouTube video doesn't play at all. Even rotating the camera.

I just tried on my Pixel 7 and it worked for me. Could you try again? Maybe it was YT?

Yep! It worked now.

v3vr commented 3 months ago

@ericwood73 Thank you for looking into this