Permalink
Browse files

Merge pull request #5 from alejandromg/patch-1

Now getUserMedia and createObjectURL detection actually works.
  • Loading branch information...
2 parents ceabd55 + 008ffbb commit 42023a1678b0afa801e3642b689f498f8fdd69f9 @maxogden committed Jul 6, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 videostreaming-demo/broadcast-bundle.js
@@ -3359,10 +3359,12 @@ function MediaStream(options) {
this.readable = true
var getUserMedia = me.getGetUserMedia()
if (!getUserMedia) return console.log({"error": "getUserMedia not supported in this browser"})
- navigator.webkitGetUserMedia(options,
+ getUserMedia(options,
function(stream) {
var video = me.video = me.createHiddenVideo()
- video.src = window.webkitURL.createObjectURL(stream)
+ var URL = me.URL()
+ if (!URL) return console.log({"error":"createObjectURL not supported in this browser"})
+ video.src = URL.createObjectURL(stream)
video.play()
},
function(err) {
@@ -3385,6 +3387,12 @@ MediaStream.prototype.getGetUserMedia = function() {
return false
}
+MediaStream.prototype.URL = function() {
+ if (window.URL) return window.URL
+ if (window.webkitURL) return window.webkitURL
+ return false
+}
+
MediaStream.prototype.onVideoPlay = function() {
var video = this.video
if (!isNaN(video.duration)) {

0 comments on commit 42023a1

Please sign in to comment.