本文整理汇总了Java中javax.microedition.media.MediaException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java MediaException.printStackTrace方法的具体用法?Java MediaException.printStackTrace怎么用?Java MediaException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.microedition.media.MediaException
的用法示例。
在下文中一共展示了MediaException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPlayer
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
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());
}
}
示例2: paint
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
/**
* @inheritDoc
*/
public void paint(com.codename1.ui.Graphics g) {
if (isVisible()) {
try {
VideoControl vidc = (VideoControl) getVideoControl(this);
if (isFullScreen()) {
vidc.setDisplayLocation(0, 0);
vidc.setDisplaySize(Display.getInstance().getDisplayWidth(), Display.getInstance().getDisplayHeight());
} else {
vidc.setDisplayLocation(getAbsoluteX(), getAbsoluteY());
int w = getWidth();
int h = getHeight();
if (vidc.getDisplayWidth() != w || vidc.getDisplayHeight() != h) {
vidc.setDisplaySize(w, h);
}
}
} catch (MediaException ex) {
ex.printStackTrace();
}
}
}
示例3: createPlayer
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
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());
}
}
示例4: play
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
public void play() {
if(deleted){
return;
}
try {
if(playing == null) {
playing = new Vector();
}
synchronized(MMAPIPlayer.class) {
if(!playing.contains(this)){
playing.addElement(this);
}
}
nativePlayer.start();
} catch (MediaException ex) {
ex.printStackTrace();
throw new RuntimeException(ex.toString());
}
}
示例5: prepare
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
public void prepare() {
if (deleted) {
return;
}
try {
nativePlayer.prefetch();
} catch (MediaException ex) {
ex.printStackTrace();
throw new RuntimeException(ex.toString());
}
}
示例6: play
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
public void play() {
if (deleted) {
return;
}
try {
nativePlayer.start();
} catch (MediaException ex) {
ex.printStackTrace();
throw new RuntimeException(ex.toString());
}
}
示例7: pause
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
public void pause() {
if (deleted) {
return;
}
try {
if (nativePlayer != null) {
nativePlayer.stop();
}
} catch (MediaException ex) {
ex.printStackTrace();
throw new RuntimeException(ex.toString());
}
}
示例8: setTime
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
public void setTime(int time) {
if (deleted) {
return;
}
try {
nativePlayer.setMediaTime(time * 1000);
} catch (MediaException ex) {
ex.printStackTrace();
}
}
示例9: MediaRecorder
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
public MediaRecorder(String path) throws IOException {
try {
String [] supportedContentType = Manager.getSupportedContentTypes("capture");
boolean amrSupported = false;
for (int i = 0; i < supportedContentType.length; i++) {
if(supportedContentType[i].equals("audio/amr")){
amrSupported = true;
}
}
if(amrSupported){
try {
//some j2me devices will report they supports amr, but they are actually
//don't so we will try to realize the player and if fails the
//fallback would be to create it with the default capture encoding
recorder = Manager.createPlayer("capture://audio?encoding=audio/amr");
recorder.realize();
} catch (Exception e) {
recorder = Manager.createPlayer("capture://audio");
recorder.realize();
}
}else{
recorder = Manager.createPlayer("capture://audio");
recorder.realize();
}
rc = (RecordControl) recorder.getControl("RecordControl");
out = FileSystemStorage.getInstance().openOutputStream(path);
rc.setRecordStream(out);
} catch (MediaException ex) {
ex.printStackTrace();
}
}
示例10: play
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
public void play() {
try {
rc.startRecord();
recorder.start();
} catch (MediaException ex) {
ex.printStackTrace();
}
}
示例11: pause
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
public void pause() {
try {
rc.stopRecord();
recorder.stop();
} catch (MediaException ex) {
ex.printStackTrace();
}
}
示例12: prepare
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
public void prepare() {
if(deleted){
return;
}
try {
nativePlayer.prefetch();
} catch (MediaException ex) {
ex.printStackTrace();
throw new RuntimeException(ex.toString());
}
}
示例13: VideoMainScreen
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
public VideoMainScreen(MMAPIPlayer p, BlackBerryImplementation impl) {
super(Manager.NO_VERTICAL_SCROLL);
this.player = p;
this.impl = impl;
this.videoControl = (VideoControl) player.nativePlayer.getControl("VideoControl");
if (this.videoControl != null) {
try {
// Initialize the field where the content of the camera shall be displayed.
Field videoField = (Field) this.videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
add(videoField);
addMenuItem(new MenuItem("Pause", 0, 100) {
public void run() {
player.pause();
}
});
addMenuItem(new MenuItem("Play", 0, 100) {
public void run() {
player.play();
}
});
// Display the video control.
this.videoControl.setDisplayFullScreen(true);
this.videoControl.setVisible(true);
} catch (MediaException ex) {
ex.printStackTrace();
}
}
}
示例14: setTime
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
public void setTime(int time) {
if(deleted){
return;
}
try {
nativePlayer.setMediaTime(time * 1000);
} catch (MediaException ex) {
ex.printStackTrace();
}
}
示例15: MediaRecorder
import javax.microedition.media.MediaException; //导入方法依赖的package包/类
public MediaRecorder(String path, String mimeType) throws IOException {
try {
//recorder = Manager.createPlayer("capture://audio?encoding=audio/amr&bitrate=12200&voipMode=true");
recorder = Manager.createPlayer("capture://audio?encoding="+mimeType);
recorder.realize();
rc = (RecordControl) recorder.getControl("RecordControl");
out = FileSystemStorage.getInstance().openOutputStream(path);
rc.setRecordStream(out);
} catch (MediaException ex) {
ex.printStackTrace();
}
}