Skip to main content

Video playback/repaints

16 replies [Last post]
Anonymous

Hi,

I'm writing a video player application, on the top of the screen there
is the player (mmapi) , just below the control bar and below that some
other info.
I created three custom components, one with the size of the player
that is placed in BorderLayout.NORTH, the other are in CENTER and
SOUTH.

Now when the user presses the UP key I change the volume of the player
and do a setVolume on the center component:

public void setVolume(int volume) {
this.volume = volume;
repaint();
}

public void paint(Graphics g) {
g.setColor(0x6666AA);
LOGGER.info("paint "+getWidth()+"x"+getHeight());
g.fillRect(getX(), getY(), getWidth(), getHeight());
paintVolume(g);
}

Now the problem is that the repaint() call forces a whole screen
update. The player keeps playing (sound) but it is not visible any
more because it has been overpainted. (SE 660i)
Pausing the player and resuming playback brings the player back. Our
nokia S40 phones don't have this issue, their player seems to stay on
top of the Canvas. I suppose the SE phones use some color that will be
replaced by the player pixes by the gfx system?

Is there a way to indicate lwuit should never repaint the part of the
screen where the player is located?

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Francis De Brabandere

On Tue, Jul 1, 2008 at 4:13 PM, chen wrote:
> Hi,
> You can override the repaint() method and hold some sort of flag that
> indicates for you if a player is playing,
> If you won't fwd the call to super.repaint() your component won't be
> refreshed.

but I need the component to be refreshed, it's just the top component
that should not be refreshed. I just want an area of the form that is
reserved for the player (the top half) and never touched by lwuit. The
other half of the form should be usable by the user while the player
is playing.

I still have the impression I'm not clearly explaining what my problem
is. I'll try the MediaComponent and see if it has the same problem.

> For ex:
>
> public void repaint(){
> if(playerPlaying){
> super.repaint();
> }
> }
>
> Regards,
> Chen
>
>
> Francis De Brabandere wrote:
>>
>> To be more clear, the top component (where the player will be put over
>> by the mmapi) should have a black background but never be painted
>> again when a player is playing. The lwuit back buffer should never
>> overwrite that part of the screen when other components on the form
>> request a repaint.
>> The top component only has a function as placeholder for the mmapi
>> VideoPlayer, but I want it to be black when no Player is shown yet.
>>
>> On Tue, Jul 1, 2008 at 1:57 PM, Francis De Brabandere
>> wrote:
>>
>>>
>>> On Tue, Jul 1, 2008 at 1:40 PM, chen wrote:
>>>
>>>>
>>>> Hi,
>>>> Are you using the MediaComponent? in any case painting on top of the
>>>> video
>>>> is not something I would recommend, since this makes your application
>>>> dependent on the device mmapi implementation.
>>>>
>>>
>>> Well that is exactly what I don't want to do, there is no way to paint
>>> on top of the video, my controls component is below (not behind) the
>>> video component, like this:
>>>
>>> video comp
>>> ---------------
>>> control comp
>>> ---------------
>>> info comp
>>>
>>> When the user presses the up button I want the volume indication in
>>> the control comp to be updated. (see my source in first post)
>>> I can't use your MediaComponent because I'm having quite advanced
>>> playback, multiple videos played one after the other. My own video
>>> comp is in fact a custom component that paints a black background. But
>>> I don't want that part to be repainted when I call repaint in the
>>> control component.
>>>
>>> What is the mediaComponent doing to avoid painting when other
>>> components in the form are updated?
>>>
>>>
>>>>
>>>> Regards,
>>>> Chen
>>>>
>>>>
>>>>
>>>> Francis De Brabandere wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I'm writing a video player application, on the top of the screen there
>>>>> is the player (mmapi) , just below the control bar and below that some
>>>>> other info.
>>>>> I created three custom components, one with the size of the player
>>>>> that is placed in BorderLayout.NORTH, the other are in CENTER and
>>>>> SOUTH.
>>>>>
>>>>> Now when the user presses the UP key I change the volume of the player
>>>>> and do a setVolume on the center component:
>>>>>
>>>>> public void setVolume(int volume) {
>>>>> this.volume = volume;
>>>>> repaint();
>>>>> }
>>>>>
>>>>> public void paint(Graphics g) {
>>>>> g.setColor(0x6666AA);
>>>>> LOGGER.info("paint "+getWidth()+"x"+getHeight());
>>>>> g.fillRect(getX(), getY(), getWidth(), getHeight());
>>>>> paintVolume(g);
>>>>> }
>>>>>
>>>>> Now the problem is that the repaint() call forces a whole screen
>>>>> update. The player keeps playing (sound) but it is not visible any
>>>>> more because it has been overpainted. (SE 660i)
>>>>> Pausing the player and resuming playback brings the player back. Our
>>>>> nokia S40 phones don't have this issue, their player seems to stay on
>>>>> top of the Canvas. I suppose the SE phones use some color that will be
>>>>> replaced by the player pixes by the gfx system?
>>>>>
>>>>> Is there a way to indicate lwuit should never repaint the part of the
>>>>> screen where the player is located?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
>>>> For additional commands, e-mail: users-help@lwuit.dev.java.net
>>>>
>>>>
>>>>
>>>
>>> --
>>> http://www.somatik.be
>>> Microsoft gives you windows, Linux gives you the whole house.
>>>
>>>
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Francis De Brabandere

Ok, this seems to be a SE660i related bug, our SE850i does not have
this issue, neither do our Nokia phones.
I tested using MediaComponent, in the form below the video player is
overpainted when the user presses the test form button.

and there is a less problematic issue on the SE850: the test button +
command panel are overpainted in white when the player starts,
triggering a repaint by clicking the button brings everything to the
way it should be.

These are serious issues as I'm writing a video player application,
did anybody else have problems using the mmapi with video + LWUIT? The
TinyLine version of our application does not have these issues...

public class TestPlayerForm extends Form{

private static final Logger LOGGER =
LoggerFactory.getLogger(TestPlayerForm.class);

private final MediaComponent mc;
private final Button button;

private Player player;

public TestPlayerForm() {

Command playCommand = new Command("Play") {
public void actionPerformed(ActionEvent event) {
startPlayer();
}
};
this.addCommand(playCommand);

this.setLayout(new BorderLayout());
this.button = new Button("test");
this.addComponent(BorderLayout.SOUTH, button);
createPlayer();
this.mc = new MediaComponent(player);
mc.setFocusable(false);
this.addComponent(BorderLayout.CENTER, mc);
}

private void startPlayer(){
if(player != null){
try {
player.start();
} catch (MediaException ex) {
LOGGER.error(ex);
}
}
}

private void createPlayer(){
try {
player = Manager.createPlayer("file:///e:/117.mp4");
player.addPlayerListener(new LoggingPlayerListener("Test"));
player.realize();
} catch (IOException ex) {
LOGGER.error(ex);
} catch (MediaException ex) {
LOGGER.error(ex);
}
}

}

On Tue, Jul 1, 2008 at 4:40 PM, Francis De Brabandere
wrote:
> On Tue, Jul 1, 2008 at 4:13 PM, chen wrote:
>> Hi,
>> You can override the repaint() method and hold some sort of flag that
>> indicates for you if a player is playing,
>> If you won't fwd the call to super.repaint() your component won't be
>> refreshed.
>
> but I need the component to be refreshed, it's just the top component
> that should not be refreshed. I just want an area of the form that is
> reserved for the player (the top half) and never touched by lwuit. The
> other half of the form should be usable by the user while the player
> is playing.
>
> I still have the impression I'm not clearly explaining what my problem
> is. I'll try the MediaComponent and see if it has the same problem.
>
>
>
>> For ex:
>>
>> public void repaint(){
>> if(playerPlaying){
>> super.repaint();
>> }
>> }
>>
>> Regards,
>> Chen
>>
>>
>> Francis De Brabandere wrote:
>>>
>>> To be more clear, the top component (where the player will be put over
>>> by the mmapi) should have a black background but never be painted
>>> again when a player is playing. The lwuit back buffer should never
>>> overwrite that part of the screen when other components on the form
>>> request a repaint.
>>> The top component only has a function as placeholder for the mmapi
>>> VideoPlayer, but I want it to be black when no Player is shown yet.
>>>
>>> On Tue, Jul 1, 2008 at 1:57 PM, Francis De Brabandere
>>> wrote:
>>>
>>>>
>>>> On Tue, Jul 1, 2008 at 1:40 PM, chen wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>> Are you using the MediaComponent? in any case painting on top of the
>>>>> video
>>>>> is not something I would recommend, since this makes your application
>>>>> dependent on the device mmapi implementation.
>>>>>
>>>>
>>>> Well that is exactly what I don't want to do, there is no way to paint
>>>> on top of the video, my controls component is below (not behind) the
>>>> video component, like this:
>>>>
>>>> video comp
>>>> ---------------
>>>> control comp
>>>> ---------------
>>>> info comp
>>>>
>>>> When the user presses the up button I want the volume indication in
>>>> the control comp to be updated. (see my source in first post)
>>>> I can't use your MediaComponent because I'm having quite advanced
>>>> playback, multiple videos played one after the other. My own video
>>>> comp is in fact a custom component that paints a black background. But
>>>> I don't want that part to be repainted when I call repaint in the
>>>> control component.
>>>>
>>>> What is the mediaComponent doing to avoid painting when other
>>>> components in the form are updated?
>>>>
>>>>
>>>>>
>>>>> Regards,
>>>>> Chen
>>>>>
>>>>>
>>>>>
>>>>> Francis De Brabandere wrote:
>>>>>
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm writing a video player application, on the top of the screen there
>>>>>> is the player (mmapi) , just below the control bar and below that some
>>>>>> other info.
>>>>>> I created three custom components, one with the size of the player
>>>>>> that is placed in BorderLayout.NORTH, the other are in CENTER and
>>>>>> SOUTH.
>>>>>>
>>>>>> Now when the user presses the UP key I change the volume of the player
>>>>>> and do a setVolume on the center component:
>>>>>>
>>>>>> public void setVolume(int volume) {
>>>>>> this.volume = volume;
>>>>>> repaint();
>>>>>> }
>>>>>>
>>>>>> public void paint(Graphics g) {
>>>>>> g.setColor(0x6666AA);
>>>>>> LOGGER.info("paint "+getWidth()+"x"+getHeight());
>>>>>> g.fillRect(getX(), getY(), getWidth(), getHeight());
>>>>>> paintVolume(g);
>>>>>> }
>>>>>>
>>>>>> Now the problem is that the repaint() call forces a whole screen
>>>>>> update. The player keeps playing (sound) but it is not visible any
>>>>>> more because it has been overpainted. (SE 660i)
>>>>>> Pausing the player and resuming playback brings the player back. Our
>>>>>> nokia S40 phones don't have this issue, their player seems to stay on
>>>>>> top of the Canvas. I suppose the SE phones use some color that will be
>>>>>> replaced by the player pixes by the gfx system?
>>>>>>
>>>>>> Is there a way to indicate lwuit should never repaint the part of the
>>>>>> screen where the player is located?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
>>>>> For additional commands, e-mail: users-help@lwuit.dev.java.net
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> http://www.somatik.be
>>>> Microsoft gives you windows, Linux gives you the whole house.
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
>> For additional commands, e-mail: users-help@lwuit.dev.java.net
>>
>>
>
>
>
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
>

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

damkea
Offline
Joined: 2008-07-22

Hi Francis (or someone else),

Do you already have a solution to repaint only one component of a screen? I've got the same issues you have.

Im using a thread to update a label (displaying the current time of the video file). On the same form there is a mediacomponent, but everytime the thread 'ticks' (1000ms) the whole form gets repainted inclusive the MediaComponent (while playing a video) resulting in flickering.

I've this issue on a nokia n70 (and the default Sun emulators).

Maybe there is a more simplistic solution for displaying the current time of the player?

Shai Almog

Hi,
use an animation to invoke setText on the label rather than a thread
it will be more efficient.

> Do you already have a solution to repaint only one component of a
> screen? I've got the same issues you have.

Only the label is repainted nothing else. However, when you invoke
setText() one of the results is a call to: setShouldCalcPreferredSize
of the label and the parent containers indicating that a layout is
required. What you are seeing is the flickering of the resulting
layout occurring when you paint the parent component.

There is no reason to repaint the parent component and trigger the
layout (the label only paints itself) and the media component doesn't
do this either so I'm assuming you invoke the repaint of the parent
container at some point (do you have animations?).

If you want to you can disable setShouldCalcPreferredSize on the
label once the video has started, which should also work as expected
(disable by overriding it and avoiding a call to super).

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

Francis De Brabandere

Does LWUIT work with a screen back buffer that is always 100% painted
to the screen? I don't have any label, just a custom component where i
call repaint()

On Thu, Jul 24, 2008 at 5:26 AM, Shai Almog wrote:
> Hi,
> use an animation to invoke setText on the label rather than a thread it will
> be more efficient.
>
> Do you already have a solution to repaint only one component of a screen?
> I've got the same issues you have.
>
> Only the label is repainted nothing else. However, when you invoke setText()
> one of the results is a call to: setShouldCalcPreferredSize of the label and
> the parent containers indicating that a layout is required. What you are
> seeing is the flickering of the resulting layout occurring when you paint
> the parent component.
> There is no reason to repaint the parent component and trigger the layout
> (the label only paints itself) and the media component doesn't do this
> either so I'm assuming you invoke the repaint of the parent container at
> some point (do you have animations?).
> If you want to you can disable setShouldCalcPreferredSize on the label once
> the video has started, which should also work as expected (disable by
> overriding it and avoiding a call to super).
> Shai Almog
> http://lwuit.blogspot.com/
>

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Shai Almog

> Does LWUIT work with a screen back buffer that is always 100% painted
> to the screen? I don't have any label, just a custom component where i
> call repaint()

LWUIT uses GameCanvas which has this behavior. Since some devices
have GameCanvas related bugs with flush graphics we chose to disable
the proper flushing of graphics by default.
You can try to enable it by setting Display.setFlashGraphicsBug to
false after invoking init().

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

Francis De Brabandere

Shai,

Super thanks, that fixed it for the SE660i !!! What do you need to add
this phone to the no-bug list?
On our 850i the problem is even worse by setting this property to
false. Have you tested video playback + other components on a form for
the sony ericsson 850i?

On Thu, Jul 24, 2008 at 10:21 AM, Shai Almog wrote:
> Does LWUIT work with a screen back buffer that is always 100% painted
> to the screen? I don't have any label, just a custom component where i
> call repaint()
>
> LWUIT uses GameCanvas which has this behavior. Since some devices have
> GameCanvas related bugs with flush graphics we chose to disable the proper
> flushing of graphics by default.
> You can try to enable it by setting Display.setFlashGraphicsBug to false
> after invoking init().
> Shai Almog
> http://lwuit.blogspot.com/
>

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Shai Almog

Hi Francis,
we don't test video playback on phones at all since we have so much
work with other issues.
There is currently no list of which phones feature the flushGraphics
bug, we only disable it for Nokia where we never ran into the bug
(this is a very widespread bug which started at an old version of the
RI). We try to avoid phone detection where possible and this bug
usually doesn't "bite" people, the main problem in cases such as
yours relates to media and layout colliding...

Has the patch for Label that I suggested solved this problem as well?
If so that would be the more portable solution.

Thanks.
Shai.

> Shai,
>
> Super thanks, that fixed it for the SE660i !!! What do you need to add
> this phone to the no-bug list?
> On our 850i the problem is even worse by setting this property to
> false. Have you tested video playback + other components on a form for
> the sony ericsson 850i?
>
>
> On Thu, Jul 24, 2008 at 10:21 AM, Shai Almog
> wrote:
>> Does LWUIT work with a screen back buffer that is always 100% painted
>> to the screen? I don't have any label, just a custom component
>> where i
>> call repaint()
>>
>> LWUIT uses GameCanvas which has this behavior. Since some devices
>> have
>> GameCanvas related bugs with flush graphics we chose to disable
>> the proper
>> flushing of graphics by default.
>> You can try to enable it by setting Display.setFlashGraphicsBug to
>> false
>> after invoking init().
>> Shai Almog
>> http://lwuit.blogspot.com/
>>
>
>
>
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

Francis De Brabandere

Well that label patch was for somebody else. I have no labels on my form.

On Thu, Jul 24, 2008 at 11:29 AM, Shai Almog wrote:
> Hi Francis,
> we don't test video playback on phones at all since we have so much work
> with other issues.
> There is currently no list of which phones feature the flushGraphics bug, we
> only disable it for Nokia where we never ran into the bug (this is a very
> widespread bug which started at an old version of the RI). We try to avoid
> phone detection where possible and this bug usually doesn't "bite" people,
> the main problem in cases such as yours relates to media and layout
> colliding...
> Has the patch for Label that I suggested solved this problem as well? If so
> that would be the more portable solution.
> Thanks.
> Shai.
>
> Shai,
> Super thanks, that fixed it for the SE660i !!! What do you need to add
> this phone to the no-bug list?
> On our 850i the problem is even worse by setting this property to
> false. Have you tested video playback + other components on a form for
> the sony ericsson 850i?
>
> On Thu, Jul 24, 2008 at 10:21 AM, Shai Almog wrote:
>
> Does LWUIT work with a screen back buffer that is always 100% painted
> to the screen? I don't have any label, just a custom component where i
> call repaint()
> LWUIT uses GameCanvas which has this behavior. Since some devices have
> GameCanvas related bugs with flush graphics we chose to disable the proper
> flushing of graphics by default.
> You can try to enable it by setting Display.setFlashGraphicsBug to false
> after invoking init().
> Shai Almog
> http://lwuit.blogspot.com/
>
>
>
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
> Shai Almog
> http://lwuit.blogspot.com/
>

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Shai Almog

So what triggered the flickering you were getting?
Are there repaints or mutations to components?

You can override setShouldCalcPreferredSize(boolean) on the parent
container and put a breakpoint there to see if it gets invokes and by
whom.

> Well that label patch was for somebody else. I have no labels on my
> form.
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

Francis De Brabandere

Well this thread started with some other story, I have no flickering.
I can't use an emulator for my app. The actual problem was that the
video player disappeared when I called repaint on my custom component.
And it only came back by pausing and resuming the player.

I added this to my code for now:
//init the LWUIT Display
com.sun.lwuit.Display.init(this);
if(System.getProperty("microedition.platform").startsWith("SonyEricssonK660i")){
LOGGER.info("Detected SE660i => disablink flash graphics bug");
// TODO this should be fixed in some following lwuit release?
com.sun.lwuit.Display.getInstance().setFlashGraphicsBug(false);
}

On Thu, Jul 24, 2008 at 11:37 AM, Shai Almog wrote:
> So what triggered the flickering you were getting?
> Are there repaints or mutations to components?
> You can override setShouldCalcPreferredSize(boolean) on the parent container
> and put a breakpoint there to see if it gets invokes and by whom.
>
> Well that label patch was for somebody else. I have no labels on my form.
>
> Shai Almog
> http://lwuit.blogspot.com/
>

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

chen

Hi,
Are you using the MediaComponent? in any case painting on top of the
video is not something I would recommend, since this makes your
application dependent on the device mmapi implementation.

Regards,
Chen

Francis De Brabandere wrote:
> Hi,
>
> I'm writing a video player application, on the top of the screen there
> is the player (mmapi) , just below the control bar and below that some
> other info.
> I created three custom components, one with the size of the player
> that is placed in BorderLayout.NORTH, the other are in CENTER and
> SOUTH.
>
> Now when the user presses the UP key I change the volume of the player
> and do a setVolume on the center component:
>
> public void setVolume(int volume) {
> this.volume = volume;
> repaint();
> }
>
> public void paint(Graphics g) {
> g.setColor(0x6666AA);
> LOGGER.info("paint "+getWidth()+"x"+getHeight());
> g.fillRect(getX(), getY(), getWidth(), getHeight());
> paintVolume(g);
> }
>
> Now the problem is that the repaint() call forces a whole screen
> update. The player keeps playing (sound) but it is not visible any
> more because it has been overpainted. (SE 660i)
> Pausing the player and resuming playback brings the player back. Our
> nokia S40 phones don't have this issue, their player seems to stay on
> top of the Canvas. I suppose the SE phones use some color that will be
> replaced by the player pixes by the gfx system?
>
> Is there a way to indicate lwuit should never repaint the part of the
> screen where the player is located?
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Francis De Brabandere

On Tue, Jul 1, 2008 at 1:40 PM, chen wrote:
> Hi,
> Are you using the MediaComponent? in any case painting on top of the video
> is not something I would recommend, since this makes your application
> dependent on the device mmapi implementation.

Well that is exactly what I don't want to do, there is no way to paint
on top of the video, my controls component is below (not behind) the
video component, like this:

video comp
---------------
control comp
---------------
info comp

When the user presses the up button I want the volume indication in
the control comp to be updated. (see my source in first post)
I can't use your MediaComponent because I'm having quite advanced
playback, multiple videos played one after the other. My own video
comp is in fact a custom component that paints a black background. But
I don't want that part to be repainted when I call repaint in the
control component.

What is the mediaComponent doing to avoid painting when other
components in the form are updated?

>
> Regards,
> Chen
>
>
>
> Francis De Brabandere wrote:
>>
>> Hi,
>>
>> I'm writing a video player application, on the top of the screen there
>> is the player (mmapi) , just below the control bar and below that some
>> other info.
>> I created three custom components, one with the size of the player
>> that is placed in BorderLayout.NORTH, the other are in CENTER and
>> SOUTH.
>>
>> Now when the user presses the UP key I change the volume of the player
>> and do a setVolume on the center component:
>>
>> public void setVolume(int volume) {
>> this.volume = volume;
>> repaint();
>> }
>>
>> public void paint(Graphics g) {
>> g.setColor(0x6666AA);
>> LOGGER.info("paint "+getWidth()+"x"+getHeight());
>> g.fillRect(getX(), getY(), getWidth(), getHeight());
>> paintVolume(g);
>> }
>>
>> Now the problem is that the repaint() call forces a whole screen
>> update. The player keeps playing (sound) but it is not visible any
>> more because it has been overpainted. (SE 660i)
>> Pausing the player and resuming playback brings the player back. Our
>> nokia S40 phones don't have this issue, their player seems to stay on
>> top of the Canvas. I suppose the SE phones use some color that will be
>> replaced by the player pixes by the gfx system?
>>
>> Is there a way to indicate lwuit should never repaint the part of the
>> screen where the player is located?
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.
[Screenshot-MicroEmulator.png]
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Francis De Brabandere

To be more clear, the top component (where the player will be put over
by the mmapi) should have a black background but never be painted
again when a player is playing. The lwuit back buffer should never
overwrite that part of the screen when other components on the form
request a repaint.
The top component only has a function as placeholder for the mmapi
VideoPlayer, but I want it to be black when no Player is shown yet.

On Tue, Jul 1, 2008 at 1:57 PM, Francis De Brabandere
wrote:
> On Tue, Jul 1, 2008 at 1:40 PM, chen wrote:
>> Hi,
>> Are you using the MediaComponent? in any case painting on top of the video
>> is not something I would recommend, since this makes your application
>> dependent on the device mmapi implementation.
>
> Well that is exactly what I don't want to do, there is no way to paint
> on top of the video, my controls component is below (not behind) the
> video component, like this:
>
> video comp
> ---------------
> control comp
> ---------------
> info comp
>
> When the user presses the up button I want the volume indication in
> the control comp to be updated. (see my source in first post)
> I can't use your MediaComponent because I'm having quite advanced
> playback, multiple videos played one after the other. My own video
> comp is in fact a custom component that paints a black background. But
> I don't want that part to be repainted when I call repaint in the
> control component.
>
> What is the mediaComponent doing to avoid painting when other
> components in the form are updated?
>
>>
>> Regards,
>> Chen
>>
>>
>>
>> Francis De Brabandere wrote:
>>>
>>> Hi,
>>>
>>> I'm writing a video player application, on the top of the screen there
>>> is the player (mmapi) , just below the control bar and below that some
>>> other info.
>>> I created three custom components, one with the size of the player
>>> that is placed in BorderLayout.NORTH, the other are in CENTER and
>>> SOUTH.
>>>
>>> Now when the user presses the UP key I change the volume of the player
>>> and do a setVolume on the center component:
>>>
>>> public void setVolume(int volume) {
>>> this.volume = volume;
>>> repaint();
>>> }
>>>
>>> public void paint(Graphics g) {
>>> g.setColor(0x6666AA);
>>> LOGGER.info("paint "+getWidth()+"x"+getHeight());
>>> g.fillRect(getX(), getY(), getWidth(), getHeight());
>>> paintVolume(g);
>>> }
>>>
>>> Now the problem is that the repaint() call forces a whole screen
>>> update. The player keeps playing (sound) but it is not visible any
>>> more because it has been overpainted. (SE 660i)
>>> Pausing the player and resuming playback brings the player back. Our
>>> nokia S40 phones don't have this issue, their player seems to stay on
>>> top of the Canvas. I suppose the SE phones use some color that will be
>>> replaced by the player pixes by the gfx system?
>>>
>>> Is there a way to indicate lwuit should never repaint the part of the
>>> screen where the player is located?
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
>> For additional commands, e-mail: users-help@lwuit.dev.java.net
>>
>>
>
>
>
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
>

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

