相信它应该是可能的。
目前我只能从一个获取流:
let mediaElement = document.createElement("img");
mediaElement.className = "fileMedia";
mediaElement.style.maxWidth = "280px";
mediaElement.crossOrigin = "anonymous";
mediaElement.controls = true;
mediaElement.src = URL.createObjectURL(selectedLocalMedia); // a file from type="file" input
let audioCtx = new AudioContext();
// create placeholder stream from our AudioContext
let dest = audioCtx.createMediaStreamDestination();
this.audioStream[pluginHandleIndex] = dest.stream;
// connect our video element's output to the stream
let sourceNode = audioCtx.createMediaElementSource(mediaElement);
// if (pluginHandleIndex > 0) {
// let testvideo = document.getElementById("testvideo");
// let sourceNodeTwo = audioCtx.createMediaElementSource(testvideo);
// sourceNodeTwo.connect(dest);
// }
sourceNode.connect(dest);
sourceNode.connect(audioCtx.destination);
如何向this.audioStream[pluginHandleIndex]
(audioCtx.createMediaStreamDestination()
)添加更多音频流?
如果您看到注释行
// if (pluginHandleIndex > 0) {
// let testvideo = document.getElementById("testvideo");
// let sourceNodeTwo = audioCtx.createMediaElementSource(testvideo);
// sourceNodeTwo.connect(dest);
// }
我试着像第一次一样加入tome,但这似乎不起作用:/
谢谢!