cordova-plugin-media
cordova-plugin-media copied to clipboard
Add option to change Sampling- and Bitrate
The default sound quality is really bad (8kHz sampling rate).
Please add an option to let us change the EncodingBitRate and SamplingRate.
Android Example:
this.recorder.setAudioEncodingBitRate(192000);
this.recorder.setAudioSamplingRate(44100);
I really need this too, on android it is horrific! Ios is pretty good, no quality loss..
https://github.com/remoorejr/cordova-plugin-media-with-compression
PR's welcome. Also a crossref to #255
On which place in the Code i have to put it in?
"this.recorder.setAudioEncodingBitRate(192000); this.recorder.setAudioSamplingRate(44100);"
Hardcoded(!)
In the source code:
/src/android/AudioPlayer.java:169
or compiled:
/platforms/android/app/src/main/java/org/apache/cordova/media/AudioPlayer.java:156
add these lines:
this.recorder.setAudioEncodingBitRate(128000); //128 kbit/s
this.recorder.setAudioSamplingRate(44100); //44.1 kHz
/src/ios/CDVSound.m:694
or compiled:
\platforms\ios\xxx\Plugins\cordova-plugin-media\CDVSound.m:690
change these lines:
NSMutableDictionary *audioSettings = [NSMutableDictionary dictionaryWithDictionary:
@{AVSampleRateKey: @(44100),
AVEncoderBitRateKey : @128000,
AVNumberOfChannelsKey: @(1),
}];