Skip to content

m4a files are not playing back on iOS #11

@ushan

Description

@ushan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions