How to make Progress bar? | developer.brewmp.com How to make Progress bar? | developer.brewmp.com

Developer

How to make Progress bar?

Forums:

Hi,

I need to display a progress bar in BREW, but I cannot find Gauge like function.
If anybody knows what I can use and how I can display progress bar, please help me.

Thanks.

Here is my way:
use a timer, caculate the progress percentage, and update the bar image.

Here is my way:
use a timer, caculate the progress percentage, and update the bar image.

One of the way to do this is -
create a rectangle - SETAEERECT() - this should be a sort of a thick horizontal line.
within that rectangle create another rectangle. This one is the one you will fill with some color based on the progress of the item you are monitoring.
Use IDISPLAY_FillRect() to fill the inner rectangle.
Somewhere just above the outer rectangle you may also want to have a Static text, showing the percentage of the progress bar.
It would be nice if there is J2ME like Gauge() class in BREW !

One of the way to do this is -
create a rectangle - SETAEERECT() - this should be a sort of a thick horizontal line.
within that rectangle create another rectangle. This one is the one you will fill with some color based on the progress of the item you are monitoring.
Use IDISPLAY_FillRect() to fill the inner rectangle.
Somewhere just above the outer rectangle you may also want to have a Static text, showing the percentage of the progress bar.
It would be nice if there is J2ME like Gauge() class in BREW !

You can use a IImage interface to give a long bitmap a progressbar affect

You can use a IImage interface to give a long bitmap a progressbar affect

arvind's method is probably best for progress bars. Using a bitmap requires too much overhead for such a simple task (unless you would like some sort of effect that can't be done with BREW API's alone).

arvind's method is probably best for progress bars. Using a bitmap requires too much overhead for such a simple task (unless you would like some sort of effect that can't be done with BREW API's alone).

arvind321 wrote:One of the way to do this is -
create a rectangle - SETAEERECT() - this should be a sort of a thick horizontal line.
within that rectangle create another rectangle. This one is the one you will fill with some color based on the progress of the item you are monitoring.
Use IDISPLAY_FillRect() to fill the inner rectangle.
Somewhere just above the outer rectangle you may also want to have a Static text, showing the percentage of the progress bar.
It would be nice if there is J2ME like Gauge() class in BREW !
Hi Arvind,
I am doing exactly the same as you have described here. So, How the progress percentage is calculated? I am new to BREW, so....
Can you please help me making this possible ? :)
Thanks in advance.

arvind321 wrote:One of the way to do this is -
create a rectangle - SETAEERECT() - this should be a sort of a thick horizontal line.
within that rectangle create another rectangle. This one is the one you will fill with some color based on the progress of the item you are monitoring.
Use IDISPLAY_FillRect() to fill the inner rectangle.
Somewhere just above the outer rectangle you may also want to have a Static text, showing the percentage of the progress bar.
It would be nice if there is J2ME like Gauge() class in BREW !
Hi Arvind,
I am doing exactly the same as you have described here. So, How the progress percentage is calculated? I am new to BREW, so....
Can you please help me making this possible ? :)
Thanks in advance.

To calculate the percentage you will have to know the total seconds of audio you are going to play.
You can calculare that by using something like this -
pct_played = (current_playback_position *100)/total_playback_time

To calculate the percentage you will have to know the total seconds of audio you are going to play.
You can calculare that by using something like this -
pct_played = (current_playback_position *100)/total_playback_time

arvind321 wrote:To calculate the percentage you will have to know the total seconds of audio you are going to play.
You can calculare that by using something like this -
pct_played = (current_playback_position *100)/total_playback_time
Hi Arvind,
Thanks a lot. I really appreciate your response. I will try this.
Now is there any API to get the total playback time or the current playback time? I know that my media file is a minute clip. But I am curious is there another way to get those ? I am reading ITimeCtl API. I believe its ITIMECTL_GetTime()...
Thanks in advance

arvind321 wrote:To calculate the percentage you will have to know the total seconds of audio you are going to play.
You can calculare that by using something like this -
pct_played = (current_playback_position *100)/total_playback_time
Hi Arvind,
Thanks a lot. I really appreciate your response. I will try this.
Now is there any API to get the total playback time or the current playback time? I know that my media file is a minute clip. But I am curious is there another way to get those ? I am reading ITimeCtl API. I believe its ITIMECTL_GetTime()...
Thanks in advance

IMEDIA_GetTotalTime().
You can tell the current play time from the MM_STATUS_TICK_UPDATE events in your media notification fn.

IMEDIA_GetTotalTime().
You can tell the current play time from the MM_STATUS_TICK_UPDATE events in your media notification fn.

mohlendo wrote:IMEDIA_GetTotalTime().
You can tell the current play time from the MM_STATUS_TICK_UPDATE events in your media notification fn.
Thanks , Max.
I will try this deffinately :)

