Wrap webkitGetUserMedia in nextTick for reliability

This commit is contained in:
Kevin Sawicki & Matt Colyer
2013-07-26 17:24:37 -07:00
parent 121ee10f5a
commit 624ca77173

View File

@@ -21,14 +21,17 @@ class MediaConnection
createOutboundStreamPromise: ->
deferred = $.Deferred()
video = config.get('collaboration.video') ? mandatory: { maxWidth: 320, maxHeight: 240 }, optional: []
audio = config.get('collaboration.audio') ? true
success = (stream) =>
@getPeerConnection().addStream(stream)
deferred.resolve(stream)
error = (args...) ->
deferred.reject(args...)
navigator.webkitGetUserMedia({video, audio}, success, error)
_.nextTick =>
video = config.get('collaboration.video') ? mandatory: { maxWidth: 320, maxHeight: 240 }, optional: []
audio = config.get('collaboration.audio') ? true
success = (stream) =>
@getPeerConnection().addStream(stream)
deferred.resolve(stream)
error = (args...) ->
deferred.reject(args...)
navigator.webkitGetUserMedia({video, audio}, success, error)
deferred.promise()
sendOffer: ->