traceablepeerconnection
Advanced tools
Comparing version 0.2.3 to 1.0.0
47
index.js
@@ -8,5 +8,25 @@ // based on https://github.com/ESTOS/strophe.jingle/ | ||
function dumpSDP(description) { | ||
return 'type: ' + description.type + '\r\n' + description.sdp; | ||
return { | ||
type: description.type, | ||
sdp: description.sdp | ||
}; | ||
} | ||
function dumpStream(stream) { | ||
var info = { | ||
label: stream.id, | ||
}; | ||
if (stream.getAudioTracks().length) { | ||
info.audio = stream.getAudioTracks().map(function (track) { | ||
return track.id; | ||
}); | ||
} | ||
if (stream.getVideoTracks().length) { | ||
info.video = stream.getVideoTracks().map(function (track) { | ||
return track.id; | ||
}); | ||
} | ||
return info; | ||
} | ||
function TraceablePeerConnection(config, constraints) { | ||
@@ -28,3 +48,3 @@ var self = this; | ||
this.peerconnection.onicecandidate = function (event) { | ||
self.trace('onicecandidate', JSON.stringify(event.candidate, null, ' ')); | ||
self.trace('onicecandidate', event.candidate); | ||
if (self.onicecandidate !== null) { | ||
@@ -36,3 +56,3 @@ self.onicecandidate(event); | ||
this.peerconnection.onaddstream = function (event) { | ||
self.trace('onaddstream', event.stream.id); | ||
self.trace('onaddstream', dumpStream(event.stream)); | ||
if (self.onaddstream !== null) { | ||
@@ -44,3 +64,3 @@ self.onaddstream(event); | ||
this.peerconnection.onremovestream = function (event) { | ||
self.trace('onremovestream', event.stream.id); | ||
self.trace('onremovestream', dumpStream(event.stream)); | ||
if (self.onremovestream !== null) { | ||
@@ -109,3 +129,3 @@ self.onremovestream(event); | ||
TraceablePeerConnection.prototype.addStream = function (stream) { | ||
this.trace('addStream', stream.id); | ||
this.trace('addStream', dumpStream(stream)); | ||
this.peerconnection.addStream(stream); | ||
@@ -115,3 +135,3 @@ }; | ||
TraceablePeerConnection.prototype.removeStream = function (stream) { | ||
this.trace('removeStream', stream.id); | ||
this.trace('removeStream', dumpStream(stream)); | ||
this.peerconnection.removeStream(stream); | ||
@@ -168,3 +188,3 @@ }; | ||
var self = this; | ||
this.trace('createOffer', JSON.stringify(constraints, null, ' ')); | ||
this.trace('createOffer', constraints); | ||
this.peerconnection.createOffer( | ||
@@ -185,3 +205,3 @@ function (offer) { | ||
var self = this; | ||
this.trace('createAnswer', JSON.stringify(constraints, null, ' ')); | ||
this.trace('createAnswer', constraints); | ||
this.peerconnection.createAnswer( | ||
@@ -202,8 +222,6 @@ function (answer) { | ||
var self = this; | ||
this.trace('addIceCandidate', JSON.stringify(candidate, null, ' ')); | ||
this.peerconnection.addIceCandidate(candidate); | ||
/* maybe later | ||
this.peerconnection.addIceCandidate(candidate, | ||
function () { | ||
self.trace('addIceCandidateOnSuccess'); | ||
this.trace('addIceCandidate', candidate); | ||
this.peerconnection.addIceCandidate(candidate, | ||
function () { | ||
//self.trace('addIceCandidateOnSuccess'); | ||
successCallback(); | ||
@@ -216,3 +234,2 @@ }, | ||
); | ||
*/ | ||
}; | ||
@@ -219,0 +236,0 @@ |
{ | ||
"name": "traceablepeerconnection", | ||
"version": "0.2.3", | ||
"version": "1.0.0", | ||
"description": "Lowlevel RTCPeerConnection wrapper which allows tracing the API calls", | ||
@@ -16,3 +16,3 @@ "main": "index.js", | ||
"wildemitter": "1.x", | ||
"webrtcsupport": "0.7.x" | ||
"webrtcsupport": "^1.1.0" | ||
}, | ||
@@ -19,0 +19,0 @@ "devDependencies": { |
@@ -9,5 +9,25 @@ !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.PeerConnection=e():"undefined"!=typeof global?global.PeerConnection=e():"undefined"!=typeof self&&(self.PeerConnection=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
function dumpSDP(description) { | ||
return 'type: ' + description.type + '\r\n' + description.sdp; | ||
return { | ||
type: description.type, | ||
sdp: description.sdp | ||
}; | ||
} | ||
function dumpStream(stream) { | ||
var info = { | ||
label: stream.id, | ||
}; | ||
if (stream.getAudioTracks().length) { | ||
info.audio = stream.getAudioTracks().map(function (track) { | ||
return track.id; | ||
}); | ||
} | ||
if (stream.getVideoTracks().length) { | ||
info.video = stream.getVideoTracks().map(function (track) { | ||
return track.id; | ||
}); | ||
} | ||
return info; | ||
} | ||
function TraceablePeerConnection(config, constraints) { | ||
@@ -29,3 +49,3 @@ var self = this; | ||
this.peerconnection.onicecandidate = function (event) { | ||
self.trace('onicecandidate', JSON.stringify(event.candidate, null, ' ')); | ||
self.trace('onicecandidate', event.candidate); | ||
if (self.onicecandidate !== null) { | ||
@@ -37,3 +57,3 @@ self.onicecandidate(event); | ||
this.peerconnection.onaddstream = function (event) { | ||
self.trace('onaddstream', event.stream.id); | ||
self.trace('onaddstream', dumpStream(event.stream)); | ||
if (self.onaddstream !== null) { | ||
@@ -45,3 +65,3 @@ self.onaddstream(event); | ||
this.peerconnection.onremovestream = function (event) { | ||
self.trace('onremovestream', event.stream.id); | ||
self.trace('onremovestream', dumpStream(event.stream)); | ||
if (self.onremovestream !== null) { | ||
@@ -110,3 +130,3 @@ self.onremovestream(event); | ||
TraceablePeerConnection.prototype.addStream = function (stream) { | ||
this.trace('addStream', stream.id); | ||
this.trace('addStream', dumpStream(stream)); | ||
this.peerconnection.addStream(stream); | ||
@@ -116,3 +136,3 @@ }; | ||
TraceablePeerConnection.prototype.removeStream = function (stream) { | ||
this.trace('removeStream', stream.id); | ||
this.trace('removeStream', dumpStream(stream)) | ||
this.peerconnection.removeStream(stream); | ||
@@ -169,3 +189,3 @@ }; | ||
var self = this; | ||
this.trace('createOffer', JSON.stringify(constraints, null, ' ')); | ||
this.trace('createOffer', constraints); | ||
this.peerconnection.createOffer( | ||
@@ -186,3 +206,3 @@ function (offer) { | ||
var self = this; | ||
this.trace('createAnswer', JSON.stringify(constraints, null, ' ')); | ||
this.trace('createAnswer', constraints); | ||
this.peerconnection.createAnswer( | ||
@@ -203,8 +223,6 @@ function (answer) { | ||
var self = this; | ||
this.trace('addIceCandidate', JSON.stringify(candidate, null, ' ')); | ||
this.peerconnection.addIceCandidate(candidate); | ||
/* maybe later | ||
this.trace('addIceCandidate', candidate); | ||
this.peerconnection.addIceCandidate(candidate, | ||
function () { | ||
self.trace('addIceCandidateOnSuccess'); | ||
//self.trace('addIceCandidateOnSuccess'); | ||
successCallback(); | ||
@@ -217,3 +235,2 @@ }, | ||
); | ||
*/ | ||
}; | ||
@@ -1014,3 +1031,5 @@ | ||
var MediaStream = window.webkitMediaStream || window.MediaStream; | ||
var screenSharing = window.location.protocol === 'https:' && window.navigator.userAgent.match('Chrome') && parseInt(window.navigator.userAgent.match(/Chrome\/(.*) /)[1], 10) >= 26; | ||
var screenSharing = window.location.protocol === 'https:' && | ||
((window.navigator.userAgent.match('Chrome') && parseInt(window.navigator.userAgent.match(/Chrome\/(.*) /)[1], 10) >= 26) || | ||
(window.navigator.userAgent.match('Firefox') && parseInt(window.navigator.userAgent.match(/Firefox\/(.*)/)[1], 10) >= 33)); | ||
var AudioContext = window.webkitAudioContext || window.AudioContext; | ||
@@ -1030,3 +1049,4 @@ | ||
SessionDescription: SessionDescription, | ||
IceCandidate: IceCandidate | ||
IceCandidate: IceCandidate, | ||
MediaStream: MediaStream | ||
}; | ||
@@ -1033,0 +1053,0 @@ |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
43460
1248
1
+ Addedwebrtcsupport@1.3.2(transitive)
- Removedwebrtcsupport@0.7.3(transitive)
Updatedwebrtcsupport@^1.1.0