forked from shibing624/python-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwav_record.html
More file actions
34 lines (32 loc) · 899 Bytes
/
wav_record.html
File metadata and controls
34 lines (32 loc) · 899 Bytes
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<div>
<audio controls autoplay aria-controls="controls"></audio>
<input onclick="startRecording()" type="button" value="录音"/>
<input onclick="stopRecording()" type="button" value="停止"/>
<input onclick="playRecording()" type="button" value="播放"/>
</div>
<script type="text/javascript" src="./HZRecorder.js"></script>
<script>
var recorder;
var audio = document.querySelector('audio');
function startRecording() {
HZRecorder.get(function (rec) {
recorder = rec;
recorder.start();
});
}
function stopRecording() {
recorder.stop();
}
function playRecording() {
recorder.play(audio);
}
</script>
</body>
</html>