Java Code Examples for javax.microedition.media.MediaException#toString()
The following examples show how to use
javax.microedition.media.MediaException#toString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MMAPIPlayer.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public static MMAPIPlayer createPlayer(InputStream stream, String mimeType, Runnable onCompletion) throws IOException { try { Player p = Manager.createPlayer(stream, mimeType); p.realize(); MMAPIPlayer m = new MMAPIPlayer(p); m.bindPlayerCleanupOnComplete(p, stream, onCompletion); return m; } catch (MediaException ex) { if ("audio/mpeg".equals(mimeType)) { return createPlayer(stream, "audio/mp3", onCompletion); } ex.printStackTrace(); throw new IOException(ex.toString()); } }
Example 2
Source File: MMAPIPlayer.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public static MMAPIPlayer createPlayer(InputStream stream, String mimeType, Runnable onCompletion) throws IOException { try { Player p = Manager.createPlayer(stream, mimeType); p.realize(); MMAPIPlayer m = new MMAPIPlayer(p); m.bindPlayerCleanupOnComplete(p, stream, onCompletion); return m; } catch (MediaException ex) { if("audio/mpeg".equals(mimeType)) { return createPlayer(stream, "audio/mp3", onCompletion); } ex.printStackTrace(); throw new IOException(ex.toString()); } }
Example 3
Source File: MMAPIPlayer.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
/** * @inheritDoc */ public static MMAPIPlayer createPlayer(String uri, Runnable onCompletion) throws IOException { try { Player p = Manager.createPlayer((String) uri); p.realize(); MMAPIPlayer m = new MMAPIPlayer(p); m.bindPlayerCleanupOnComplete(p, null, onCompletion); return m; } catch (MediaException ex) { ex.printStackTrace(); throw new IOException(ex.toString()); } }
Example 4
Source File: MMAPIPlayer.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public void prepare() { if (deleted) { return; } try { nativePlayer.prefetch(); } catch (MediaException ex) { ex.printStackTrace(); throw new RuntimeException(ex.toString()); } }
Example 5
Source File: MMAPIPlayer.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public void play() { if (deleted) { return; } try { nativePlayer.start(); } catch (MediaException ex) { ex.printStackTrace(); throw new RuntimeException(ex.toString()); } }
Example 6
Source File: MMAPIPlayer.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public void pause() { if (deleted) { return; } try { if (nativePlayer != null) { nativePlayer.stop(); } } catch (MediaException ex) { ex.printStackTrace(); throw new RuntimeException(ex.toString()); } }
Example 7
Source File: MMAPIPlayer.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
/** * @inheritDoc */ public static MMAPIPlayer createPlayer(String uri, Runnable onCompletion) throws IOException { try { Player p = Manager.createPlayer((String)uri); p.realize(); MMAPIPlayer m = new MMAPIPlayer(p); m.bindPlayerCleanupOnComplete(p, null, onCompletion); return m; } catch (MediaException ex) { ex.printStackTrace(); throw new IOException(ex.toString()); } }
Example 8
Source File: MMAPIPlayer.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public void prepare() { if(deleted){ return; } try { nativePlayer.prefetch(); } catch (MediaException ex) { ex.printStackTrace(); throw new RuntimeException(ex.toString()); } }
Example 9
Source File: MMAPIPlayer.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public void pause() { if(deleted){ return; } try { if(nativePlayer != null) { nativePlayer.stop(); } } catch (MediaException ex) { ex.printStackTrace(); throw new RuntimeException(ex.toString()); } }