chen

Hi,
You can override the repaint() method and hold some sort of flag that
indicates for you if a player is playing,
If you won't fwd the call to super.repaint() your component won't be
refreshed.
For ex:

public void repaint(){
if(playerPlaying){
super.repaint();
}
}

Regards,
Chen

Francis De Brabandere wrote:
> To be more clear, the top component (where the player will be put over
> by the mmapi) should have a black background but never be painted
> again when a player is playing. The lwuit back buffer should never
> overwrite that part of the screen when other components on the form
> request a repaint.
> The top component only has a function as placeholder for the mmapi
> VideoPlayer, but I want it to be black when no Player is shown yet.
>
> On Tue, Jul 1, 2008 at 1:57 PM, Francis De Brabandere
> wrote:
>
>> On Tue, Jul 1, 2008 at 1:40 PM, chen wrote:
>>
>>> Hi,
>>> Are you using the MediaComponent? in any case painting on top of the video
>>> is not something I would recommend, since this makes your application
>>> dependent on the device mmapi implementation.
>>>
>> Well that is exactly what I don't want to do, there is no way to paint
>> on top of the video, my controls component is below (not behind) the
>> video component, like this:
>>
>> video comp
>> ---------------
>> control comp
>> ---------------
>> info comp
>>
>> When the user presses the up button I want the volume indication in
>> the control comp to be updated. (see my source in first post)
>> I can't use your MediaComponent because I'm having quite advanced
>> playback, multiple videos played one after the other. My own video
>> comp is in fact a custom component that paints a black background. But
>> I don't want that part to be repainted when I call repaint in the
>> control component.
>>
>> What is the mediaComponent doing to avoid painting when other
>> components in the form are updated?
>>
>>
>>> Regards,
>>> Chen
>>>
>>>
>>>
>>> Francis De Brabandere wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm writing a video player application, on the top of the screen there
>>>> is the player (mmapi) , just below the control bar and below that some
>>>> other info.
>>>> I created three custom components, one with the size of the player
>>>> that is placed in BorderLayout.NORTH, the other are in CENTER and
>>>> SOUTH.
>>>>
>>>> Now when the user presses the UP key I change the volume of the player
>>>> and do a setVolume on the center component:
>>>>
>>>> public void setVolume(int volume) {
>>>> this.volume = volume;
>>>> repaint();
>>>> }
>>>>
>>>> public void paint(Graphics g) {
>>>> g.setColor(0x6666AA);
>>>> LOGGER.info("paint "+getWidth()+"x"+getHeight());
>>>> g.fillRect(getX(), getY(), getWidth(), getHeight());
>>>> paintVolume(g);
>>>> }
>>>>
>>>> Now the problem is that the repaint() call forces a whole screen
>>>> update. The player keeps playing (sound) but it is not visible any
>>>> more because it has been overpainted. (SE 660i)
>>>> Pausing the player and resuming playback brings the player back. Our
>>>> nokia S40 phones don't have this issue, their player seems to stay on
>>>> top of the Canvas. I suppose the SE phones use some color that will be
>>>> replaced by the player pixes by the gfx system?
>>>>
>>>> Is there a way to indicate lwuit should never repaint the part of the
>>>> screen where the player is located?
>>>>
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
>>> For additional commands, e-mail: users-help@lwuit.dev.java.net
>>>
>>>
>>>
>>
>> --
>> http://www.somatik.be
>> Microsoft gives you windows, Linux gives you the whole house.
>>
>>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Francis De Brabandere

