| ID | KIJ001366 | Creation date | June 11, 2009 |
| Platform | S60 3rd Edition, FP2, S60 5th Edition | Devices | Nokia N96, Nokia 5800 XpressMusic |
| Category | Java ME | Subcategory | Multimedia |
| Keywords (APIs, classes, methods, functions): Manager.createPlayer("rtsp://<streaming some media file>"); |
Streaming video is not correctly displayed in full-screen mode after orientation switch. In some devices, only part of the video will be shown on the screen display, whereas in some devices no video will be displayed at all.
1. Implement a test MIDlet using the following source code:
import java.io.InputStream;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.media.*;
import javax.microedition.media.control.VideoControl;
public class RTSPFullScreen extends MIDlet implements CommandListener, PlayerListener
{
private Display d;
private Player p;
private Canvas c;
private Command exitCommand = new Command("Exit", Command.EXIT, 1);
VideoControl vc;
public RTSPFullScreen()
{
d = Display.getDisplay(this);
}
public void startApp()
{
c = new Canvas()
{
protected void paint(Graphics g)
{
g.setColor(0,0,0);
g.fillRect(0,0,getWidth(),getHeight());
}
};
c.setFullScreenMode( true );
c.addCommand( exitCommand );
c.setCommandListener( this );
d.setCurrent( c );
try
{
p = Manager.createPlayer("rtsp://<streaming some media file>");
p.addPlayerListener( this );
p.prefetch();
vc = ( VideoControl )p.getControl( "javax.microedition.media.control.VideoControl" );
vc.initDisplayMode( VideoControl.USE_DIRECT_VIDEO, c );
p.start();
}
catch( Exception e )
{
showAlert( "startApp: " + e.toString() );
}
}
public void commandAction( Command c, Displayable s )
{
if (c == exitCommand)
{
destroyApp(false);
notifyDestroyed();
}
}
public void pauseApp()
{
}
public void destroyApp( boolean uc )
{
if( p != null )
{
p.close();
}
}
public void playerUpdate(Player player, java.lang.String event, java.lang.Object eventData)
{
if( event == "started" && player.getState() == Player.STARTED )
{
try
{
vc.setDisplayFullScreen(true);
vc.setVisible( true );
}
catch( Exception e )
{
showAlert( "playerUpdate: " + e.toString() );
}
}
}
public void showAlert( String aAlertText )
{
Alert alert = new Alert( "Alert", aAlertText, null, AlertType.ERROR );
alert.setTimeout( 10000 );
d.setCurrent( alert );
}
}
2. Launch the MIDlet with the device in portrait orientation.
3. After streaming has started, switch the orientation to landscape.
For the affected devices, either only part of the video will be shown on the screen display or no video will be displayed at all.
This issue is expected to be fixed in future software versions starting from S60 3rd Edition, Feature Pack 2 and S60 5th Edition.
No related wiki articles found