mohlendo wrote:IMEDIA_GetTotalTime().
You can tell the current play time from the MM_STATUS_TICK_UPDATE events in your media notification fn.
Thanks , Max.
I will try this deffinately :)

Hi,
It seems that IMEDIA_GetTotalTime() is not working for my media file.
Code:
boolean CVideoObject::TotalMediaTime()
{
if (m_pIMedia)
{
IMEDIA_GetTotalTime(m_pIMedia);//total playback time
DBGPRINTF("total media time: %x", m_pIMedia);
}
else
{
DBGPRINTF("Media file not there");
return FALSE;
}
return TRUE;

I am always getting "Media file not there" . Any ideas?

Hi,
It seems that IMEDIA_GetTotalTime() is not working for my media file.
Code:
boolean CVideoObject::TotalMediaTime()
{
if (m_pIMedia)
{
IMEDIA_GetTotalTime(m_pIMedia);//total playback time
DBGPRINTF("total media time: %x", m_pIMedia);
}
else
{
DBGPRINTF("Media file not there");
return FALSE;
}
return TRUE;

I am always getting "Media file not there" . Any ideas?

mohlendo wrote:IMEDIA_GetTotalTime().
You can tell the current play time from the MM_STATUS_TICK_UPDATE events in your media notification fn.
Max,
So after IMEDIA_GetTotalTime, the event is returned to MM_STATUS_TICK_UPDATE ?? Cause in 3.1.4 SDK, the API says "This function results in MM_STATUS_DONE or MM_RESUME_ABORT status". Which one is correct?
I am calling IMEDIA_GetTotalTime() after IMEDIA_Play().
I am getting the result of IMEDIA_GetTotalTime() as "13 " [ time = IMEDIA_GetTotalTime(m_pIMedia);//total playback time ]. So it is EBADSTATE.
I am stuck. Please help. :confused:
Thanks in advance.

mohlendo wrote:IMEDIA_GetTotalTime().
You can tell the current play time from the MM_STATUS_TICK_UPDATE events in your media notification fn.
Max,
So after IMEDIA_GetTotalTime, the event is returned to MM_STATUS_TICK_UPDATE ?? Cause in 3.1.4 SDK, the API says "This function results in MM_STATUS_DONE or MM_RESUME_ABORT status". Which one is correct?
I am calling IMEDIA_GetTotalTime() after IMEDIA_Play().
I am getting the result of IMEDIA_GetTotalTime() as "13 " [ time = IMEDIA_GetTotalTime(m_pIMedia);//total playback time ]. So it is EBADSTATE.
I am stuck. Please help. :confused:
Thanks in advance.

No, they're two separate answers to your two questions.
You get the total time first (you can't call that while it's playing) then as you play the object, you can get the elapsed time. From these two values, you can figure out a % completion and fill in the progress bar appropriately. When I draw progress bars, I just use 3 rectangles...the outer "border" rectangle draws first, then the two inner rectangles to indicate completed and uncompleted.

No, they're two separate answers to your two questions.
You get the total time first (you can't call that while it's playing) then as you play the object, you can get the elapsed time. From these two values, you can figure out a % completion and fill in the progress bar appropriately. When I draw progress bars, I just use 3 rectangles...the outer "border" rectangle draws first, then the two inner rectangles to indicate completed and uncompleted.

Hi Max,
Thanks for your reply. So I got total media playback time as 58 sec. Now, I donot get how I can acquire the current playback position. I understand that i will get that from MM_STATUS_TICK_UPDATE and the typical update of current play back position is 1 sec. My question is How this MM_STATUS_TICK_UPDATE register callback is sent to my RegiterNotify fn? I mean What is the API that behaves like getting the total playback time? [like, IMEDIA_GetTotalTime() results in MM_STATUS_DONE or MM_CMD_GETTOTALTIME ] ... does this question make sense?
I tried to follow the eample of MediaPlayer, but it isn't working. What am I missing?
Stuck again :confused:
Thanks in advance.

Hi Max,
Thanks for your reply. So I got total media playback time as 58 sec. Now, I donot get how I can acquire the current playback position. I understand that i will get that from MM_STATUS_TICK_UPDATE and the typical update of current play back position is 1 sec. My question is How this MM_STATUS_TICK_UPDATE register callback is sent to my RegiterNotify fn? I mean What is the API that behaves like getting the total playback time? [like, IMEDIA_GetTotalTime() results in MM_STATUS_DONE or MM_CMD_GETTOTALTIME ] ... does this question make sense?
I tried to follow the eample of MediaPlayer, but it isn't working. What am I missing?
Stuck again :confused:
Thanks in advance.