So there is no way to do screen updates while a mmapi videoplayer is playing?

On Tue, Jul 1, 2008 at 4:13 PM, chen wrote:
> Hi,
> You can override the repaint() method and hold some sort of flag that
> indicates for you if a player is playing,
> If you won't fwd the call to super.repaint() your component won't be
> refreshed.
> For ex:
>
> public void repaint(){
> if(playerPlaying){
> super.repaint();
> }
> }
>
> Regards,
> Chen
>
>
> Francis De Brabandere wrote:
>>
>> To be more clear, the top component (where the player will be put over
>> by the mmapi) should have a black background but never be painted
>> again when a player is playing. The lwuit back buffer should never
>> overwrite that part of the screen when other components on the form
>> request a repaint.
>> The top component only has a function as placeholder for the mmapi
>> VideoPlayer, but I want it to be black when no Player is shown yet.
>>
>> On Tue, Jul 1, 2008 at 1:57 PM, Francis De Brabandere
>> wrote:
>>
>>>
>>> On Tue, Jul 1, 2008 at 1:40 PM, chen wrote:
>>>
>>>>
>>>> Hi,
>>>> Are you using the MediaComponent? in any case painting on top of the
>>>> video
>>>> is not something I would recommend, since this makes your application
>>>> dependent on the device mmapi implementation.
>>>>
>>>
>>> Well that is exactly what I don't want to do, there is no way to paint
>>> on top of the video, my controls component is below (not behind) the
>>> video component, like this:
>>>
>>> video comp
>>> ---------------
>>> control comp
>>> ---------------
>>> info comp
>>>
>>> When the user presses the up button I want the volume indication in
>>> the control comp to be updated. (see my source in first post)
>>> I can't use your MediaComponent because I'm having quite advanced
>>> playback, multiple videos played one after the other. My own video
>>> comp is in fact a custom component that paints a black background. But
>>> I don't want that part to be repainted when I call repaint in the
>>> control component.
>>>
>>> What is the mediaComponent doing to avoid painting when other
>>> components in the form are updated?
>>>
>>>
>>>>
>>>> Regards,
>>>> Chen
>>>>
>>>>
>>>>
>>>> Francis De Brabandere wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I'm writing a video player application, on the top of the screen there
>>>>> is the player (mmapi) , just below the control bar and below that some
>>>>> other info.
>>>>> I created three custom components, one with the size of the player
>>>>> that is placed in BorderLayout.NORTH, the other are in CENTER and
>>>>> SOUTH.
>>>>>
>>>>> Now when the user presses the UP key I change the volume of the player
>>>>> and do a setVolume on the center component:
>>>>>
>>>>> public void setVolume(int volume) {
>>>>> this.volume = volume;
>>>>> repaint();
>>>>> }
>>>>>
>>>>> public void paint(Graphics g) {
>>>>> g.setColor(0x6666AA);
>>>>> LOGGER.info("paint "+getWidth()+"x"+getHeight());
>>>>> g.fillRect(getX(), getY(), getWidth(), getHeight());
>>>>> paintVolume(g);
>>>>> }
>>>>>
>>>>> Now the problem is that the repaint() call forces a whole screen
>>>>> update. The player keeps playing (sound) but it is not visible any
>>>>> more because it has been overpainted. (SE 660i)
>>>>> Pausing the player and resuming playback brings the player back. Our
>>>>> nokia S40 phones don't have this issue, their player seems to stay on
>>>>> top of the Canvas. I suppose the SE phones use some color that will be
>>>>> replaced by the player pixes by the gfx system?
>>>>>
>>>>> Is there a way to indicate lwuit should never repaint the part of the
>>>>> screen where the player is located?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
>>>> For additional commands, e-mail: users-help@lwuit.dev.java.net
>>>>
>>>>
>>>>
>>>
>>> --
>>> http://www.somatik.be
>>> Microsoft gives you windows, Linux gives you the whole house.
>>>
>>>
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net