Okay, I got it. Looking through the sources for the p5 dom project I discovered that createCapture takes an optional callback that has a stream object as an argument. getTracks()[0] on the stream should return the current video feed, which can then be closed with stop(). So in my case something resembling the following does the trick (from within an object I have created):
Answers
Yeah, I expected stop() on the returned MediaElement would do it, that's the first thing I tried. No luck, though.
I will try remove () on it as well.
Okay, I got it. Looking through the sources for the p5 dom project I discovered that createCapture takes an optional callback that has a stream object as an argument. getTracks()[0] on the stream should return the current video feed, which can then be closed with stop(). So in my case something resembling the following does the trick (from within an object I have created):
var stream;
this.setup = function () { capture = p.createCapture(p.VIDEO, function(streamRef) { stream = streamRef; }); }
this.onDeinit = function() { stream.getTracks()[0].stop(); }