resize video to full screen
Hi
I've done a Xlet that resizes de video and moves it to the top right corner and it works fine. But I want to resize de video to full screen when I press blue button on the remote control and the result is that I can only see the top right corner of the original video. Any ideas for this problem?
Here is the code I tried:
private Rectangle scenedim;
publicvoid startXlet()throws XletStateChangeException
{
HSceneFactory factory = HSceneFactory.getInstance();
HSceneTemplate hst =new HSceneTemplate();
hst.setPreference(4,new HScreenDimension(1.0F, 1.0F), 1);
hst.setPreference(8,new HScreenPoint(0.0F, 0.0F), 1);
scene = factory.getBestScene(hst);
scenedim = scene.getBounds();
NORMAL_DIMENSION =new Rectangle(0, 0, scenedim.width, scenedim.height);
QUARTER_DIMENSION =new Rectangle(scenedim.width/2, 0 , scenedim.width/2-10 , scenedim.height/2-10);
scene.setLayout(null);
resizeVideo(NORMAL_DIMENSION, QUARTER_DIMENSION);
setBounds(10, 10, scenedim.width/2-10, scenedim.height-20);
scene.setVisible(true);
scene.requestFocus();
scene.addKeyListener(this);
}
publicvoid destroyXlet(boolean unconditional)throws XletStateChangeException
{
resizeVideo(QUARTER_DIMENSION, NORMAL_DIMENSION);
scene.setVisible(false);
scene.remove(this);
setBounds(100, 100, scenedim.width, scenedim.height);
HSceneFactory.getInstance().dispose(scene);
scene =null;
}
publicvoid resizeVideo(Rectangle origen, Rectangle destino)
{
ServiceContextFactory scf =null;
ServiceContext sc =null;
try
{
scf = ServiceContextFactory.getInstance();
sc = scf.getServiceContext(contexto);
}
catch(Exception ex)
{
ex.printStackTrace();
}
ServiceContentHandler[] serviceContentHandler = sc.getServiceContentHandlers();/
Player player = (Player)serviceContentHandler[0];
if(player !=null)
{
AWTVideoSizeControl awtVideoSizeControl = (AWTVideoSizeControl)player.getControl("javax.tv.media.AWTVideoSizeControl");
awtVideoSizeControl.setSize(new AWTVideoSize(origen, destino));
}
}
publicvoid keyPressed(KeyEvent e)
{
switch(e.getKeyCode())
{
default:break;
case HRcEvent.VK_COLORED_KEY_3:
try
{
destroyXlet(true);
}
catch(XletStateChangeException xletstatechangeexception)
{
}
break;
}
}
Thanks

