【问题标题】:Adding custom event triggers to YTPlayer for iOS向 YTPlayer for iOS 添加自定义事件触发器
【发布时间】:2023-03-10 04:40:01
【问题描述】:

我已经在我的应用程序中嵌入了 YouTube,现在我只想将播放器的全屏按钮绑定到我在 iOS 中的自定义方法,有什么方法可以实现吗?

【问题讨论】:

  • 你试过什么方法吗??
  • 我找不到与此相关的任何东西。
  • iOS YouTube Helper 会处理您打算开发的内容吗?它似乎与 JS 使用相同的功能,因此您只需在自定义 iOS 方法中将playsinline 设置为0

标签: ios youtube-api


【解决方案1】:

使用UIWindowDidBecomeHiddenNotificationUIWindowDidBecomeVisibleNotification 通知。当全屏播放器打开时,它会隐藏应用程序的窗口。

[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(videoExitFullScreen:)
                                                 name:UIWindowDidBecomeVisibleNotification
                                               object:self.view.window];

[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(videoEnterFullScreen:)
                                                 name:UIWindowDidBecomeHiddenNotification
                                               object:self.view.window];

youtube-ios-player-helper GitHub issues page的相关讨论。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-23
    • 1970-01-01
    • 2022-01-07
    • 2013-11-05
    • 2019-09-09
    相关资源
    最近更新 更多