Skip to content

Commit

Permalink
getUserMedia(): invoke errback if video constraints were not satisfie…
Browse files Browse the repository at this point in the history
…d (related to cordova-rtc#107)
  • Loading branch information
ibc committed Dec 15, 2015
1 parent fb236f6 commit 497a73f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/PluginGetUserMedia.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ class PluginGetUserMedia {
constraints: constraints
)

// If videoSource state is "ended" it means that constraints were not satisfied so
// invoke the given errback
if (rtcVideoSource!.state == RTCSourceStateEnded) {
NSLog("PluginGetUserMedia() | rtcVideoSource.state is 'ended', constraints not satisfied")

errback(error: "constraints not satisfied")
return
}

rtcVideoTrack = self.rtcPeerConnectionFactory.videoTrackWithID(NSUUID().UUIDString,
source: rtcVideoSource
)
Expand Down

0 comments on commit 497a73f

Please sign in to comment.