private void showCamera() { try { releaseResources(); player = Manager.createPlayer("capture://video"); player.addPlayerListener(this); player.realize(); videoControl = (VideoControl) player.getControl("VideoControl"); aVideoCanvas = new VideoCanvas(); aVideoCanvas.initControls(videoControl, player); aVideoCanvas.addCommand(CMD_RECORD); aVideoCanvas.addCommand(CMD_EXIT); aVideoCanvas.setCommandListener(this); parentMidlet.getDisplay().setCurrent(aVideoCanvas); player.start(); contentType = player.getContentType(); } catch (Exception e) { e.printStackTrace(); } }
private void showCamera() { try { mPlayer = Manager.createPlayer("capture://video"); mPlayer.realize(); mVideoControl = (VideoControl) mPlayer.getControl("VideoControl"); Canvas canvas = new CameraCanvas(this, mVideoControl); canvas.addCommand(mBackCommand); canvas.addCommand(mCaptureCommand); canvas.setCommandListener(this); mDisplay.setCurrent(canvas); /* Form form = new Form("Camera form"); Item item = (Item)mVideoControl.initDisplayMode( GUIControl.USE_GUI_PRIMITIVE, null); form.append(item); form.addCommand(mBackCommand); form.addCommand(mCaptureCommand); form.setCommandListener(this); mDisplay.setCurrent(form); */ mPlayer.start(); } catch (IOException ioe) { handleException(ioe); } catch (MediaException me) { handleException(me); } }
// sets volume for player private void setVolume(int value) { try { VolumeControl c = (VolumeControl) player.getControl("VolumeControl"); if ((null != c) && (0 < value)) { c.setLevel(value); } } catch (Exception e) { } }