Skip to content

Now getUserMedia and createObjectURL detection actually works. #5

Merged
merged 1 commit into from Jul 6, 2012
View
12 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)) {
Something went wrong with that request. Please try again.