Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Now getUserMedia and createObjectURL detection actually works. #5

Merged
merged 1 commit into from almost 2 years ago

2 participants

Alejandro Morales Max Ogden
Alejandro Morales

Useful for non-webkit browsers (a.k.a. opera)

Max Ogden maxogden merged commit 42023a1 into from July 05, 2012
Max Ogden maxogden closed this July 05, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jul 03, 2012
Alejandro Morales Now getUserMedia and createObjectURL detection actually works. 008ffbb
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 10 additions and 2 deletions. Show diff stats Hide diff stats

  1. 12  videostreaming-demo/broadcast-bundle.js
12  videostreaming-demo/broadcast-bundle.js
@@ -3359,10 +3359,12 @@ function MediaStream(options) {
3359 3359
   this.readable = true
3360 3360
   var getUserMedia = me.getGetUserMedia()
3361 3361
   if (!getUserMedia) return console.log({"error": "getUserMedia not supported in this browser"})
3362  
-  navigator.webkitGetUserMedia(options,
  3362
+  getUserMedia(options,
3363 3363
     function(stream) {
3364 3364
       var video = me.video = me.createHiddenVideo()
3365  
-      video.src = window.webkitURL.createObjectURL(stream)
  3365
+      var URL = me.URL()
  3366
+      if (!URL) return console.log({"error":"createObjectURL not supported in this browser"})
  3367
+      video.src = URL.createObjectURL(stream)
3366 3368
       video.play()
3367 3369
     },
3368 3370
     function(err) {
@@ -3385,6 +3387,12 @@ MediaStream.prototype.getGetUserMedia = function() {
3385 3387
   return false
3386 3388
 }
3387 3389
 
  3390
+MediaStream.prototype.URL = function() {
  3391
+  if (window.URL) return window.URL
  3392
+  if (window.webkitURL) return window.webkitURL
  3393
+  return false
  3394
+}
  3395
+
3388 3396
 MediaStream.prototype.onVideoPlay = function() {
3389 3397
   var video = this.video
3390 3398
   if (!isNaN(video.duration)) {
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.