所以我有我的收音机应用程序的简单代码:
-(IBAction)europaPlus:(id)sender{
NSLog(@"EuropaPlus work");
if (clicked == 0) {
clicked = 1;
NSString *urlAddress = @"http://cast.europaplus.ua/europaplus.aac";
NSURL *urlStream = [NSURL URLWithString:urlAddress];
radioPlus = [[AVPlayer alloc] initWithURL:urlStream];
[radioPlus play];}
else {
NSLog(@"EuropaPlus not work");
[radioPlus release];
clicked = 0;
}
}
此外,我仅将 AVPLAYER 用于 URL 连接,但如何在 MAC OS 中为 AVPlayer 进行音量控制。我知道 IOS 中的 MPMVolumeControl,但我有 mac os 项目。谢谢。