×
Namespaces

Variants
Actions

Archived:MMAPI player crashes in eSWT MIDlet (Known Issue)

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

ESWT only supported in Symbian Java and not largely used on that platform either.

Article Metadata
Tested with
Devices(s): Nokia N96, Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 3rd Edition, FP2, S60 5th Edition
Symbian
S60 5th Edition
S60 3rd Edition FP2
Article
Keywords: javax.microedition.media, org.eclipse.swt
Created: User:Technical writer 1 (12 May 2009)
Last edited: hamishwillee (29 Jul 2013)

Description

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

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 {{{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.

This page was last modified on 29 July 2013, at 13:59.
45 page views in the last 30 days.