0
有沒有人有用Phonegap錄製音頻和播放的源代碼?我已經嘗試過Phonegap API page的sourceCode,但是我無法得到它的效果。用iphone手機在iphone上錄製音頻
有沒有人有用Phonegap錄製音頻和播放的源代碼?我已經嘗試過Phonegap API page的sourceCode,但是我無法得到它的效果。用iphone手機在iphone上錄製音頻
嘗試
<script type="text/javascript" charset="utf-8">
// Called when capture operation is finished
//
function captureSuccess(mediaFiles) {
var i, len;
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
uploadFile(mediaFiles[i]);
}
}
// Called if something bad happens.
//
function captureError(error) {
var msg = 'An error occurred during capture: ' + error.code;
navigator.notification.alert(msg, null, 'Uh oh!');
}
// A button will call this function
//
function captureAudio() {
// Launch device audio recording application,
// allowing user to capture up to 2 audio clips
navigator.device.capture.captureAudio(captureSuccess, captureError, {limit: 2});
}
// Upload files to server
function uploadFile(mediaFile) {
var ft = new FileTransfer(),
path = mediaFile.fullPath,
name = mediaFile.name;
ft.upload(path,
"http://my.domain.com/upload.php",
function(result) {
console.log('Upload success: ' + result.responseCode);
console.log(result.bytesSent + ' bytes sent');
},
function(error) {
console.log('Error uploading file ' + path + ': ' + error.code);
},
{ fileName: name });
}
</script>
與
<input type="button" class="button-big" style="width: 100%;" onclick="captureAudio();" value="RECORD AUDIO NOTES">
在我的按鈕中有一個樣式的負載,但嘗試** onclick =「captureAudio();」 **作爲功能... –
也許你可以發佈你已經嘗試過讓其他人可以揣摩什麼是錯 –
發佈您的代碼的傢伙,我會盡力幫助你。 – jcrowson
嗨!任何解決方案? – Frade