distriqt / ane-audiorecorder Goto Github PK
View Code? Open in Web Editor NEWAudio Recorder Native Extension
Home Page: https://airnativeextensions.com/extension/com.distriqt.AudioRecorder
Audio Recorder Native Extension
Home Page: https://airnativeextensions.com/extension/com.distriqt.AudioRecorder
It seems NetStream doesn't play back local audio files recorded by ANE using the default AudioRecorderOptions
.
Generally speaking, it's not an ANE issue, because the file is recording fine, but I can not find a way to play back the same file just recorded with ANE. So maybe the file can playback with a combination of codec and format defined in AudioRecorderOptions
other than in the example but I still was not able to find working one.
Expected that the code from the example with playing back m4a with NetStream working and is playing back m4a files
private function audioRecorder_completeHandler( event:AudioRecorderEvent ):void
{
var file:File = File.applicationStorageDirectory.resolvePath("recording.m4a");
if (_nc == null)
{
_nc = new NetConnection();
_nc.connect(null);
}
_ns = new NetStream( _nc );
_ns.client = new Object();
_ns.play( "file://"+file.nativePath );
}
It is playing back on Emulator but is not playing back on IPhone and IOS Simulator (I extracted recording.m4a recorded with ANE from iOS Simulator and put it in assets for isolating the problem)
On iOS Simulator and iPhone nothing happens after _ns.play( "file://"+file.nativePath );
Any error handlers or StremError
I've tried to run this code after NetConnection status ("NetConnection.Connect.Success")
The same, nothing happens on iOS
I've checked the value of file
variable and checked the folder in ApplicationStorage (through MacOS on Simulator).
The playing file exists in the location stored in file
variable.
I also tried to use
_ns.play( file.url );
instead of _ns.play( "file://"+file.nativePath );
Tried to set relative path _ns.play( "assets/recording.m4a");
Tried to playback other formats, like "mp3", "flv" etc. The same, is playing back on Emulator but not in iOS
Device logs if relevant
UPDATE:
I was able to playback only one FLV file encoded in the following format and codec. (not recorded with ANE)
the output of ffprobe:
Stream #0:0: Video: flv1, yuv420p, 320x240, 347 kb/s, 25 fps, 25 tbr, 1k tbn
Stream #0:1: Audio: mp3, 22050 Hz, mono, fltp, 64 kb/s
But there is no such combination of codec and format in supported recording options:
var options:AudioRecorderOptions = new AudioRecorderOptions();
options.outputFormat = ...
options.audioEncoding = ...;
AudioRecorder.service.start( options );
Format: MPEG-4, Codec: AAC:
Format: THREE_GPP, Codec: AMR_NB:
Format: MPEG-4, Codec: AAC_ELD:
Format: THREE_GPP, Codec: AMR_WB:
Format: WEBM, Codec: VORBIS:
But any of them is not playing back, only the mentioned one
Expected behaviour:
AudioRecorderEvent.COMPLETE to be triggered and play recorded sound.
Actual behaviour:
AudioRecorderEvent.COMPLETE not triggered. Trace in the complete handler not traced out.
private function audioRecorder_completeHandler( event:AudioRecorderEvent ):void
{
var file:File = File.applicationStorageDirectory.resolvePath("recording.m4a");
if (_nc == null)
{
_nc = new NetConnection();
_nc.connect(null);
}
_ns = new NetStream( _nc );
_ns.client = new Object();
trace("playing the sound?");
_ns.play( "file://"+file.nativePath );
}
I also got this error when I tried to trace out:
Error #3500: The extension context does not have a method with the name isSupported.
Environment:
Hi, I am trying out this ane for my project. I need to be able to play music and record it together with user's voice. Is it possible with this ane? I am trying to try this ane first with default example, but the complete even is not even triggered. Can you please advice?
Is there any way to store file as mp3, not m4a? My application is cross-platform (mobile device/web) and I already have mp3 converter but it is just toooo slow, this looks like a better solution, but m4a files are not html5 compatible.
Hi @marchbold ,
I did place everything as the docs:
The application requires authorization correctly, records and save. I can trace the file, see all the action but unable to hear when play back.
There are no errors, everything looks correctly flowing, any advise what else can check?
file = File.applicationStorageDirectory.resolvePath("recording.m4a");
var options: AudioRecorderOptions = new AudioRecorderOptions();
options.filename = file.nativePath;
options.audioEncoding = AudioEncoder.AAC;
AudioRecorder.service.start(options);
playAudio.addEventListener(MouseEvent.CLICK, fplayAudio);
function fplayAudio(e: MouseEvent): void {
trace("play audio");
playRecording(file);
removeEventListener(MouseEvent.CLICK, fplayAudio);
}
//////////
function playRecording(file:File): void {
{
if (file) {
trace("file exist");
if (_nc == null) {
_nc = new NetConnection();
_nc.connect(null);
}
_ns = new NetStream(_nc);
_ns.client = new Object();
_ns.play( "file://"+ file.nativePath );
trace('nativePath: ' + file.nativePath);
} else {
trace("ERROR: file doesn't exist");
}
}
}
TRACING////////
Record Audio
check auth
Record Audio
Auth in place, moving forward
audiorecorder:start
audiorecorder:progress
audiorecorder:progress
audiorecorder:progress
audiorecorder:progress
audiorecorder:progress
audiorecorder:progress
audiorecorder:progress
audiorecorder:progress
audiorecorder:progress
audiorecorder:progress
stopped audio
audiorecorder:complete
play audio
file exist
nativePath: /var/mobile/Containers/Data/Application/016600D6-A440-446B-A9D3-3FDE9DCF2D8F/Library/Application Support/xxx.xxx.xxx/Local Store/recording.m4a
Debug session terminated.
Update the extension to include support for Android 64bit
Starting August 1, 2019, your apps published on Google Play will need to support 64-bit architectures. 64-bit CPUs deliver faster, richer experiences for your users. Adding a 64-bit version of your app provides performance improvements, makes way for future innovation, and sets you up for devices with 64-bit-only hardware.
good morning. when in the terminal I put
apm generate app-descriptor src/MyApp-app.xml
to modify my descriptor file I get back:
Android package name: air.com.my.recorder_voice.
⣾ Android manifest merging.
RunConfig::ERROR: Failed to find bin\java.exe
E::RunConfig::Error #2037
E::ProcessQueue::Failed to find 'bin\java.exe' in JAVA_HOME=null. Point JAVA_HOME to your java installation.
generate/app-descriptor :: Failed to find 'bin\java.exe' in JAVA_HOME=null. Point JAVA_HOME to your java installation.
the problem may be that i have modified the sdk by changing the adt file (to create the aab file) and there i have put that JAVA_HOME points to an android folder. i don't know if this will affect the installation of java. if this will affect the installation of the ANE in terms of modifying my descriptor file.
Mic permission should work on iOS
On iOS 11.0.3 Asking permission doesn't works on iOS, the dialog is no been triggered.
Using AS3 default sound loader(or greensock LoaderMax) to load the recorded audio after it is saved in applicationStorageDirectory. Then play the sound with a sound channel.
Sound loader triggers no errors, in fact it triggered to completed event, which means it is successfully loaded. However, when played, it seemed that the sound ended immediately as sound complete event is triggered. Playing it with Netstream, does produce the recorded audio
Please advice.
is there any way ta record calls with this ANE ?
in Android devices ( I have Android 8) with Air32(116)
I don't see requesting authorisation when I lunch my app and setup your configuration
also when I call AudioRecorder.service.authorisationStatus() I get UNKNOWN status and it doesn't work even when I enable this microphone permission manually !
these are my ANE's
<extensions>
<extensionID>com.digitalstrawberry.ane.deviceUtils</extensionID>
<extensionID>com.distriqt.androidsupport.V4</extensionID>
<extensionID>com.distriqt.AudioRecorder</extensionID>
<extensionID>com.distriqt.Core</extensionID>
<extensionID>com.distriqt.NetworkInfo</extensionID>
</extensions>
and this is my config codes :
public static function setUp():Boolean {
if (AudioRecorderClass != null)
return true;
try {
AudioRecorderClass = getDefinitionByName("com.distriqt.extension.audiorecorder.AudioRecorder") as Class;
AudioRecorderOptionsClass = getDefinitionByName("com.distriqt.extension.audiorecorder.AudioRecorderOptions") as Class;
AuthorisationStatusClass = getDefinitionByName("com.distriqt.extension.audiorecorder.AuthorisationStatus") as Class;
trace("\n\n\n\n\n\n\n*************************** Distriqt recorder is supports ****************************\n\n\n\n\n\n\n");
if (logger)
SaffronLogger.log("\n\n\n\n\n\n\n*************************** Distriqt recorder is supports ****************************\n\n\n\n\n\n\n");
} catch (e) {
AudioRecorderClass = null;
AudioRecorderOptionsClass = null;
AuthorisationStatusClass = null;
trace("\n\n\n\n\n\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Distriqt recorder is NOT supports !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n\n\n\n\n");
if (logger)
SaffronLogger.log("\n\n\n\n\n\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Distriqt recorder is NOT supports !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n\n\n\n\n");
return false;
}
switch (AudioRecorderClass.service.authorisationStatus()) {
case AuthorisationStatusClass.AUTHORISED:
trace("authorised");
if (logger)
SaffronLogger.log("authorised");
break;
case AuthorisationStatusClass.SHOULD_EXPLAIN:
case AuthorisationStatusClass.NOT_DETERMINED:
AudioRecorderClass.service.addEventListener(AuthorisationEventClass.CHANGED, authChangedHandler);
AudioRecorderClass.service.requestAuthorisation();
break;
case AuthorisationStatusClass.DENIED:
case AuthorisationStatusClass.RESTRICTED:
case AuthorisationStatusClass.UNKNOWN:
trace("denied or restricted");
if (logger)
SaffronLogger.log("denied or restricted");
}
return true;
}
is this a free ane or just a beta testing public repo
we did not find this plugin on airnativeextensions.com
we might need such plugin in near future. but we need it on both platforms
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.