Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Posts: 66
Registered: ‎09-14-2011
My Device: Simulator
My Carrier: Developer

setTimeOut heavy on device

Hello community,

In my app i have to record audio

for that i'm using media.microphone

but at the same time i have to show timer and update progress bar (did progress bar using css)

What i did is when user click record button i start recording and i created a timer in javascript and updated it for every 500ms


var intervalTime = 500; //in milliseconds
var recordingTimer;

function onRecordPressed(){
	mic.record(fileName ,testSuccess, testError);

function onStopPressed(){

function recordingProgressUpdate(){
	if(!(recordingTimeElapsed >= maxTime)){
		recordingTimeElapsed += intervalTime/1000; //convert milli seconds to seconds
		var progress = parseInt((100/maxRime)*recordingTimeElapsed); // calculating % of completation
		recordingTimer = setTimeout("recordingProgressUpdate()",1000);

when i run this in simulator it is working fine

but when i ran it in device the device freezes ... even when i move track ball the focus isnt moving

i pressed back button nothing happened... it like the whole mobile hanged


so i increased the interval to 1000ms still having same problem


is there any way i can do this??

or can i connect progress bar to system time and update the progress bar??


when i comment recordingProgressUpdate() it is working fine... the app is recording and saving the file

so i guess the problem is in timer ...


any suggestions how i can update the progress bar constantly with time???