Detect volume change?

Discussion in 'iOS Programming' started by printz, Nov 5, 2013.

  1. printz macrumors regular

    Joined:
    Dec 23, 2012
    #1
    Is there a way to detect that the volume got changed, and call a method when so? I need to implement a custom slider that's NOT a MPVolumeView, that mirrors the system volume level.
     
  2. TouchMint.com macrumors 68000

    TouchMint.com

    Joined:
    May 25, 2012
    Location:
    Phoenix
  3. xArtx macrumors 6502a

    Joined:
    Mar 30, 2012
    #3
    You'd want to be googling some of this:
    Code:
        [[NSNotificationCenter defaultCenter] addObserver:self
                                    selector:@selector(handleVolumeChangedFromOutSideApp:)
                                        name:MPMusicPlayerControllerVolumeDidChangeNotification
                                      object: myPlayer];
    
    You don't need a private API for notification of volume change,
    that code is looking for presses of the volume buttons,
    which is different because you can't use them for any other purpose in an App.
     

Share This Page