Media stream

This commit is contained in:
EpicKiwi 2023-09-21 12:19:11 +02:00
parent 980d6822d0
commit d5c8fcd055
Signed by: epickiwi
GPG Key ID: C4B28FD2729941CE

View File

@ -46,15 +46,12 @@
throw new Error("Element don't habe video track") throw new Error("Element don't habe video track")
} }
const canvasAudioTracks = canvasStream.getAudioTracks()
if(canvasAudioTracks.length > 0){
const AudioContext = window.AudioContext || window.webkitAudioContext; const AudioContext = window.AudioContext || window.webkitAudioContext;
if(AudioContext){ if(AudioContext){
const audioContext = new AudioContext(); const audioContext = new AudioContext();
audioContext.createMediaStreamTrackSource(canvasAudioTracks[0]) audioContext.createMediaStreamSource(canvasStream)
.connect(audioContext.destination) .connect(audioContext.destination)
} }
}
const offer = await conn.createOffer(); const offer = await conn.createOffer();
await conn.setLocalDescription(offer); await conn.setLocalDescription(offer);