You would have to call .then
on that promise, and in the passed function call dispatch
to store the actual stream in the DB.
Also, you should rewrite your video-chat-app
component:
- Don't call dispatch
at the top level of the rendering function (via start-stream
in this case): https://day8.github.io/re-frame/FAQs/LoadOnMount/
- It's likely that you want to use []
instead of ()
with video-stream
: https://github.com/reagent-project/reagent/blob/master/doc/UsingSquareBracketsInsteadOfParens.md
> if I shouldn’t manipulate srcObject with reagent
I think lilactown meant exactly the opposite - you should do it with Reagent, when it makes sense.
Use re-frame for everything that you yourself consider your app's state. Whether "video stream from a web cam that should be displayed in a <video>
tag" is part of your app's state or not - up to you. And of course, sometimes such an ideal still breaks because of how some JS APIs are written - in that case, use whatever's feasible.