【问题标题】:How to play m3u8 audio file?如何播放 m3u8 音频文件?
【发布时间】:2012-03-29 09:34:51
【问题描述】:

我有一个 URL (http://ms1.clickhere2.com:1935/live/power98/playlist.m3u8),想在 iPhone 上玩 m3u8 格式,有人能帮忙吗,我用过 MPMEDIAPLAYER 框架和其他东西。

【问题讨论】:

标签: iphone objective-c m3u8


【解决方案1】:

试试这样:

NSString *path =[[NSString alloc] initWithString:@"http://stream.alayam.com/alayam/alayam/playlist.m3u8"];



NSURL *audioUrl=[NSURL URLWithString:path];

MPMoviePlayerController *player =  [[MPMoviePlayerController alloc] initWithContentURL:audioUrl];
[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(loadStateDidChange:)                                                 name:MPMoviePlayerLoadStateDidChangeNotification 
                                           object:player];
if ([player respondsToSelector:@selector(loadState)]) 
{
    [player setControlStyle:MPMovieControlModeVolumeOnly];
    [player setFullscreen:YES];
    [player prepareToPlay];
}   

【讨论】:

  • 在 iOS10 中贬值的 MPMoviePlayerController 改用 AVFoundation。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-03-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-09-17
  • 2018-02-03
相关资源
最近更新 更多