Update WebRTC passive producer handling
This commit is contained in:
+7
-7
@@ -26,13 +26,6 @@
|
||||
|
||||
const localTracks = []
|
||||
|
||||
if (/video|audio/.test(media)) {
|
||||
const tracks = ['video', 'audio']
|
||||
.filter(kind => media.indexOf(kind) >= 0)
|
||||
.map(kind => pc.addTransceiver(kind, {direction: 'recvonly'}).receiver.track)
|
||||
localTracks.push(...tracks)
|
||||
}
|
||||
|
||||
if (/camera|microphone/.test(media)) {
|
||||
const tracks = await getMediaTracks('user', {
|
||||
video: media.indexOf('camera') >= 0,
|
||||
@@ -55,6 +48,13 @@
|
||||
})
|
||||
}
|
||||
|
||||
if (/video|audio/.test(media)) {
|
||||
const tracks = ['video', 'audio']
|
||||
.filter(kind => media.indexOf(kind) >= 0)
|
||||
.map(kind => pc.addTransceiver(kind, {direction: 'recvonly'}).receiver.track)
|
||||
localTracks.push(...tracks)
|
||||
}
|
||||
|
||||
document.getElementById('video').srcObject = new MediaStream(localTracks)
|
||||
|
||||
return pc
|
||||
|
||||
Reference in New Issue
Block a user