在WatchOS 2中播放来自URL的视频 [英] Play Video From URL in WatchOS 2
问题描述
最近Apple®为其AppleWatch®发布了第二个操作系统。通过此更新,AppleWatch®现在可以自己拥有HTTP请求和Internet连接。他们添加了
So recently Apple® released the second operating system for their Apple Watch®. With this update, Apple Watch® can now have HTTP requests and internet connection by itself. They added the
WKInterfaceMovie
使用方法从网址加载视频
Which loads a video from a url with the method
- setMovieURL:
声明(watchOS 2.0新增功能) )
" - setMovieURL: Declaration (New in watchOS 2.0)
SWIFT
func setMovieURL(_ URL: NSURL)
OBJECTIVE-C
OBJECTIVE-C
- (void)setMovieURL:(NSURL * _Nonnull)URL
如果我在线输入任何.mov视频的网址。 WKInterfaceMovie自动关闭。有时下载圈出现并开始加载,但我无法显示远程视频(未存储在AppleWatch®中)
If I input a URL with any .mov video online. The WKInterfaceMovie closes automatically. Sometimes the "Downloading" circle comes and begins to load up but I haven't been able to show up the remote video (Not stored in the Apple Watch®)
I如果有人可以帮助我,我会感到惊讶。
I would be amazed if someone can help me.
谢谢
推荐答案
无论应用传输安全(ATS)设置如何,它仅适用于 https网址。
It only works with https URLs, regardless of the App Transport Security (ATS) settings.
来源 WatchKit Framework Reference :
如果在远程服务器上指定文件的URL,则此方法首先下载文件并显示进度指示器运作的进展。由于WatchKit在从Web服务器下载文件时使用App Transport Security(ATS),因此该文件必须位于安全服务器上,并且URL必须使用https方案。如果您的服务器不支持ATS级别的安全性,请在播放前自行下载该文件。
If you specify a URL for a file on a remote server, this method downloads the file first and displays a progress indicator showing the progress of the operation. Because WatchKit uses App Transport Security (ATS) when downloading files from a web server, the file must be on a secure server, and the URL must use the https scheme. If your server does not support ATS–level security, download the file yourself before playing it.
这篇关于在WatchOS 2中播放来自URL的视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!