A MediaStreamTrack ended due to a capture failure

When doing a video call using webrtc and the connection is already made. my video will suddenly freeze and then will become black screen after a few seconds. Would anyone know how to fix this one? The title is the log I'm getting in the console.

Browser: Safari
OS: macOS Big Sur v11.0.1

Replies

I faced the same problem. Video just freezes and becomes a black screen after 10 seconds.
Same problem. It used to work with the old version of Safari (and all other modern browsers). Please fix it quickly, it seems that even popular and widely used libraries are affected by this problem: https://github.com/twilio/twilio-video.js/issues/1281
Additional information:
  1. This issue is not reproducible in a local environment. Everything works fine in a local environment.

  2. When it happens, the "onended" event on the track is not even fired.



We have done some extensive research on this and have determined:

Firstly, this only affects MacBook cameras with Vendor "Apple", not the generic "UVC" cameras.

Secondly, this only occurs if H264 is used as a video codec. If the video codec is forced to VP8, this issue does not occur.

Based on this, this feels like a H264 hardware acceleration incompatibility specifically with Apple cameras.
I'm getting the same error on iPhone Safari (ios14)..

On my webpage I use "getUserMedia" to access camera.. It works for a second, then freezes, and then console spits out: "A MediaStreamTrack ended due to a capture failure".

This suggests it's not related to h264 / VP8 codecs as @af101 mentioned.

One thing I noticed is if I disable and re-enable the webcam fast enough the error doesn't happen.

Please let me know if anyone comes up with a proper workaround solution.

I was able to fix the issue on my end by styling a video element I'm using as a webGL texture as display:block, opacity:0 (instead of display: none).

Perhaps they removed the ability to play offscreen video textures on ios14/big sur.
@sinjinhawke thanks for sharing your case, but I guess it might be a different bug. In my case, I'm not using a webGL texture and the error happens a few seconds after the other peer is connected.
Same problem with macOS 11.1 and Safari 14.0.2. Also reproducible on AppRTC-demo online. Is there already a public issue / ticket on Safari or WebKit?

Is there a ticket open with Safari on this issue. We are facing same issue while trying to capture photos using HTML5 video Media Stream. The track is getting abruptly ended and call back track onended is executing. The console shows error "A MediaStreamTrack ended due to a capture failure"
I need immediate support on this issue, this has been a major production issue for us.


Issue mentioned above from me has been resolved. I made changes to clone the stream object before assigning to video element srcObject and have the MediaStream track stopped end of capture of picture. The stream object is saved in react state and reused on re-render of video element