Posts

Showing posts with the label html5

Solution for "DOMException: Failed to load because no supported source was found" error in Chrome with HTML5 media API

After updating Chrome to release 53 this week, my web application was no longer able to use the media API to capture video with a webcam. This is the third time that I am forced to update my code due to changes in Chrome... this is getting a little annoying! The error message I was getting in my javascript console is: DOMException: Failed to load because no supported source was found I'll keep it short. The problem was the way I set the source of my media element. I was setting the source like this: navigator.getUserMedia(videoObj, function(stream) {    CaptureImageStream = stream;    CaptureImageVideo.src = stream ;    CaptureImageVideo.play(); }, errBack); It seems like this is no longer supported. I changed it to this and it now works again: navigator.getUserMedia(videoObj, function(stream) {    CaptureImageStream = stream;    CaptureImageVideo.src = window.URL.createObjectURL(stream) ;    CaptureImageVi...

HTML5 video capture from browser: error with "stop() not a function"

A quick blog post about recent changes in the MediaStream API support in modern browsers. I had previously developed a function allowing users to capture images from their webcam, based on tutorials found on the web. Here was my code to initialize the capture canvas: function CaptureImageBeginCapture () { CaptureImageCanvas = $ ( "#ImageCaptureCanvas" )[ 0 ]; var videoObj = { "video" : true }, errBack = function (error) { console . log ( "Video capture error: " , error. code ); }; CaptureImageVideo = $ ( "#ImageCapturePreviewFrame" )[ 0 ]; CaptureImageContext = CaptureImageCanvas . getContext ( "2d" ); // Put video listeners into place if ( navigator .getUserMedia) { // Standard navigator .getUserMedia( videoObj , function (stream) { CaptureImageStream = stream; CaptureImageVideo . src = stream; CaptureImageVideo . play (); }, errBack ); } else if ( n...