我想在群组视频通话中添加一个隐藏的参与者,以播放歌曲流作为参与者的语音(无视频),并进行一些控制,例如无论何时我们想要停止或开始,我们都可以。我正在尝试将来自 URL 的媒体流作为曲目传递,同时发出连接请求以加入房间。我正在为此任务使用快速入门示例:
try {
// Fetch an AccessToken to join the Room.
const response = await fetch(`/token?identity=${identity}`);
// Extract the AccessToken from the Response.
const token = await response.text();
// Add the specified Room name to ConnectOptions.
connectOptions.name = roomName;
const audio = new Audio("http://mediaserv30.live-streams.nl:8086/live");
const ctx = new (window.AudioContext || window.webkitAudioContext)();
const stream_dest = ctx.createMediaStreamDestination();
const source = ctx.createMediaElementSource(audio);
source.connect(stream_dest);
const stream = stream_dest.stream;
console.log("==================", stream.getAudioTracks());
const tracks = stream.getTracks().map(track => track.kind === 'audio' ? new LocalAudioTrack(track) : new LocalVideoTrack(track));
connectOptions.tracks = tracks;
await joinRoom(token, connectOptions);
}
这是我运行后得到的:
非常感谢任何帮助。几天以来,我一直被这个问题困扰。