This discussion is archived
3 Replies Latest reply: Apr 12, 2010 7:01 AM by 843851 RSS

HComponents over video

843851 Newbie
Currently Being Moderated
Hello and beforehand, thanks for reading.

I've been trying to show HIcons on the video Im playing, but they never are displayed

What I did was to create a Player and to add its VisualComponent to a JPanel. Then that panel was added to the HScene I was working with and the player starts playing.

Its like this:
       
comp.setLocation(0,0);
comp.setSize(720, 576);
jp = new JPanel();
jp.setVisible(true);
jp.add(comp); // comp is player.getVisualComponent();
jp.setSize(comp.getSize());
jp.setLocation(0,0);
scene.add(jp);
scene.pushToBack(jp);
jp.repaint();
comp.repaint();
scene.repaint();
player.start();
And finnally, when I try
scene.add(myHIcon);
scene.popToFront(myHIcon);
the video continues playing and no HIcon is displayed in scene.

Maybe the way I'm adding the video to the HScene isn't the most appropriate because of the JPanel. The video seems to be over anything. Even it's displayed over the menubar's items of the XleTView- I cant see them.

I also tried
       
comp.setLocation(0,0);
comp.setSize(720, 576);
scene.add(comp);
comp.repaint();
scene.repaint();
but scene doesnt display any video.

I've looked for other alternatives to the JPanel and found HVideoComponent. I think this could be a better choice but I still don't understand how to create an instance of it.
I tried
HVideoComponent hvc = (HVideoComponent)(player.getVisualComponent());
but it doesnt work. The convertion isnt possible. Invoking its constructor is useless too.

Thats my current problem. I hope it to work soon.

Thanks again for reading.
  • 1. Re: HComponents over video
    843851 Newbie
    Currently Being Moderated
    I've been reading and reading and i think im approaching to work it out.

    According to what i read the player's visualComponent is actually a HeavyComponent. That means its displayed over any other components (even the XleTView menubar's items).

    Just adding this line:
    Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, Boolean.TRUE);
    and I can see XleTView menubar's items now, but the HIcon I wanted to be on the video is not displayed after all.

    I only can see it when I pause the player or when I move the mouse over a menu on the menubar while playing.

    What could be the solution now?
  • 2. Re: HComponents over video
    843851 Newbie
    Currently Being Moderated
    Hi

    I finnaly could do it!
    it was nothing really strange.

    Remember to write the line in the comment before this and the code which follows.

    Here it is if there is someone who need it too. The main class that implements Xlet inherits from HContainer. This is when adding the video
    Component comp = player.getVisualComponent(); 
    if (comp != null) 
    {                                   
         add(comp);//Its added to an HContainer
         comp.setSize(720, 576); 
         setSize(720, 576);
         validate();//(called after adding something to a container)
         repaint();//Repaint the Container
    } 
    And then to add the HIcon, just write this:
    add(myHIcon);                                                    
    pushToBack(player.getVisualComponent()); //Take the video to the back
    popToFront(myHIcon);//and the HIcon to the front
    validate();                                                       
    repaint();                                                       
    And thats all. It really works!

    Thnks to you who have read and thought about it.
  • 3. Re: HComponents over video
    843851 Newbie
    Currently Being Moderated
    A problem I've realized its very common It's to put an HComponent over a video playing.

    Here it's the solution.