因此,我正在尝试使用苹果提供的http live stream示例来直播视频。程序可以编译,但是它不会在我的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];发布于 2012-08-10 09:50:47
查看这段苹果示例代码。这是在使用AVFoundation。
下面是我推荐的Apple的示例代码。
你只是想在它下面实现一些步骤,这段代码对你会很有帮助。
StitchedStreamPlayer
我上传到myServer测试过了。太完美了。还有Youtube,Vimeo等等。工作得很好。
请相信我。3G,wifi在两种环境下都经过测试。虽然是示例代码,但令人惊讶的是它工作得很完美。
https://stackoverflow.com/questions/11894347
复制相似问题