Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS上的livestreaming应用程序中出现错误849_Ios_Objective C_Iphone_Audio_Http Live Streaming - Fatal编程技术网

iOS上的livestreaming应用程序中出现错误849

iOS上的livestreaming应用程序中出现错误849,ios,objective-c,iphone,audio,http-live-streaming,Ios,Objective C,Iphone,Audio,Http Live Streaming,我正在为iOS应用程序开发livestream功能。我使用了包含在ContainerView中的AVPlayerViewController来显示视频 下面是ViewController的相关代码 @界面视图控制器() @属性MPMoviePlayerController*streamPlayer; @房地产市场; @结束 avplayervewcontroller*streamPlayer; @实现视图控制器 -(无效)viewDidLoad{ [超级视图下载]; self.isplay=否

我正在为iOS应用程序开发livestream功能。我使用了包含在ContainerView中的AVPlayerViewController来显示视频

下面是ViewController的相关代码

@界面视图控制器()
@属性MPMoviePlayerController*streamPlayer;
@房地产市场;
@结束
avplayervewcontroller*streamPlayer;
@实现视图控制器
-(无效)viewDidLoad{
[超级视图下载];
self.isplay=否;
NSURL*streamURL=[NSURL URLWithString:@”http://vevoplaylist-live.hls.adaptive.level3.net/vevo/ch1/appleman.m3u8"];
streamPlayer=[[UIStoryboard Storyboard Storyboard with name:@“Main”bundle:nil]实例化ViewController,其标识符:@“streamPlayer”];
streamPlayer.player=[AVPlayer playerWithURL:streamURL];
}
-(iAction)播放视频:(id)发件人{
如果(!self.isplay){
[streamPlayer.player play];
[self.button setTitle:@“停止”状态:uicontrol状态正常];
self.isPlaying=是;
}否则{
[streamPlayer.player暂停];
[self.button设置标题:@“播放”状态:uicontrol状态正常];
self.isplay=否;
}
}
(您可以忽略isplay变量。这只是为了看看我能控制什么)

流启动并正常工作几分钟,然后停止/缓冲(我认为)几秒钟,出现错误:

错误:849:AudioQueue:请求从包含21504帧的缓冲区修剪4291961269+0=4291961269帧
流在此之后继续,但没有音频

偶尔会有一两秒钟的音频,但错误会立即再次出现,流继续保持沉默。(播放斗牛犬视频时,我很高兴看到这一点。)

如果我暂停流,然后播放,音频会返回几分钟,然后再次消失

我已搜索此错误,但未找到任何帮助我修复此错误的内容。由于对iOS和HLS比较陌生,我不知道会出现什么问题,但如果我不得不猜测的话,我会说这是音频和视频同步的问题


非常感谢您的帮助。

代码中有两个问题非常突出

  • 您有两个
    streamPlayer
    变量
  • avplayervewcontroller
    变量应为全局变量
  • 通过将
    avplayervewcontroller
    属性声明作为全局变量放置在接口扩展中,错误应该得到解决

    代码如下所示:

    @interface ViewController ()
    
    @property (nonatomic) MPMoviePlayerController *mpStreamPlayer;
    @property (nonatomic) AVPlayerViewController *avStreamPlayer;
    
    @property (nonatomic) BOOL isPlaying;
    
    @end
    
    @implementation ViewController
    
    
    - (void)viewDidLoad ... // continue as expected
    

    我之所以认为它会得到解决,是因为社区成员遇到了类似的问题,出现了错误849(他们的代码库是SWIFT)和有效的答案。

    这可能与iOS 9错误有关,请将您的m3u8粘贴到Safari中,您可能会遇到同样的问题(中间音频中断,音频/视频不同步),您无法对代码执行任何操作

    看到一些报告,苹果工程师要求提交一份bug报告