Hi All
I am using this code for video playback
And I want my app to start play videos > 2MB without much lag or delay. I am using this code.
void initPlayer()
{
try {
try {
player = Manager.createPlayer(filUrl); /******If no file-->got to catch get it from jar**************/
player.addPlayerListener(this);
player.prefetch();
player.realize();
}catch(Exception e) {
InputStream is = getClass().getResourceAsStream("/Videos/britney.mp4");
player = Manager.createPlayer(is, "video/mp4");
player.addPlayerListener(this);
player.prefetch();
player.realize();
}
VideoControl videoControl = (VideoControl) (player.getControl("VideoControl"));
if (videoControl == null) {
midlet.alertError("VideoControl not supported");
}
else {
videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO,
this);
videoControl.setVisible(true);
}
videoControl.setDisplayLocation(20,150);
videoControl.setDisplaySize(320, 320);
initDone = true;
}
catch (IOException ioe) {
discardPlayer();
midlet.alertError("IOException: " + ioe.getMessage());
}
catch (MediaException me) {
discardPlayer();
midlet.alertError("MediaException: " + me.getMessage());
}
catch (SecurityException se) {
discardPlayer();
midlet.alertError("SecurityException: " + se.getMessage());
}
catch (Exception ex) {
discardPlayer();
midlet.alertError("Exception: " + ex.getMessage());
}
}
Can anybody please guide my app through to play videos with max 10 seconds delay for buffering.
http://www.youtube.com/watch?v=coV06ChYWJo

Reply With Quote

