2016-04-21 42 views
0

所以情況就是這樣,我正在使用cordova來製作應用程序。該應用程序的功能之一是讓用戶錄製他們的視頻。這段視頻應該在錄製後立即顯示在應用中。我設法讓應用程序記錄視頻,然後將視頻存儲在用戶的手機中。但是,當我嘗試添加視頻時,它無法播放。使用cordova + ionic錄製後,視頻不會在android手機上播放?

請幫我解決這個問題。提前致謝。

下面是頁面的HTML代碼:

<!DOCTYPE html> 
<html> 
    <head> 
     <meta charset="utf-8"> 
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
     <title>Practise</title> 
     <meta name="description" content=""> 
     <meta name="viewport" content="width=device-width"> 
     <link rel="stylesheet" type="text/css" href="css/practise.css" /> 

    </head> 

    <body> 

     <div id="videoArea"></div> 
     <button id="takeVideo" class="button button-positive button-block">Take Video</button> 

    <script src="cordova.js"></script> 
    <script src="js/practise.js"></script> 

    </body> 

</html> 

這裏的JavaScript代碼來與它一起去:

document.addEventListener("deviceready", captureVideo, false); 
function captureVideo() { 

document.querySelector("#takeVideo").addEventListener("touchend", function() { 
     console.log("Take video"); 
     navigator.device.capture.captureVideo(captureSuccess, captureError, {limit: 1}); 
    }, false); 

} 

function captureError(e) { 
    console.log("capture error: "+JSON.stringify(e)); 
} 

function captureSuccess(s) { 
    console.log("Success"); 
    console.dir(s[0]); 

    var path; 

    path = s[0].fullPath; 
    document.querySelector("#videoArea").innerHTML = "<video> <source src=\""+path+"\""+" type=\"video/mp4\"> </video>"; 

} 

回答

0

你能提供的設備型號,科爾多瓦版本,和離子版本你有這個問題。 此外,你可以打印fullPath並在這裏提供它。

我們可能能夠告訴您該信息出了什麼問題。

如果您更願意使用商業插件來更快地將您的應用推向市場,您還可以查看Onymos Media component

相關問題