首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AVFoundation NSURL没有显示正确吗?

AVFoundation NSURL没有显示正确吗?
EN

Stack Overflow用户
提问于 2012-08-10 09:38:51
回答 1查看 937关注 0票数 0

因此,我正在尝试使用苹果提供的http live stream示例来直播视频。程序可以编译,但是它不会在我的iphone上显示任何东西。代码如下:

谢谢。

代码语言:javascript
复制
  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];
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-08-10 09:50:47

查看这段苹果示例代码。这是在使用AVFoundation。

下面是我推荐的Apple的示例代码。

你只是想在它下面实现一些步骤,这段代码对你会很有帮助。

StitchedStreamPlayer

我上传到myServer测试过了。太完美了。还有Youtube,Vimeo等等。工作得很好。

请相信我。3G,wifi在两种环境下都经过测试。虽然是示例代码,但令人惊讶的是它工作得很完美。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11894347

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档