Answer the question
In order to leave comments, you need to log in
How to control system sound in iOS (html5 + cordova)?
I am making an application on phonegap for iOS, the task is to play streaming audio. For these purposes, html5 is used, (everything is fine with this), in addition, you need to control the system sound from the application itself. I figured out how plugins are implemented on phonegap and more or less successfully filed my own, I can call a function from js and it normally accesses the phone’s system resources through the phonegap class, and this is where my stupor comes in. It is not clear what exactly is responsible for the system volume. tried like this (find out the current volume)
float vol = [[AVAudioSession sharedInstance] outputVolume];
NSLog(@"output volume: %1.2f dB", 20.f*log10f(vol+FLT_MIN));
Answer the question
In order to leave comments, you need to log in
I don’t understand your fongaps, but in cocoaotach it’s done like this:
Add to MediaPlayer.framework to the project, include it in the file:
#import "MediaPlayer/MediaPlayer.h"
// получаем значение
float volume = [MPMusicPlayerController applicationMusicPlayer].volume;
// устанавливаем
[[MPMusicPlayerController applicationMusicPlayer] setVolume:1.0];
super, everything worked! confuses that the volume parameter
float volume = [MPMusicPlayerController applicationMusicPlayer].volume
Judging by the docks, the status of Deprecated for ios7, although it gives the value of the norms, checked it on the device. Is this a threat in the future?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question