Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • increase and decrease iphone volume

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 867
    Comment on it

    If you want to increase the volume of iphone in a specific app and then reduce it to it's current volume. The following code might get helpful:- (NOTE:Include FrameWork: MediaPlayer.framework )

    -(void)exampleFuctionSample{

    NSLog(@"");

    [self increaseVolume];

    // Code

    [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(reduceVolumeToCurrent) userInfo:nil repeats:NO ]; // Timer will help you delay so that you can play increase volume

    }

    -(void)increaseVolume{

    NSLog(@"Entered Set Volume");

    float currentVolume=[MPMusicPlayerController applicationMusicPlayer].volume;

    NSLog(@"Current volume is %f",[MPMusicPlayerController applicationMusicPlayer].volume);

    float maxVolume = 1.0;

    [[MPMusicPlayerController applicationMusicPlayer] setVolume:maxVolume];

    }

    -(void)reduceVolumeToCurrent{

    NSLog(@"reduceVolumeToCurrent");

    [[MPMusicPlayerController applicationMusicPlayer]setVolume:currentVolume];

    }

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: