【问题标题】:How to play videos from a URL into an iphone app with buffering?如何将视频从 URL 播放到带有缓冲的 iphone 应用程序中?
【发布时间】:2011-05-16 05:46:20
【问题描述】:

我有一个需要从 URL 播放视频的 iphone 应用程序。

我不想下载整个视频,因为它最终会减慢我的应用程序。

我想以一种在中间缓冲然后播放的方式播放视频。

如何将视频从 URL 播放到带缓冲的 iphone 应用程序中?

【问题讨论】:

    标签: iphone objective-c cocoa-touch ios4


    【解决方案1】:

    像这样尝试......

    NSString *url = @"www.youtube.com/xyz";
    NSString *htmlString =[NSString stringWithFormat:@"<object width='212' height='172'><param name='movie' value='%@'></param><param name='wmode' value='transparent'></param><embed src='%@'type='application/x-shockwave-flash' wmode='transparent' width='980' height='965'></embed></object>",url,url];
    
    [myWebview loadHTMLString:htmlString baseURL:nil];
    

    【讨论】:

    • 你确定这会运行带有缓冲的视频吗?
    • 这对我不起作用。它只是在 webView 中显示一个空白屏幕。什么都没有显示。
    • @ParthBhatt 回答可能为时已晚。但仅供参考,这仅适用于设备,因为 iPhone 模拟器不支持闪存。
    • 不想使用uiwebview怎么办?
    【解决方案2】:

    你有自己的流媒体服务器吗?

    那么,

    NSURL *url = [NSURL URLWithString: @"http://STREAMING URL"];
    [myMPMoviePlayerController setContentURL: url];
    [myMPMoviePlayerController play];
    

    【讨论】:

      猜你喜欢
      • 2012-06-24
      • 2019-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-01
      • 2011-04-25
      • 1970-01-01
      相关资源
      最近更新 更多