예제 #1
0
 private void  discardPlayer()
 {
     if (player != null)
     {
         player.close();
         player = null;
     }
     videoControl = null;
 }
예제 #2
0
 public CameraCanvas(QRCodeDecoderMIDletExample midlet)
 {
     this.midlet = midlet;
     exitCommand = new Command("Exit", Command.EXIT, 1);
     addCommand(exitCommand);
     setCommandListener(this);
     try
     {
         player = Manager.createPlayer("capture://video");
         player.realize();
         videoControl = (VideoControl)player.getControl("VideoControl");
         if (videoControl == null)
         {
             discardPlayer();
             message1 = "Unsupported:";
             message2 = "Can't get video control";
         }
         else
         {
             videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
             captureCommand = new Command("Capture", Command.SCREEN, 1);
             addCommand(captureCommand);
         }
     }
     catch (System.IO.IOException ioe)
     {
         discardPlayer();
         message1 = "IOException:";
         //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
         message2 = ioe.Message;
     }
     catch (MediaException me)
     {
         discardPlayer();
         message1 = "MediaException:";
         message2 = me.getMessage();
     }
     catch (System.Security.SecurityException se)
     {
         discardPlayer();
         message1 = "SecurityException";
         //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
         message2 = se.Message;
     }
 }
 private void discardPlayer()
 {
     if (player != null)
     {
         player.close();
         player = null;
     }
     videoControl = null;
 }
 public CameraCanvas(QRCodeDecoderMIDletExample midlet)
 {
     this.midlet = midlet;
     exitCommand = new Command("Exit", Command.EXIT, 1);
     addCommand(exitCommand);
     setCommandListener(this);
     try
     {
         player = Manager.createPlayer("capture://video");
         player.realize();
         videoControl = (VideoControl) player.getControl("VideoControl");
         if (videoControl == null)
         {
             discardPlayer();
             message1 = "Unsupported:";
             message2 = "Can't get video control";
         }
         else
         {
             videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
             captureCommand = new Command("Capture", Command.SCREEN, 1);
             addCommand(captureCommand);
         }
     }
     catch (System.IO.IOException ioe)
     {
         discardPlayer();
         message1 = "IOException:";
         //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
         message2 = ioe.Message;
     }
     catch (MediaException me)
     {
         discardPlayer();
         message1 = "MediaException:";
         message2 = me.getMessage();
     }
     catch (System.Security.SecurityException se)
     {
         discardPlayer();
         message1 = "SecurityException";
         //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
         message2 = se.Message;
     }
 }