SvenTiigi / YouTubePlayerKit

A Swift Package to easily play YouTube videos 📺
https://sventiigi.github.io/YouTubePlayerKit/
MIT License
683 stars 61 forks source link

visionOS "full screen" player #83

Closed frlefebvre closed 7 months ago

frlefebvre commented 7 months ago

Is your feature request related to a problem?

This may be less of a problem and more of a question. Videos only seem to be playable inline on visionOS. Is there something I need to do or could do to get a "full screen" player.

What solution would you like?

Getting either the system player or the player you get from youtube.com would be perfect.

What alternatives have you considered?

I've tried forcing allowsInlineMediaPlayback to false (via a fork) and that does play sound but blurs the entire window interface. Using the .web fullscreenMode goes one step further and resizes the window to the ratio of the video and does play the video but it is blurred. Finally, I've noticed that combining the two, if the user presses the full screen button you get the blurred video like before but pressing the progress bar will play the video in its own window.

To recap, that's with allowsInlineMediaPlayback to false and the following configuration: .init(automaticallyAdjustsContentInsets: true, allowsPictureInPictureMediaPlayback: true, fullscreenMode: .web, autoPlay: false, progressBarColor: .white, showControls: true, keyboardControlsDisabled: false, enableJavaScriptAPI: false, showFullscreenButton: true, showAnnotations: false, useModestBranding: true, origin: nil, playInline: false, showRelatedVideos: false)

Any additional context?

No response

SvenTiigi commented 7 months ago

Hi @frlefebvre,

I've also experienced this issue and it seems like a strange WebKit bug on visionOS because setting the fullscreenMode to .web should work fine as it enables the native HTML5 fullscreen API.

I think thats the reason why Christian Selig the author of the Juno app on visionOS uses a custom interface (opened in a new window) for fullscreen which adds an extra ornament view below the player interface.

image Source: https://christianselig.com/2024/02/introducing-juno/

frlefebvre commented 7 months ago

Ah that's a shame! I guess I'll keep opening the link in Safari for the time being. Have you filed a radar for it yet I could reference in my own?

SvenTiigi commented 7 months ago

Thats a good workaround 👍 No, I haven't submitted a feedback for it yet.