inspirit / jsfeat

JavaScript Computer Vision library.
MIT License
2.74k stars 374 forks source link

Demos stopped working #84

Open piotrjaw opened 5 years ago

piotrjaw commented 5 years ago

Hi, it seems that the demos stopped working at all, there seems to be a problem with the MediaStream:

screenshot 2019-01-10 at 20 42 33 screenshot 2019-01-10 at 20 50 23
piotrjaw commented 5 years ago

OK so it seems that calling URL.createObjectURL with a MediaStream is deprecated, but all you need to do is to replace:

video.src = compatibility.URL.createObjectURL(stream);

with:

video.srcObject = stream;

and it should work just fine. Would do it myself, but I don't see the demos sourcecode here :(

donaldr commented 4 years ago

Hard to know if I should use this library without seeing a demo. And yes, I realize I can download it and run it locally, but it would be so much easier if this simple change was made.

lubosmato commented 4 years ago

OK so it seems that calling URL.createObjectURL with a MediaStream is deprecated, but all you need to do is to replace:

video.src = compatibility.URL.createObjectURL(stream);

with:

video.srcObject = stream;

and it should work just fine. Would do it myself, but I don't see the demos sourcecode here :(

Exactly. https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL#Usage_notes

Important: If you still have code that relies on createObjectURL() to attach streams to media elements, you need to update your code to simply set srcObject to the MediaStream directly.