David,

Yes, that looks good although I don't really think I am dealing with
polyfill (because I don't know what it is). I tried pasting that code
directly into my JHS and could not make it work.

Also, because you pointed me there, I looked more carefully at the original
link which had commented out some "legacy code". I had not noticed that if
the whole conditional fails it actually tests the first conditional phrase
and attempts to deal with that. That code produces an error I have not been
able to understand in Chrome:

ev_body_load failed: TypeError: Failed to execute 'webkitGetUserMedia' on
'Navigator': The callback provided as parameter 3 is not a function.


I am also getting an error in FireFox when about "context" being undefined
even though I have the following definition.

var context = canvas.getContext('2d');

I can't decide whether the snapping of a picture (in JHS) should be done as
listener in the way the article suggests, or whether the JHS button defined
in HBS with `'snap'jhb'Snap Photo'` should be given an ev definition like
the following one. So far, it appears that this function definition is the
one triggering the context error I mention above.

function ev_snap_click(){context.drawImage(video, 0, 0, 640, 480);}

Thanks for you help,

On Sat, Jun 3, 2017 at 5:57 PM, David Mitchell <davidmitch...@att.net>
wrote:

> This looked interesting to me:
>
> https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
>
> Using the new API in older browsers
>
> Here's an example of using navigator.mediaDevices.getUserMedia(), with a
> polyfill to cope with older browsers. Note that this polyfill does not
> correct for legacy differences in constraints syntax, which means
> constraints won't work well across browsers. It is recommended to use the
> adapter.js polyfill instead, which does handle constraints.
>
>
>>

-- 
(B=) <-----my sig
Brian Schott
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to