title: Get device output volume for iOS 7?
body: <p>I am working on iOS library for playing audio ads, I want to check if the device output volume is zero ( silent or muted) every time before requesting the ad.</p>
  
  <p>I have used the following codeAny  to check the output volume for the device</p>
  
  <pre><code>+(BOOL)isDeviceMuted
  {
      Float32 val = -1.0;
      UInt32 propertySize = sizeof(val);
      AudioSessionInitialize(NULL, NULL, NULL, NULL);
      AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareOutputVolume, &amp;propertySize, &amp;val);
  
      NSLog(@"value of volume: %f",val);
      if (val &lt;= 0) {
          return YES;
      }
      else {
          return NO;
      } 
  }
  </code></pre>
  
  <p>This code works perfect until now but the problem that AudioSessionGetProperty is deprecated on iOS 7 and I want to replace this code with new one that are not deprecated ( minimum iOS SDK is 6 )</p>
  
  <p>I have tried the following</p>
  
  <pre><code>val = [[AVAudioSession sharedInstance] outputVolume];
  </code></pre>
  
  <p>but the problem with outputVolume that it needs audio session to be active in order to track changes on it.</p>
  
  <pre><code>[[AVAudioSession sharedInstance] setActive: YES error: nil];
  </code></pre>
  
  <p>and we can't do that inside library since it will affect user application (sharedInstance)</p>
  
  <p>Any ideas !!</p>