如何创建一个使用 AVPlayer 流式传输互联网广播的简单 iPhone 应用程序?我遵循了 IOS 开发人员指南中的这个文档(https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/02_Playback.html),但是我没有得到结果。附上我的 .h 和 .m 文件。
#import "Bbcradio.h"
#import <AVFoundation/AVFoundation.h>
@implementation Bbcradio
- (IBAction)play:sender {
[player play];
}
self.player = [AVPlayer playerWithURL:@"http://bbc.co.uk/radio/listen/live/r1.asx"];
[player addObserver:self forKeyPath:@"status" options:0 context:&PlayerStatusContext];
@end
#import <UIKit/UIKit.h>
@class AVPlayerLayer;
@interface Bbcradio : UIView {
}
@property (nonatomic, readonly) AVPlayerLayer *playerLayer;
-(IBAction)play;
@end