simple-webrtc
Advanced tools
Comparing version 2.2.3 to 2.3.0
@@ -12,4 +12,10 @@ var events = require('events'); | ||
// ontrack supported at recent browser versions. [deprecated]onaddstream supported at older browser versions. | ||
if(peerConnection.addTrack) { | ||
peerConnection.ontrack = onAddTrack; | ||
} else { | ||
peerConnection.onaddstream = onAddStream; | ||
} | ||
peerConnection.onicecandidate = onIceCandidate; | ||
peerConnection.onaddstream = onAddStream; | ||
peerConnection.onconnectionstatechange = onConnectionStateChange; | ||
@@ -40,2 +46,9 @@ peerConnection.oniceconnectionstatechange = onIceConnectionStateChange; | ||
function onAddTrack(event) { | ||
if(event.streams) { | ||
remoteStream = event.streams[0]; | ||
connection.emit('remote-stream', event.streams[0]); | ||
} | ||
} | ||
function onConnectionStateChange() { | ||
@@ -63,3 +76,12 @@ connection.emit('connection-state-changed', peerConnection.connectionState); | ||
localStream = stream; | ||
peerConnection.addStream(stream); | ||
// ontrack supported at recent browser versions. [deprecated]onaddstream supported at older browser versions. | ||
if(peerConnection.addTrack) { | ||
stream.getTracks().forEach(function(track) { | ||
peerConnection.addTrack(track, stream); | ||
}); | ||
} else { | ||
peerConnection.addStream(stream); | ||
} | ||
return stream; | ||
@@ -66,0 +88,0 @@ } |
@@ -0,0 +0,0 @@ var webRtcAdapter = require('webrtc-adapter'); |
@@ -0,0 +0,0 @@ var events = require('events'); |
@@ -0,0 +0,0 @@ function UserMedia() { |
{ | ||
"name": "simple-webrtc", | ||
"version": "2.2.3", | ||
"version": "2.3.0", | ||
"description": "A simple WebRTC and MediaRecorder wrapper.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -0,0 +0,0 @@ # simple-webrtc |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
230
10440
7