本文整理汇总了Java中javax.microedition.media.control.VideoControl类的典型用法代码示例。如果您正苦于以下问题:Java VideoControl类的具体用法?Java VideoControl怎么用?Java VideoControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VideoControl类属于javax.microedition.media.control包,在下文中一共展示了VideoControl类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: paint
import javax.microedition.media.control.VideoControl; //导入依赖的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();
}
}
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:24,代码来源:GameCanvasImplementation.java
示例2: takeSnapshot
import javax.microedition.media.control.VideoControl; //导入依赖的package包/类
private byte[] takeSnapshot() throws MediaException {
String bestEncoding = guessBestEncoding();
VideoControl videoControl = barCodeScanner.getVideoControl();
if (videoControl == null) {
throw new MediaException("Can't obtain video control");
}
byte[] snapshot = null;
try {
snapshot = videoControl.getSnapshot("".equals(bestEncoding) ? null : bestEncoding);
} catch (MediaException me) {
}
if (snapshot == null) {
// Fall back on JPEG; seems that some cameras default to PNG even
// when PNG isn't supported!
snapshot = videoControl.getSnapshot("encoding=jpeg");
if (snapshot == null) {
throw new MediaException("Can't obtain a snapshot");
}
}
return snapshot;
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:24,代码来源:SnapshotThread.java
示例3: CameraCanvas
import javax.microedition.media.control.VideoControl; //导入依赖的package包/类
public CameraCanvas(MIDlet midlet, VideoControl videoControl) {
int width = getWidth();
int height = getHeight();
// mMIDlet = midlet;
videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
try {
videoControl.setDisplayLocation(2, 2);
videoControl.setDisplaySize(width - 4, height - 4);
}
catch (MediaException me) {
try { videoControl.setDisplayFullScreen(true); }
catch (MediaException me2) {}
}
videoControl.setVisible(true);
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:18,代码来源:CameraCanvas.java
示例4: showCamera
import javax.microedition.media.control.VideoControl; //导入依赖的package包/类
private void showCamera() {
try {
mPlayer = Manager.createPlayer("capture://video");
mPlayer.realize();
mVideoControl = (VideoControl) mPlayer.getControl("VideoControl");
// Command mExitCommand = new Command("Exit", Command.EXIT, 0);
// Command mCameraCommand = new Command("Camera", Command.SCREEN, 0);
mBackCommand = new Command("Back", Command.BACK, 0);
mCaptureCommand = new Command("Capture", Command.SCREEN, 0);
Canvas canvas = new CameraCanvas(null, mVideoControl);
canvas.addCommand(mBackCommand);
canvas.addCommand(mCaptureCommand);
canvas.setCommandListener(this);
J2MEDisplay.setView(canvas);
mPlayer.start();
} catch (IOException ioe) {
handleException(ioe);
} catch (MediaException me) {
handleException(me);
}
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:26,代码来源:ImageCaptureState.java
示例5: CameraCanvas
import javax.microedition.media.control.VideoControl; //导入依赖的package包/类
public CameraCanvas(TioPatinhasMIDlet midlet, VideoControl videoControl) {
int width = getWidth();
int height = getHeight();
mTioPatinhasMIDlet = midlet;
videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
try {
videoControl.setDisplayLocation(2, 2);
videoControl.setDisplaySize(width - 4, height - 4);
}
catch (MediaException me) {
try { videoControl.setDisplayFullScreen(true); }
catch (MediaException me2) {}
}
videoControl.setVisible(true);
}
开发者ID:gstiebler,项目名称:tio_patinhas,代码行数:18,代码来源:CameraCanvas.java
示例6: startScan
import javax.microedition.media.control.VideoControl; //导入依赖的package包/类
public void startScan() {
try {
System.gc();
player = Manager.createPlayer("capture://video");
player.realize();
multimediaManager.setZoom(player);
multimediaManager.setExposure(player);
multimediaManager.setFlash(player);
player.start();
videoControl = (VideoControl) player.getControl("VideoControl");
viewFinder = (Field) videoControl.initDisplayMode(
VideoControl.USE_GUI_PRIMITIVE,
"net.rim.device.api.ui.Field");
if (videoControl != null) {
viewFinderScreen = new ViewFinderScreen();
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
UiApplication.getUiApplication().pushScreen(
viewFinderScreen);
viewFinder.setFocus();
}
});
videoControl.setVisible(true);
videoControl.setDisplayFullScreen(true);
task = new BarcodeScanTask();
// create timer every 3 seconds, get a screenshot
timer = new Timer();
timer.schedule(task, 0, 3000); // once every 3 seconds
} else {
throw new MediaException("Video Control is not initialized");
}
} catch (Exception e) {
callback.scanError(-1, e.getMessage());
}
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:41,代码来源:CodeScannerImpl.java
示例7: VideoMainScreen
import javax.microedition.media.control.VideoControl; //导入依赖的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();
}
}
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:34,代码来源:VideoMainScreen.java
示例8: addCameraViewer
import javax.microedition.media.control.VideoControl; //导入依赖的package包/类
private void addCameraViewer() throws MediaException, IOException {
String refForCamera = "";
//#if polish.identifier.motorola/v3xx
refForCamera = "capture://camera";
//#elif polish.group.series60e3
refForCamera = "capture://devcam0";
//#else
refForCamera = "capture://video";
//#endif
String[] contentTypes = Manager.getSupportedContentTypes("capture");
if (contentTypes == null || contentTypes.length == 0) {
throw new MediaException("capture not supported");
}
for (int i = 0; i < contentTypes.length; i++) {
String contentType = contentTypes[i];
if ("image".equals(contentType)) { // this is the case on Series 40,
// for example
refForCamera = "capture://image";
}
}
System.out.println("Starting player");
player = Manager.createPlayer(refForCamera);
player.realize();
videoControl = (VideoControl) player.getControl("VideoControl");
videoItem = (javax.microedition.lcdui.Item) videoControl
.initDisplayMode(GUIControl.USE_GUI_PRIMITIVE, null);
showVideoScreen();
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:35,代码来源:ImageCaptureScreen.java
示例9: toFullScreen
import javax.microedition.media.control.VideoControl; //导入依赖的package包/类
public Canvas toFullScreen(VideoControl caller, MIDPVideoPainter painter) {
if (fullScreen == null) {
fullScreen = new FullScreenCanvas();
}
if (display == null) {
MMHelper mmh = MMHelper.getMMHelper();
if (mmh == null)
return null;
display = mmh.getDisplayFor(this);
if (display == null)
return null;
}
callerVideoControl = caller;
videoPainter = painter;
if (oldDisplayable == null)
oldDisplayable = display.getCurrent();
// Setting fullscreen canvas
display.setCurrent(fullScreen);
fullScreen.setFullScreenMode(true);
return fullScreen;
}
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:29,代码来源:MMCustomItem.java
示例10: VideoPlay
import javax.microedition.media.control.VideoControl; //导入依赖的package包/类
public VideoPlay(byte[] video, UiApplication MonApp) {
int direction = Display.DIRECTION_NORTH;
Ui.getUiEngineInstance().setAcceptableDirections(direction);
_video = video;
_MonApp = MonApp;
try {
this.addMenuItem(_ScreenShootitem);
ByteArrayInputStream is = new ByteArrayInputStream(video);
player = javax.microedition.media.Manager.createPlayer(is,
"video/mp4");
player.realize();
player.prefetch();
player.addPlayerListener(new Playerlst(item));
VideoControl videoControl = (VideoControl) player
.getControl("VideoControl");
Field videoField = (Field) videoControl.initDisplayMode(
VideoControl.USE_GUI_PRIMITIVE,
"net.rim.device.api.ui.Field");
add(videoField);
VolumeControl volume = (VolumeControl) player
.getControl("VolumeControl");
volume.setLevel(30);
player.start();
item.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
close();
}
});
} catch (MediaException me) {
error = true;
Dialog.alert("Error while opening the snap :" + me.toString());
return;
} catch (IOException ioe) {
error = true;
Dialog.alert(ioe.toString());
return;
}
}
开发者ID:PropheteMath,项目名称:CrapSnap,代码行数:41,代码来源:VideoPlay.java
示例11: CameraImage
import javax.microedition.media.control.VideoControl; //导入依赖的package包/类
/** Creates a new instance of CameraImage
* @param imgListener
*/
public CameraImage(VirtualList parentList, CameraImageListener imgListener/*, String sizes*/) {
this.imgListener = imgListener;
this.parentList = parentList;
//if (sizes!=null) this.sizes=sizes;
int exp=0;
try {
String uri= Config.getInstance().NokiaS40 ? "capture://image" : "capture://video";
player = Manager.createPlayer(uri);
player.realize();
videoControl = (VideoControl)player.getControl("VideoControl");
Form form = new Form("Camera");
Item item = (Item)videoControl.initDisplayMode(
GUIControl.USE_GUI_PRIMITIVE, null);
form.append(item);
form.addCommand(cmdShot);
form.addCommand(cmdCancel);
form.setCommandListener(this);
midlet.BombusMod.getInstance().setDisplayable(form);
player.start();
} catch (Exception e) {
}
}
开发者ID:BombusMod,项目名称:BombusMod,代码行数:31,代码来源:CameraImage.java
示例12: calcPreferredSize
import javax.microedition.media.control.VideoControl; //导入依赖的package包/类
/**
* @inheritDoc
*/
protected Dimension calcPreferredSize() {
VideoControl v = getVideoControl(this);
return new Dimension(v.getDisplayWidth(), v.getDisplayHeight());
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:8,代码来源:GameCanvasImplementation.java
示例13: getVideoControl
import javax.microedition.media.control.VideoControl; //导入依赖的package包/类
VideoControl getVideoControl() {
return (VideoControl) media.getVideoComponent().getClientProperty("VideoControl");
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:4,代码来源:BarCodeScanner.java
示例14: getVideoControl
import javax.microedition.media.control.VideoControl; //导入依赖的package包/类
/**
* Get the video control
*
* @return video control instance
*/
public VideoControl getVideoControl() {
return videoControl;
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:9,代码来源:CodeScannerImpl.java
注:本文中的javax.microedition.media.control.VideoControl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论