ios - 在 WatchOS 2 中从 URL 播放视频
<p><p>最近,Apple® 为其 Apple Watch® 发布了第二个操作系统。通过此次更新,Apple Watch® 现在可以自行处理 HTTP 请求和互联网连接。他们添加了</p>
<pre><code> WKInterfaceMovie
</code></pre>
<p>使用方法从 url 加载视频</p>
<p>"
- 设置电影网址:
声明(watchOS 2.0 中的新功能)</p>
<p> swift </p>
<pre><code>func setMovieURL(_ URL: NSURL)
</code></pre>
<p> objective-C </p>
<pre><code>- (void)setMovieURL:(NSURL * _Nonnull)URL
</code></pre>
<p>"</p>
<p>如果我输入带有任何 .mov 在线视频的 URL。 WKInterfaceMovie 会自动关闭。有时会出现“下载”圈并开始加载,但我无法显示远程视频(未存储在 Apple Watch® 中)</p>
<p>如果有人能帮助我,我会很惊讶。</p>
<p>谢谢</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>它仅适用于 <strong>https 网址</strong>,与应用传输安全 (ATS) 设置无关。</p>
<p>来源 <a href="https://developer.apple.com/library/watchos/documentation/WatchKit/Reference/WKInterfaceController_class/index.html#//apple_ref/occ/instm/WKInterfaceController/presentMediaPlayerControllerWithURL:options:completion:" rel="noreferrer noopener nofollow">WatchKit Framework Reference</a> :</p>
<blockquote>
<p>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.</p>
</blockquote></p>
<p style="font-size: 20px;">关于ios - 在 WatchOS 2 中从 URL 播放视频,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/31643946/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/31643946/
</a>
</p>
页:
[1]