2015-10-20 77 views
0

我做了一下feasability R於一個項目,我一直在思考& d的,問題是我不熟悉的攝像頭API的限制或操作系統本身。科爾多瓦 - 汽車無拍攝和上傳照片

我想寫,當打開(和授權)一科爾多瓦的應用程序,將拍照每隔n秒,並將其上傳到FTP站點。考慮一下像CCTV的功能,我的網站將不斷向用戶呈現最新的圖像。

一些僞代碼:

while (true) { 
     var img = api.takePicture(args); 
     uploadImage(img); 
     thread.sleep(1000); 
} 

所以我的問題是,我可以訪問攝像頭,並指導其採取無需用戶干預的圖片(再次,攝像頭的訪問被授權後)? 任何API調用實現它的例子或方向將非常感激。我看到this文章,答案看起來很有希望,但OP有android,我想知道它在iOS上的表現是否相同。

在一個側面說明,我怎麼測試我的iPhone我的科爾多瓦的應用程序,而無需購買一個應用程序商店的許可證?我只想在我自己的設備上運行它。

回答

0

使用CameraPictureBackground插件解決:

function success(imgurl) { console.log("Imgurl = " + imgurl); //here I added my function to upload the saved pictures //on my internet server using file-tranfer plugin } 
 

 
function onFail(message) { 
 
    alert('Failed because: ' + message); } 
 

 
function CaptureBCK() { 
 
    var options = { 
 
    name: "Image", //image suffix 
 
    dirName: "CameraPictureBackground", //foldername 
 
    orientation: "portrait", //or landscape 
 
    type: "back" //or front 
 
    }; 
 
window.plugins.CameraPictureBackground.takePicture(success, onFail, options); } 
 

 

 
<button onclick="CaptureBCK();">Capture Photo</button> <br>

你會發現CameraPictureBackground目錄下的圖片在你的設備acrhive。我還使用了文件傳輸插件,以便通過互聯網直接上傳服務器上的圖片。