Audio works but video stays empty.

Hey!

Im trying to create a simple app where users can share their cameras and hear each other.
The audio works perfectly fine, but the video just doesn’t play. I’ve followed through all the instructions are the mediasoup docs (At least I very much hope so) but I still cant get the video to work.

Here is my client side:

const consumers = getConsumers()

let videoTrack: MediaStreamTrack | null = null
let audioTrack: MediaStreamTrack | null = null

for (const consumer of consumers) {
    if (consumer.kind === 'video') {
        videoTrack = consumer.track
        await webRtcConnection.signallingChannel.resume(consumer.id)
    } else {
        audioTrack = consumer.track
    }
}

# ... later on
peerVideo.srcObject = new MediaStream([ videoTrack ])
peerVideo.play()

peerAudio.srcObject = new MediaStream([ audioTrack ])
peerAudio.play()

Any help is greatly appreciated. Thanks in advance :slight_smile:

I think something must be off with video consumer resuming. DevTools for WebRTC in the browser are your friends, it is much faster to consult with them than for some to guess on the forum.

After playing around with my code quite a lot, it seems the root of my problem was actually
the video codec I used on the server side upon initializing the router. I switched from “video/h264” to “video/vp8” and then it suddenly worked.

Which is very strange to me, because in this case, should it fail in mediaSoupRouter.canConsume...?