我有一个tvOS应用程序,它有一个播放视频的屏幕。我用UIViewController
而不是AVPlayerViewController
创建了这个屏幕,并用AVPlayerLayer
播放视频。
现在,我想在播放视频时使用Siri遥控器的语音命令,如"快进"或"他们说了什么?"。
我在谷歌上搜索了又搜索,但从来没有找到我该怎么做。
我可以在没有AVPlayerViewController
的情况下使用语音命令吗?如果是,如何?
以下是我在谷歌上搜索的一些链接来处理这个问题。https://developer.apple.com/documentation/avkit/avplayerviewcontrollerhttps://github.com/Lax/iOS-Swift-Demos/tree/master/MPRemoteCommandSample
到目前为止,我认为MPRemoteCommandCenter
、UIGestureRecognizer
或SiriKit
可能会有所帮助。。。
我使用MPRemoteCommandCenter
,可以使用Siri的语音命令。
样本来源在这里。https://github.com/Lax/iOS-Swift-Demos/tree/master/MPRemoteCommandSample