+
39
-

js中mediaRecorder如何录制window.speechSynthesis声音音频并下载?

js中mediaRecorder如何录制window.speechSynthesis声音音频并下载?


网友回复

+
12
-

在Web浏览器中,直接使用MediaRecorder录制来自window.speechSynthesis(文本转语音)的音频流并不是一件直接的事情,因为MediaRecorder通常用于录制来自麦克风、摄像头或屏幕的媒体流,而window.speechSynthesis并不提供音频流接口。

但是可以通过屏幕录制getDisplayMedia实现,录制的时候选择整个屏幕,勾选同时分享系统音频。

800_auto

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" />
    <title>BFW NEW PAGE</title>
   
     <style>
      </style>
</head>
<body>
   <button id="start">开始录制</button>
<button id="stop" disabled>停止并下载</button>
<script>
  const startBtn = document.getElementById('sta...

点击查看剩余70%

我知道答案,我要回答