floatinghotpot / cordova-plugin-nativeaudio

The low latency audio plugin is designed to enable low latency and polyphonic audio from Cordova/PhoneGap applications, using a very simple and basic API.
MIT License
235 stars 288 forks source link

Simple Audio volume is based on ringer volume in iOS 8 #45

Open Montoya opened 9 years ago

Montoya commented 9 years ago

I've noticed that the volume level this plugin uses is based on the ringer volume and not the audio volume in iOS 8. So when I press the volume up/down hardware buttons on my phone, if they are currently raising / lowering the audio volume, the volume of the plugin isn't affected. I can then hit the home button, open the app again and hit the volume buttons again, and now if the ringer volume is the one changing, then the plugin volume changes with it.

It seems like this is intended use but I'm worried that this will be confusing to users. Do most games' audio follow the audio or ringer volume on iOS 8?

Montoya commented 9 years ago

Bump? Any advice? Do I need to play a complex audio track at the beginning just to get the regular audio volume controls working?

Montoya commented 9 years ago

Looks like this is the same problem mentioned in issues #23 & #32 and the solution will have to be using preloadComplex instead of simple.

pavei commented 7 years ago

Did you solve this? I'm trying to do this with the code above and still not working


    $cordovaNativeAudio
      .preloadComplex(audioName, 'app-data/sounds/' + audioName + '.mp3', 1, 1)
      .then(function (msg) {
        console.log(msg);
      }, function (error) {
        alert("Deu erro ao dar load");
        console.log(error);
      });

    $cordovaNativeAudio.setVolumeForComplexAsset(audioName, 1);

    $timeout(function () {
      $cordovaNativeAudio.play(audioName);
    }, 100);