如何在iOS中播放.m3u8或.ts文件? [英] How to play .m3u8 or .ts file in iOS?

查看:7568
本文介绍了如何在iOS中播放.m3u8或.ts文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在 xCode 4.5.1 中创建一个 iOS 应用程序。



此应用的主要目的是播放 .m3u8 视频文件。



添加一个.m3u8文件与所有段(.ts)在我们的本地资源束。
所以,如何使用 MPMoviePlayerController 在本地播放这个文件UIWebView



而且,我们可以在从服务器下载后修改或不修改这个文件吗?



如果可能的话怎么办? / p>

告诉我,任何已知的...

解决方案

将只能够播放HLS内容,如果它是通过HTTP服务。所以你应该在一个线程中运行一个简单的http服务器,然后将本地URL传递给 MPMoviePlayerController 。网址看起来像 http:// localhost:8080 / file.m3u8 ,视频播放器将从另一个线程中运行的http服务器读取流。



这里有一个关于在iOS上运行webserver的问题,可能会帮助你: iPhone HTTP Server


I have create one iOS application in xCode 4.5.1.

The main purpose of this applciation is the playing .m3u8 video file.

I have add one .m3u8 file with all segment(.ts) in our local resource bundle. So, how to play this file in iPhone locally using MPMoviePlayerController or UIWebView?

And, Can we modify or not this file after the download from the server?

If possible then how to do it?

pls tell me, any one known...

解决方案

You will only be able to play the HLS content if it's being served over HTTP. So you should run a simple http server in one thread, and then pass the local URL to MPMoviePlayerController. The URL will look like http://localhost:8080/file.m3u8 and the video player will read the stream from the http server you have running in another thread.

Here is a question about running a webserver on iOS that might help you along: iPhone HTTP Server

这篇关于如何在iOS中播放.m3u8或.ts文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