You Are Here:

Community: Wiki

This page was last modified on 11 June 2009, at 10:03.

KIJ001367 - MMAPI player crashes in eSWT MIDlet

From Forum Nokia Wiki



ID KIJ001367 Creation date June 11, 2009
Platform S60 3rd Edition, FP2, S60 5th Edition Devices Nokia N96, Nokia 5800 XpressMusic
Category Java ME Subcategory eSWT API


Keywords (APIs, classes, methods, functions): javax.microedition.media, org.eclipse.swt

Description

An MMAPI player crashes when playing is started from an eSWT MIDlet.

How to reproduce

1. Implement a test MIDlet using the following source code:

import java.io.IOException;
import java.io.InputStream;
import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;
import javax.microedition.media.control.VideoControl;
import javax.microedition.midlet.MIDlet;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
 
public class MMAPIExample extends MIDlet implements Runnable {
 
 
Display display;
VideoControl vc;
Thread UIThread;
Shell shell;
 
 
public void startApp() {
 
// Creating an eSWT UI thread.
if(UIThread == null) {
UIThread = new Thread(this);
UIThread.start();
}
}
 
public void pauseApp() {
 
}
 
public void destroyApp(boolean unconditional) {
// Dispose the remaining resources.
display.dispose();
}
 
// The eSWT UI Thread
public void run() {
// Create the Display.
display = new Display();
 
shell = new Shell(display);
shell.open();
 
Player player= null ;
try {
 
InputStream is = getClass().getResourceAsStream("video.format");
player = Manager.createPlayer(is, null);
player.prefetch();
 
vc = (VideoControl)player.getControl("VideoControl");
Control vControl = (org.eclipse.swt.widgets.Control)
vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "org.eclipse.swt.widgets.Control");
vControl.setParent(shell);
vc.setDisplayFullScreen(true);
player.start();
 
} catch (IOException e) {
 
} catch (MediaException e) {
 
}
 
 
// Execute the eSWT event loop.
while(!shell.isDisposed()) {
if(!display.readAndDispatch()) {
display.sleep();
}
}
if (player != null ){
player.deallocate();
player.close();
player = null;
}
 
// Clean up and destroy the MIDlet
destroyApp(true);
notifyDestroyed();
}
 
public void widgetDefaultSelected(SelectionEvent e) {
}
}

2. Launch the test MIDlet. For the affected devices, no video will be played but Error java.lang.Error SymbianOS Error = -1 will be given instead.

Solution

This issue is expected to be fixed in future software versions for the affected devices, starting from S60 5th Edition.

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia