Copy link to clipboard
Copied
Hi All,
It appears that using the Microphone class is freezing my Flex mobile app. I provide code below but here's an overview:
My app is a language learning app, and recording and playback of the user's voice is an important feature. It allows the user to hear how well their pronunciation matches that of a native speaker. When record/playback is turned on the app repeatedly plays some audio, records the user's voice, plays it back, plays more audio, etc. In other words, it includes functionality similar to the minimal case code that I'm including here. Users often use this functionality 30 minutes or longer. So this is a problem.
Am I doing something wrong in my code? Just checking before I report this as a bug.
You can download an FXP from here if you're interested:
http://www.brightworks.com/downloads/RecordingTest.fxp
Or, the important code is below. This is from the example app's (only) view.
Thanks,
Douglas
Douglas McCarroll
Brightworks, Inc.
320.300.0220
<?xml version = "1.0" encoding = "utf-8"?>
<s:View xmlns:fx = "http://ns.adobe.com/mxml/2009"
xmlns:s = "library://ns.adobe.com/flex/spark"
creationComplete = "onCreationComplete()"
title = "Recording Test">
<fx:Declarations>
</fx:Declarations>
<fx:Script>
<![CDATA[
private var _isRecording:Boolean;
private var _iterationCount:uint = 0;
private var _microphone:Microphone;
private var _recordedSeconds:uint = 0;
private var _timer:Timer;
private function onCreationComplete():void
{
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
}
private function doNextPhase(event:TimerEvent = null):void
{
_isRecording = !_isRecording;
if (_isRecording)
{
_iterationCount++;
displayOutput("Recording");
_microphone = Microphone.getMicrophone();
_microphone.rate = 44;
_microphone.gain = 50;
_microphone.setSilenceLevel(0, 2000);
_microphone.addEventListener(SampleDataEvent.SAMPLE_DATA, onNewRecordingSampleData);
}
else
{
_recordedSeconds += 5;
displayOutput("Pausing");
_microphone.removeEventListener(SampleDataEvent.SAMPLE_DATA, onNewRecordingSampleData);
_microphone = null;
}
}
private function onNewRecordingSampleData(event:SampleDataEvent):void
{
}
private function displayOutput(phase:String):void
{
var freeMemoryMB:int = Math.round(System.freeMemory / (1024 *1024));
var privateMemoryMB:int = Math.round(System.privateMemory / (1024 *1024));
var totalMemoryNumberMB:int = Math.round(System.totalMemoryNumber / (1024 *1024));
phaseLabel.text = "Phase: " + phase;
iterationLabel.text = "Iteration: " + _iterationCount;
recordedSecondsLabel.text = "Recorded Seconds: " + _recordedSeconds;
freeMemoryLabel.text = "System.freeMemory MB: " + freeMemoryMB;
privateMemoryLabel.text = "System.privateMemory MB: " + privateMemoryMB;
totalMemoryNumberLabel.text = "System.totalMemoryNumber MB: " + totalMemoryNumberMB;
}
private function startTimer():void
{
_timer = new Timer(5000, 0);
_timer.addEventListener(TimerEvent.TIMER, doNextPhase);
_timer.start();
}
private function onStartRecordingButtonClick():void
{
if ((Microphone.getMicrophone()))
{
startRecordingButton.enabled = false;
startTimer();
doNextPhase();
}
else
{
phaseLabel.text = "No Mic Available";
}
}
]]>
</fx:Script>
<s:VGroup height = "100%"
width = "100%"
paddingBottom = "20"
paddingLeft = "20"
paddingRight = "20"
paddingTop = "20">
<s:Label id = "phaseLabel"
width = "100%" />
<s:Label id = "iterationLabel"
width = "100%" />
<s:Label id = "recordedSecondsLabel"
width = "100%" />
<s:Label id = "freeMemoryLabel"
width = "100%" />
<s:Label id = "privateMemoryLabel"
width = "100%" />
<s:Label id = "totalMemoryNumberLabel"
width = "100%" />
</s:VGroup>
<s:HGroup width = "100%"
horizontalAlign = "center"
bottom = "10">
<s:Button id = "startRecordingButton"
label = "Start Recording"
click = "onStartRecordingButtonClick()"
width = "60%" />
</s:HGroup>
</s:View>
The issue has been solved with 3.8.0.730 !
http://forums.adobe.com/message/5399512#5399512 😉
Thanks Adobe!
Copy link to clipboard
Copied
We have been able to reproduce the issue. Could you please open a new bug report on this over at bugbase.adobe.com? When adding the bug please add the SDK , iOS version you are using? Once added, please post back with the bug URL/number so that other can affected.
Regards,
Nimit
Copy link to clipboard
Copied
> We have been able to reproduce the issue.
Great!
> please open a new bug report
Done...
Copy link to clipboard
Copied
We are exeperiencing the same exact bug! It's very critical for us as we are working on a karaoke project for a client! I have voted for the bug. Please fix as soon as possible! Thanks.
Copy link to clipboard
Copied
I'm bumping this thread in hopes that others who are having problems with their app freezing when the use the Microphone class in AIR for iOS/iPhone will notice, and vote for the bug that I've filed.
https://bugbase.adobe.com/index.cfm?event=bug&id=3560896
This is a big problem.
Copy link to clipboard
Copied
hello,
We have the same issue here. We have tried with AIR 3.5 and it seems not to freeze with this version (3.5.0.600 to be precise).
Copy link to clipboard
Copied
I don't have 3.5.0.600, but I have 3.5.0.1060. I've tried it and it appears to, if anything, make the problem worse.
Also, in any case, I have to use 3.6 so that I can target iPhone 5 (see http://forums.adobe.com/thread/1198630). Perhaps, if one is only targeting iPad, one can use 3.5 as a workaround, but otherwise 3.5 isn't really an option, right?
Copy link to clipboard
Copied
well this might be good news after all 😉 The issue could have been added between AIR 3.5.0.600 and 3.5.0.1060 then!
You have to use AIR 3.7 to submit an app to the App Store because it uses iOS SDK 6.1 which is mandatory now.
See http://globz.com/tmp/AIR_iOS_sdk.jpg for the AIR/iOS SDKs.
Copy link to clipboard
Copied
The issue has been solved with 3.8.0.730 !
http://forums.adobe.com/message/5399512#5399512 😉
Thanks Adobe!
Copy link to clipboard
Copied
Thanks, globzie, for mentioning this. I've now subscribed to the "announcements" forum, but I wasn't aware of the fix.
And, I'm happy to report that this fix is also working for me.
Thanks Adobe!