Giter Site home page Giter Site logo

distriqt / ane-audiorecorder Goto Github PK

View Code? Open in Web Editor NEW
9.0 5.0 2.0 11.42 MB

Audio Recorder Native Extension

Home Page: https://airnativeextensions.com/extension/com.distriqt.AudioRecorder

ActionScript 100.00%
actionscript ane adobe-air ios android airnativeextension as3

ane-audiorecorder's Introduction

built by distriqt //

AudioRecorder

AudioRecorder is an AIR Native Extension to record audio from the user's microphone to a file.

The simple API allows you to quickly integrate audio recording in your AIR application in just a few lines of code.

Features

  • Record from the device microphone to a native format
  • Start, progress and end events
  • Single API interface - your code works across supported platforms with no modifications
  • Sample project code and ASDocs reference

Documentation

Latest documentation can be found in the documentation site

Quick Example:

var file:File = File.applicationStorageDirectory.resolvePath( "recording.m4a" );

var options:AudioRecorderOptions = new AudioRecorderOptions();
options.filename = file.nativePath;
options.audioEncoding = AudioEncoder.AAC;

AudioRecorder.service.start( options );

More information here:

com.distriqt.AudioRecorder

License

You can purchase a license for using this extension:

airnativeextensions.com

distriqt retains all copyright.

ane-audiorecorder's People

Contributors

marchbold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ane-audiorecorder's Issues

Complete event not being triggered.

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:

  • AIR SDK version: 29
  • Device OS: Android
  • OS Version: Android 8

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?

ane audio recorder installation problems with apm

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.

Environment
  • AIR SDK version: 50.2.4.1
  • Device OS: WIN 10 Pro
  • Device version: 22H2
  • Development IDE: Animate
  • Development OS: app for android

AuthorisationStatus == UNKNOWN

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;
        }

m4a files are not playing back on iOS

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 behaviour

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 );
}
Actual behaviour

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

Environment
  • AIR SDK version: Harman Air Flex 4.16_ Air 50.2.3.2
  • Device OS: iPhone iOS 16.6, Simulator iOS 15
  • Device version: iPhone 11
  • Development IDE: intelijIdea 2021.2.1
  • Development OS: MacOS 12.0.1
Logs

Device logs if relevant

Logs

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

Storing files as mp3

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.

AudioRecorder.service.requestAuthorisation not working on iOS

Expected behaviour

Mic permission should work on iOS

Actual behaviour

On iOS 11.0.3 Asking permission doesn't works on iOS, the dialog is no been triggered.

Environment
  • AIR SDK version: 27
  • Device OS: iOS 11.0.3
  • Device version: iPhone 6
  • Development IDE: Flash Builder
  • Development OS: Mac OS

Recorded audio can only be loaded as a Netstream?

Expected behaviour

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.

Actual behaviour

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

Environment
  • AIR SDK version: 29
  • Device OS: Android and IOS
  • Device version: Android 8 and IOS 9

Please advice.

Unable to Play in iOS

Hi @marchbold ,

I did place everything as the docs:

  • Latest AIR
  • Latest Extension
  • Latest IOS

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.

AudioRecorder Android 64bit support

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.

is it experimental ios onyle plugin ?

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.