所以我正在尝试使用苹果提供的 http 直播流示例直播视频。该程序可以编译,但它不会在我的 iPhone 上显示任何内容。下面是代码:
谢谢你。
NSURL *url = [NSURL URLWithString:@"<#http://developer.apple.com/resources/http-streaming/examples/advanced-stream.html#>"];
/*
// You may find a test stream at <http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8>.
self.playerItem = [AVPlayerItem playerItemWithURL:url];
[playerItem addObserver:self forKeyPath:@"status" options:0 context:&ItemStatusContext];
self.player = [AVPlayer playerWithPlayerItem:playerItem];
*/
/*
self.player = [AVPlayer playerWithURL:url];
[player addObserver:self forKeyPath:@"status" options:0 context:&PlayerStatusContext];
*/
self.playerItem = [AVPlayerItem playerItemWithURL:url];
//(optional) [playerItem addObserver:self forKeyPath:@"status" options:0 context:&ItemStatusContext];
self.player = [AVPlayer playerWithPlayerItem:playerItem];
self.player = [AVPlayer playerWithURL:url];
[player play];
[super viewDidLoad];