Download E-books Real-Time Communication with WebRTC: Peer-to-Peer in the Browser PDF

" \ + text); } // Callback in case of good fortune of the getUserMedia() name functionality successCallback(stream){ log("Received neighborhood stream"); // affiliate the neighborhood video aspect with the retrieved circulation if (window. URL) { localVideo. src = URL. createObjectURL(stream); } else { localVideo. src = circulation; } localStream = circulation; // we will be able to now allow the decision button callButton. disabled = fake; } // functionality linked to clicking at the commence button // this is often the development triggering all different activities functionality start() { log("Requesting neighborhood stream"); // to start with, disable the beginning button at the web page startButton. disabled = real; // prepare to house varied browser vendors... navigator. getUserMedia = navigator. getUserMedia || navigator. webkitGetUserMedia || navigator. mozGetUserMedia; // Now, name getUserMedia() navigator. getUserMedia({audio:true, video:true}, successCallback, function(error) { utilizing PeerConnection items in the neighborhood: An instance www. it-ebooks. details | 29 log("navigator. getUserMedia errors: ", error); }); } // functionality linked to clicking at the name button // this can be enabled upon winning finishing touch of the beginning button handler functionality call() { // to begin with, disable the decision button at the page... callButton. disabled = precise; // ... and permit the Hangup button hangupButton. disabled = fake; log("Starting call"); // // // if observe that getVideoTracks() and getAudioTracks() aren't presently supported in Firefox... ... simply use them with Chrome (navigator. webkitGetUserMedia) { // Log details approximately video and audio machine in use if (localStream. getVideoTracks(). size > zero) { log('Using video machine: ' + localStream. getVideoTracks()[0]. label); } if (localStream. getAudioTracks(). size > zero) { log('Using audio machine: ' + localStream. getAudioTracks()[0]. label); } } // Chrome if (navigator. webkitGetUserMedia) { RTCPeerConnection = webkitRTCPeerConnection; // Firefox } else if(navigator. mozGetUserMedia){ RTCPeerConnection = mozRTCPeerConnection; RTCSessionDescription = mozRTCSessionDescription; RTCIceCandidate = mozRTCIceCandidate; } log("RTCPeerConnection item: " + RTCPeerConnection); // this can be an non-compulsory configuration string, linked to // NAT traversal setup var servers = null; // Create the neighborhood PeerConnection item localPeerConnection = new RTCPeerConnection(servers); log("Created neighborhood peer connection item localPeerConnection"); // upload a handler linked to ICE protocol occasions localPeerConnection.

Rated 4.03 of 5 – based on 45 votes