diff --git a/samples/js/base/adapter.js b/samples/js/base/adapter.js index a7eba0bfc..77d92b1ad 100644 --- a/samples/js/base/adapter.js +++ b/samples/js/base/adapter.js @@ -65,7 +65,15 @@ if (navigator.mozGetUserMedia) { // Attach a media stream to an element. attachMediaStream = function(element, stream) { - element.src = webkitURL.createObjectURL(stream); + if (typeof element.srcObject !== 'undefined') { + element.srcObject = stream; + } else if (typeof element.mozSrcObject !== 'undefined') { + element.mozSrcObject = stream; + } else if (typeof element.src !== 'undefined') { + element.src = URL.createObjectURL(stream); + } else { + console.log('Error attaching stream to element.'); + } }; reattachMediaStream = function(to, from) { diff --git a/samples/js/demos/html/dtmf1.html b/samples/js/demos/html/dtmf1.html index 3233cab6f..12a7bbb1a 100644 --- a/samples/js/demos/html/dtmf1.html +++ b/samples/js/demos/html/dtmf1.html @@ -122,7 +122,8 @@ function hangup() { } function gotRemoteStream(e){ - audio2.src = webkitURL.createObjectURL(e.stream); + // Call the polyfill wrapper to attach the media stream to this element. + attachMediaStream(audio2, e.stream); trace("Received remote stream"); enableDtmfSender(); } diff --git a/samples/js/demos/html/multiple.html b/samples/js/demos/html/multiple.html index 35db2ed97..83d381746 100644 --- a/samples/js/demos/html/multiple.html +++ b/samples/js/demos/html/multiple.html @@ -141,12 +141,14 @@ function hangup() { } function gotRemoteStream1(e) { - vid2.src = webkitURL.createObjectURL(e.stream); + // Call the polyfill wrapper to attach the media stream to this element. + attachMediaStream(vid2, e.stream); trace("PC1: Received remote stream"); } function gotRemoteStream2(e) { - vid3.src = webkitURL.createObjectURL(e.stream); + // Call the polyfill wrapper to attach the media stream to this element. + attachMediaStream(vid3, e.stream); trace("PC2: Received remote stream"); } diff --git a/samples/js/demos/html/pc1-audio.html b/samples/js/demos/html/pc1-audio.html index febf9d661..0c51c6f00 100644 --- a/samples/js/demos/html/pc1-audio.html +++ b/samples/js/demos/html/pc1-audio.html @@ -88,7 +88,8 @@ function hangup() { } function gotRemoteStream(e){ - audio2.src = webkitURL.createObjectURL(e.stream); + // Call the polyfill wrapper to attach the media stream to this element. + attachMediaStream(audio2, e.stream); trace("Received remote stream"); } diff --git a/samples/js/demos/html/pc1.html b/samples/js/demos/html/pc1.html index 416a1c680..d1951dffa 100644 --- a/samples/js/demos/html/pc1.html +++ b/samples/js/demos/html/pc1.html @@ -112,7 +112,8 @@ function hangup() { } function gotRemoteStream(e){ - vid2.src = webkitURL.createObjectURL(e.stream); + // Call the polyfill wrapper to attach the media stream to this element. + attachMediaStream(vid2, e.stream); trace("Received remote stream"); } diff --git a/samples/js/demos/html/pranswer.html b/samples/js/demos/html/pranswer.html index d4425d619..ed389da72 100644 --- a/samples/js/demos/html/pranswer.html +++ b/samples/js/demos/html/pranswer.html @@ -115,7 +115,8 @@ function stop() { } function gotRemoteStream(e) { - vid2.src = webkitURL.createObjectURL(e.stream); + // Call the polyfill wrapper to attach the media stream to this element. + attachMediaStream(vid2, e.stream); trace("Received remote stream"); } diff --git a/samples/js/demos/html/states.html b/samples/js/demos/html/states.html new file mode 100644 index 000000000..f905c0d54 --- /dev/null +++ b/samples/js/demos/html/states.html @@ -0,0 +1,231 @@ + + + +RTCPeerState & RTCIceConnectionState Demo 1 + + + + + + + +
+ + + +
+
+
+ + +
+ + +
+ + +
+ + +
+ + + + diff --git a/samples/js/demos/index.html b/samples/js/demos/index.html index 5651ba728..9e9850a9e 100644 --- a/samples/js/demos/index.html +++ b/samples/js/demos/index.html @@ -1,94 +1,104 @@ - - WebRTC Samples - - -

- WebRTC Samples

-

- Here are some sample pages that demonstrate basic WebRTC concepts. If you are new to WebRTC, you may want to check out this WebRTC overview first.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- getUserMedia Samples
- gum1.html - Shows how to access the webcam and display the local video in a <video/> element.
- gum2.html - Shows how to capture the current frame of video to a <canvas/>.
- gum3.html - Shows how to apply CSS filters to a <video/> and <canvas/>
- face.html - Shows how to perform face tracking using webcam video.
   
- PeerConnection Samples
- pc1.html - Shows how to set up a simple 1:1 audio/video call.
- pc1-audio.html - Shows how to set up a simple 1:1 audio only call.
- multiple.html - Shows how to set up multiple PeerConnections.
- constraints-and-stats.html - Shows how to pass constraints into the PeerConnection API, and query it for statistics.
- dtmf1.html - Shows how to send DTMF tones using PeerConnection API.
- dc1.html - Shows how to send Data using PeerConnection API.
- local-audio-rendering.html - Shows usage of a local media stream connected to an HTML5 audio tag.
-

-  

+ +WebRTC Samples + + +

WebRTC Samples

+

+Here are some sample pages that demonstrate basic +WebRTC concepts. If you are new to WebRTC, +you may want to check out this + +WebRTC overview first. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ getUserMedia Samples
+ gum1.html + Shows how to access the webcam and display the local video in a <video/> element.
+ gum2.html + Shows how to capture the current frame of video to a <canvas/>.
+ gum3.html + Shows how to apply CSS filters to a <video/> and <canvas/>
+ face.html + Shows how to perform face tracking using webcam video.
   
+ PeerConnection Samples
+ pc1.html + Shows how to set up a simple 1:1 audio/video call.
+ states.html + Shows RTCPeerStates and RTCIceConnectionStates in a simple 1:1 audio/video call.
+ pc1-audio.html + Shows how to set up a simple 1:1 audio only call.
+ multiple.html + Shows how to set up multiple PeerConnections.
+ constraints-and-stats.html + Shows how to pass constraints into the PeerConnection API, and query it for statistics.
+ dtmf1.html + Shows how to send DTMF tones using PeerConnection API.
+ dc1.html + Shows how to send Data using PeerConnection API.
+ local-audio-rendering.html + Shows usage of a local media stream connected to an HTML5 audio tag.
+

 

+