[英]IOS Check if m3u8 stream is connected
I use MPMoviePlayerController
to play m3u8
stream. 我使用
MPMoviePlayerController
播放m3u8
流。 But it doesn't support me a method to check if the m3u8
link is working, so if the link is dead I must waiting for MPMoviePlayerController
playing a while to make sure that it's not working. 但是它不支持我检查
m3u8
链接是否正常的方法,因此,如果该链接m3u8
,则必须等待MPMoviePlayerController
播放一段时间以确保其不正常。 In this situation, I want to show an AlertView
if the link is dead to keep user from not waiting before send the link to MPMoviePlayerController
. 在这种情况下,我想显示一个
AlertView
如果链接AlertView
,以防止用户在将链接发送到MPMoviePlayerController
之前不等待。 Is there any way to do it ? 有什么办法吗?
Try this once.. 尝试一次。
Normally we check this after some time, for that we can set a time delay 通常我们会在一段时间后进行检查,为此我们可以设置时间延迟
[self performSelector:@selector(movieTimedOut) withObject:nil afterDelay:20.f];
-(void)movieTimedOut
{
if (!(self.loadState & MPMovieLoadStatePlayable) || !(self.loadState & MPMovieLoadStatePlaythroughOK))
{
//AlertView
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.