No, Elm doesn't provide access to JavaScript promises. But what it really 
boils down to is that from Elm you cannot access a JavaScript object 
directly. You need a *foreign-function interface* to act as a gateway 
between Elm and JavaScript, which is what Elm ports do: 
http://guide.elm-lang.org/interop/javascript.html

Basically, to access the MediaStream API from Elm, you can:

1. Create Elm ports to allow your Elm code to make requests against the 
MediaStream API. You'd end up with Tasks that then you'd execute like any 
other Task using the Elm architecture.
2. Create Elm ports to allow your Elm code to subscribe to responses and 
events from the MediaStream API.
2. On the JavaScript side, add code to respond and reply to requests coming 
through the aforementioned Elm ports. The tricky part here is that the 
MediaStream API is stateful, and there's really no way I can think of to 
serialize this state and pass it back and forth between JavaScript and Elm, 
so you'll have to manage the MediaStream state on the JavaScript side.




On Tuesday, November 8, 2016 at 4:24:41 PM UTC-5, Chris Van Vranken wrote:
>
> I am trying to call GetUserMedia with the MediaStream API,  which requires 
> the use of Promises.  Is there a good way to work with promises in Elm at 
> this point?  Can it be done with Task or Process API?  Or should this piece 
> of my code be done entirely in Javascript?  Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to