2012-08-23 72 views
0

我目前正在研究一個項目,需要使用移動照相機設備來製作照片並將它們發送到遠程服務器。如何從遠程服務器運行android web cam?

問題是我們不需要移動原生應用程序,而是一個Web應用程序,其所有代碼都部署在遠程服務器上。例如一個可以製作照片並將其部署到服務器的JavaScript代碼。我想知道是否有可能以這種方式使用相機功能?

我嘗試了三星Galaxy S3上的gwt-phonegap 1.8.1的Geolocation API和Andoird 4.0.3,其中的web應用程序託管在遠程服務器上,它工作正常,但是當我嘗試打開相機並拍照時,那麼只顯示一張TODO照片。問題在我身邊還是這個功能還沒有實現,或者它不應該以這種方式工作?

這裏是我的代碼片段顯示實際使用相機

PictureOptions options = new PictureOptions(25); 
     options.setDestinationType(PictureOptions.DESTINATION_TYPE_DATA_URL); 
     options.setSourceType(PictureOptions.PICTURE_SOURCE_TYPE_CAMERA); 

     final Image image = new Image(); 

     if (phoneGap.getCamera() != null) { 
      message += "camera was detected and we are trying to take a photo"; 

      phoneGap.getCamera().getPicture(options, new PictureCallback() { 

      public void onSuccess(String data) { 
//  display.setImageData("data:image/jpeg;base64," + data); 
       image.setUrl("data:image/jpeg;base64," + data); 
       panel.add(image); 
      } 

      @Override 
      public void onFailure(String message) { 
       Window.alert("Photo not successful"); 
      } 

      }); 

     } else { 
      message += "camera was not detected"; 
      message += " " + phoneGap.getClass().getName(); 

     } 

     label.setText(message); 

回答