Ios 如何在mac的xcode中为AVPlayer制作音量滑块
因此,我有我的收音机应用程序的简单代码:Ios 如何在mac的xcode中为AVPlayer制作音量滑块,ios,xcode,macos,volume,avplayer,Ios,Xcode,Macos,Volume,Avplayer,因此,我有我的收音机应用程序的简单代码: -(IBAction)europaPlus:(id)sender{ NSLog(@"EuropaPlus work"); if (clicked == 0) { clicked = 1; NSString *urlAddress = @"http://cast.europaplus.ua/europaplus.aac"; NSURL *u
-(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操作系统中对AVPLAYER进行音量控制。我知道IOS中的MPMVolumeControl,但我有mac os项目。谢谢
player = [[AVAudioPlayer alloc] initWithContentsOfURL:
[NSURL fileURLWithPath:resourcePath] error:&err];
player.delegate = self;
[player play];
player.volume=.number;
player.numberOfLoops=-number;
有关更多信息,请查看以下链接: 及
-(IBAction)slidervaluechanged {
player.volume=slider.value;
}