【发布时间】:2017-11-09 12:20:26
【问题描述】:
我对流没有问题,但我不知道它何时缓冲或流何时结束。无论如何在Objective-C中确定这一点。我找到了音频解决方案,我什至尝试了 AVPlayerItemDidPlayToEndTimeNotification 但它不起作用。有什么建议?
NSString *url = liveStream.stream[@"cdn"];
dispatch_async(dispatch_get_main_queue(), ^{
AVPlayerItem *playerItem = [[AVPlayerItem alloc]
initWithURL:[NSURL URLWithString:url]];
[_player replaceCurrentItemWithPlayerItem:playerItem];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(itemDidFinishPlaying:) name:AVPlayerItemDidPlayToEndTimeNotification object:playerItem];
[_player play];
});
}
-(void)itemDidFinishPlaying:(NSNotification *) notification {
}
【问题讨论】:
标签: ios objective-c avplayer http-live-streaming