Created
November 16, 2018 16:18
-
-
Save jan-ivar/c6da408156da9f6172b3395a24a0105e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
already_AddRefed<Promise> | |
MediaDevices::GetUserMedia(const MediaStreamConstraints& aConstraints, | |
CallerType aCallerType, | |
ErrorResult &aRv) | |
{ | |
RefPtr<Promise> p = Promise::Create(GetParentObject(), aRv); | |
if (NS_WARN_IF(aRv.Failed())) { | |
return nullptr; | |
} | |
MediaManager::Get()->GetUserMedia(GetOwner(), aConstraints, aCallerType)->Then( | |
GetCurrentThreadSerialEventTarget(), __func__, | |
[p](RefPtr<DOMMediaStream>&& aStream) mutable { | |
p->MaybeResolve(std::move(aStream)); | |
}, | |
[p](RefPtr<MediaStreamError>&& error) mutable { | |
--> p->MaybeReject(std::move(error)); | |
} | |
); | |
return p.forget(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment