标签:char font padding asc title lin duration 长度 nts
1
|
cordova plugin add cordova-plugin-media-capture |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
<!DOCTYPE html> <html> <head> <title>Capture Audio</title> <meta http-equiv= "Content-type" content= "text/html; charset=utf-8" > <script type= "text/javascript" charset= "utf-8" src= "cordova.js" ></script> <script type= "text/javascript" charset= "utf-8" > function audioCapture() { //开始录音(最长录制时间:15秒) navigator.device.capture.captureAudio(onSuccess, onError, {duration: 15}); //录制成功 function onSuccess(mediaFiles) { var i, path, len; //遍历获取录制的文件(iOS只支持一次录制一个视频或音频) for (i = 0, len = mediaFiles.length; i < len; i += 1) { console.log(mediaFiles); path = mediaFiles[i].fullPath; alert( "录制成功!\n\n" + "文件名:" + mediaFiles[i].name + "\n" + "大小:" + mediaFiles[i].size + "\n\n" + "localURL地址:" + mediaFiles[i].localURL + "\n\n" + "fullPath地址:" + path); } } //录制失败 function onError(error) { alert( ‘录制失败!错误码:‘ + error.code); } } </script> </head> <body style= "padding-top:50px" > <button style= "font-size:23px;" onclick= "audioCapture();" >开始录音</button> </body> </html> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
<!DOCTYPE html> <html> <head> <title>Capture Video</title> <meta http-equiv= "Content-type" content= "text/html; charset=utf-8" > <script type= "text/javascript" charset= "utf-8" src= "cordova.js" ></script> <script type= "text/javascript" charset= "utf-8" > function videoCapture() { //开始录像(最长录制时间:15秒) navigator.device.capture.captureVideo(onSuccess, onError, {duration: 15}); //录制成功 function onSuccess(mediaFiles) { var i, path, len; //遍历获取录制的文件(iOS只支持一次录制一个视频或音频) for (i = 0, len = mediaFiles.length; i < len; i += 1) { console.log(mediaFiles); path = mediaFiles[i].fullPath; alert( "录制成功!\n\n" + "文件名:" + mediaFiles[i].name + "\n" + "大小:" + mediaFiles[i].size + "\n\n" + "localURL地址:" + mediaFiles[i].localURL + "\n\n" + "fullPath地址:" + path); } } //录制失败 function onError(error) { alert( ‘录制失败!错误码:‘ + error.code); } } </script> </head> <body style= "padding-top:50px" > <button style= "font-size:23px;" onclick= "videoCapture();" >开始录像</button> </body> </html> |
标签:char font padding asc title lin duration 长度 nts
原文地址:http://www.cnblogs.com/rainMicro/p/7272946.html