How to make volume slider for AVPlayer in xcode for mac

so I have my simple code for my radio application:

 -(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;

        }
}

Also I used AVPLAYER only for connection by URL, but how to adjust the volume of AVPlayer in MAC OS. I know about MPMVolumeControl on iOS, but I have mac os project.Thanks.

0
source share
1 answer
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; 

}

check the links for more information:

http://developer.apple.com/iphone/library/documentation/MediaPlayer/Reference/MPVolumeView_Class/Reference/Reference.html and How do you implement MPVolumeView?

0
source

All Articles