SvenTiigi / YouTubePlayerKit

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

Disable scrolling the player on macOS #59

Closed kuglee closed 1 year ago

kuglee commented 1 year ago

What happened?

Hi,

Thanks for the package, it's working great on iOS. However on macOS the player view can be scrolled and a scroll bar is also visible. Is there a way to disable it? Névtelen 5

What are the steps to reproduce?

Here is a test view:


  public var youtubePlayerView: some View {
      YouTubePlayerView(YouTubePlayer("https://youtube.com/watch?v=psL_5RIBqnY"))
    .aspectRatio(16 / 9, contentMode: .fit)
  }
``

### What is the expected behavior?

I would expect the scroll gesture to be disabled on the player view .
SvenTiigi commented 1 year ago

Hey @kuglee,

Please check out the develop branch which I've just updated to also disable scrolling on macOS (https://github.com/SvenTiigi/YouTubePlayerKit/commit/180bbdaeb3241670f61cc098d5f6b92af89090b1)

kuglee commented 1 year ago

Thank, it's working. The only issue I have now is that aspectRatio(16 / 9, contentMode: .fit) is not always perfect, so sometimes when the window is resized the scrollbars still appear. I don't know if it's possible to hide them or to size the view some other way to keep aspect ratio.

kuglee commented 1 year ago

I've experimented with WKWebView. This css should hide the scrollbars:

<style>
  ::-webkit-scrollbar {
       display: none !important;
  }
</style>
SvenTiigi commented 1 year ago

CSS style has been added with https://github.com/SvenTiigi/YouTubePlayerKit/commit/3370aac5a8c43a4a20dc6dfd27182a6d4f19a633 and will be available with the next release ✌️

kuglee commented 1 year ago

Awesome. Thanks.