且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Apple TV 的 tvOS 上播放视频?

更新时间:2023-12-03 18:24:22

我刚刚将您的代码粘贴到了我的 tvOS 示例项目中,替换了 URL 并运行了它.

I just pasted your code in my tvOS sample project, replaced the URL and ran it.

什么都没发生.好吧,除了有一个日志条目告诉我 App Transport Security 阻止了我的 URL 请求.

Nothing happened. Well, except for the fact that there's a log entry telling me that App Transport Security has blocked my URL request.

所以我前往 Info.plist,禁用 ATS,下次启动时视频显示正常.

So I headed to the Info.plist, disabled ATS and upon next launch the video showed up just fine.

因此,如果您还使用非 HTTPS 网址,则很可能会遇到此问题,通过使用 HTTPS 网址、完全禁用 ATS 或在您的 Info.plist 中允许特定的非 HTTPS 网址可以轻松解决此问题.

So if you're also using a non-HTTPS URL you're very likely running into this issue which is easily fixed by either using an HTTPS URL, disabling ATS completely or allowing specific non-HTTPs URLs in your Info.plist.

P.S.:我使用此视频进行测试.

P.S.: I used this video for testing.