我创建了用于录制音频文件的JavaScript代码。 我想在录制时播放youtube文件,所以我需要将播放功能添加到我的录制功能中,但它不起作用。 究竟我错过了什么?
<!DOCTYPE html>
<html>
<head>
<script src = "http://www.youtube.com/player_api"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>mini demo12
</title>
<style type='text/css'>
ul { list-style: none; }
#recordingslist audio { display: block; margin-bottom: 10px; }
</style>
</head>
<body>
<iframe id="mainVideo" width="640" height="390" src="https://www.youtube.com/embed/9H2oY_85q8U?enablejsapi=1" frameborder="0" allowfullscreen></iframe>
<BR>
<button onclick="startRecording(this);">record</button>
<button onclick="stopRecording(this);" disabled>stop</button>
<button onclick="startPlaying(this)">play</button>
<h2>Tracks</h2>
<ul id="recordingslist"></ul>
<h2>Log</h2>
<pre id="log"></pre>
function startRecording(button) {
recorder && recorder.record();
button.disabled = true;
button.nextElementSibling.disabled = false;
__log('Recording...');
}
<script src="recorder.js"></script>
</body>
</html>