菜鸟教程小白 发表于 2022-12-12 16:45:39

ios - 如何将 NSInputStream 传递给 MPMoviePlayerController?


                                            <p><p>我有一个 <code>NSInputStream</code> 对象形式的视频,我用它来写入数据。我知道 <code>MPMoviePlayerController</code> 可以使用 <code>NSURL</code> 接收文件位置,但我想知道它是否提供从 <code>NSInputStream</code> 读取字节的功能,或者如何实现?</p>

<p>我听说过如何使用 <code>NSURLProtocol</code> 来设置自定义协议(protocol)来执行此类操作,但我没有看到任何具有可读代码的示例。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我担心这是不可能的。初始化方法</p>

<pre><code>- (id)initWithContentURL:(NSURL *)url
</code></pre>

<p>需要一个<em>文件</em> URL。所以,我们不能确定 MPMoviePlayerController 会使用 URL 加载系统。很可能它正在使用文件管理器 API。</p>

<p>首选的 API 是(无论如何):</p>

<pre><code>- (id)initWithStream:(NSInputStream*)inputStream;
</code></pre>

<p>我建议向 Apple 提出改进请求。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何将 NSInputStream 传递给 MPMoviePlayerController?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/20196679/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/20196679/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何将 NSInputStream 传递给 MPMoviePlayerController?