1 mpmovieplayercontroller video-streaming mpmovieplayer ios4
我将小型电影(1-3MB)从我的网站流式传输到我的iPhone应用程序中.我有一个slicehost网络服务器,我认为这是一个"500MB切片".我不确定这会如何转化为带宽,但我可以在以后解决这个问题.
我对MPMoviePlayerLoadStateDidChangeNotification的体验不是很好.使用旧的MPMoviePlayerContentPreloadDidFinishNotification,我获得了更可靠的结果
如果我得到一个MPMoviePlayerContentPreloadDidFinishNotification,电影将播放没有口吃,但如果我使用MPMoviePlayerLoadStateDidChangeNotification,电影经常停止.
我不确定检查哪种加载状态:
枚举{MPMovieLoadStateUnknown = 0,MPMovieLoadStatePlayable = 1 << 0,MPMovieLoadStatePlaythroughOK = 1 << 1,MPMovieLoadStateStalled = 1 << 2,};
MPMovieLoadStatePlaythroughOK似乎是我想要的(基于文档中的描述):
MPMovieLoadStatePlaythroughOK
Enough data has been buffered for playback to continue uninterrupted.
Available in iOS 3.2 and later.
Run Code Online (Sandbox Code Playgroud)
但是在我的应用中,负载状态永远不会设置为此状态.
我错过了什么吗?有一个更好的方法吗?
只是确保你注意到它是一面旗帜而不是价值?
MPMoviePlayerController *mp = [aNotification object];
NSLog(@"LoadState: %i", (NSInteger)mp.loadState);
if (mp.loadState & MPMovieLoadStatePlaythroughOK)
{
// Do stuff
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1850 次 |
| 最近记录: |