マイクで集音し、それを内蔵スピーカーやイヤホンから出力するアプリがつくりたい
発生している問題・エラーメッセージ
Uncaught SyntaxError:Unexpected token[ www/index.html:18
該当のソースコード
monaca
1<!DOCTYPE HTML> 2<html> 3<head> 4 <meta charset="utf-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> 6 <meta http-equiv="Content-Security-Policy" content="default-src * data: gap: content: https://ssl.gstatic.com; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'"> 7 <script src="components/loader.js"></script> 8 <link rel="stylesheet" href="components/loader.css"> 9 <link rel="stylesheet" href="css/style.css"> 10 <script> 11 document.addEventListener("deviceready", onDeviceReady, false); 12function onDeviceReady() { 13 console.log(navigator.device.capture); 14}// limit capture operation to 3 media files, no longer than 10 seconds each 15var options = { limit: 3, duration: 10 }; 16 17navigator.device.capture.captureAudio(captureSuccess, captureError, options); 18function captureSuccess( MediaFile[] mediaFiles ) { ... }; 19function captureSuccess(mediaFiles) { 20 var i, path, len; 21 for (i = 0, len = mediaFiles.length; i < len; i += 1) { 22 path = mediaFiles[i].fullPath; 23 // do something interesting with the file 24 } 25}; 26function captureError( CaptureError error ) { ... }; 27// capture error callback 28var captureError = function(error) { 29 navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error'); 30}; 31// capture callback 32var captureSuccess = function(mediaFiles) { 33 var i, path, len; 34 for (i = 0, len = mediaFiles.length; i < len; i += 1) { 35 path = mediaFiles[i].fullPath; 36 // do something interesting with the file 37 } 38}; 39 40// capture error callback 41var captureError = function(error) { 42 navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error'); 43}; 44 45// start audio capture 46navigator.device.capture.captureAudio(captureSuccess, captureError, {limit:2}); 47function onDeviceReady() { 48 // pendingcaptureresult is fired if the capture call is successful 49 document.addEventListener('pendingcaptureresult', function(mediaFiles) { 50 // Do something with result 51 }); 52 53 // pendingcaptureerror is fired if the capture call is unsuccessful 54 document.addEventListener('pendingcaptureerror', function(error) { 55 // Handle error case 56 }); 57} 58 59// Only subscribe to events after deviceready fires 60document.addEventListener('deviceready', onDeviceReady); 61 </script> 62</head> 63<body> 64 <br /> 65 This is a template for Monaca app. 66</body> 67</html> 68
monacaのpluginの使い方について教えてください
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
あなたの回答
tips
プレビュー