我只是尝试播放苹果的 HLS 示例流。我的代码很简单:
- (IBAction)playHLS:(id)sender {
NSString* str = @"https://devimages.apple.com.edgekey.net/resources/http-streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8";
NSURL *url = [[NSURL alloc] initWithString:str];
MPMoviePlayerViewController *theMovie = [[MPMoviePlayerViewController alloc]
initWithContentURL: url];
[self presentMoviePlayerViewControllerAnimated:theMovie];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification object:theMovie];
}
调试显示 url 未正确初始化,原因是<invalid CFStringRef>
我在这里错过了什么?