Leo5188
Leo5188

Reputation: 2067

MDN webRTC still photo capture demo stops working recently

I followed MDN's webRTC still photo capture in my own program. It worked well two months ago. Today, when trying the same program, I found that no video input from the webcam can be displayed. In fact, the demo provided by MDN cannot work too. I tried both Chrome Version 66 and Firefox Version 60.0.2 and met the same issue. Does anyone know what has happened on browsers' side causing webRTC failing?

Upvotes: 0

Views: 187

Answers (2)

Leo5188
Leo5188

Reputation: 2067

Finally, found the error reason. In capture.js line 47, need to make the following update. Please see More information about the issue

// Don't do this
video.src = URL.createObjectURL(stream);

// Do this
video.srcObject = stream;

Upvotes: 0

Philipp Hancke
Philipp Hancke

Reputation: 17295

This attempts to set mozSrcObject which has been removed a few Firefox releases ago. Try setting the video elements srcObject to the stream instead -- in any (modern) browser.

The original article also contains relatively up-to-date code

Upvotes: 1

Related Questions