Comparing version 0.4.5 to 0.4.6
@@ -25,3 +25,6 @@ var _ = require('underscore'); | ||
if (this.parent.localStream) { | ||
if (opts.stream) { | ||
this.pc.addStream(opts.stream); | ||
this.localStream = opts.stream; | ||
} else if (this.parent.localStream) { | ||
this.pc.addStream(this.parent.localStream); | ||
@@ -48,7 +51,24 @@ this.localStream = this.parent.localStream; | ||
MediaSession.prototype = _.extend(MediaSession.prototype, { | ||
start: function () { | ||
start: function (constraints) { | ||
var self = this; | ||
this.state = 'pending'; | ||
this.pc.isInitiator = true; | ||
this.pc.offer(function (err, sessDesc) { | ||
this.pc.offer(constraints, function (err, sessDesc) { | ||
// a workaround for missing a=sendonly | ||
// https://code.google.com/p/webrtc/issues/detail?id=1553 | ||
if (constraints && constraints.mandatory) { | ||
sessDesc.jingle.contents.forEach(function (content) { | ||
if (!content.description || content.description.descType !== 'rtp') { | ||
return; | ||
} | ||
if (!constraints.mandatory.OfferToReceiveAudio && | ||
content.description.media === 'audio') { | ||
content.senders = 'initiator'; | ||
} | ||
if (!constraints.mandatory.OfferToReceiveVideo && | ||
content.description.media === 'video') { | ||
content.senders = 'initiator'; | ||
} | ||
}); | ||
} | ||
self.send('session-initiate', sessDesc.jingle); | ||
@@ -185,8 +205,10 @@ }); | ||
onStreamAdded: function (event) { | ||
var self = this; | ||
log(this.sid + ': Remote media stream added'); | ||
// unfortunately, firefox does not support this yet | ||
/* | ||
event.stream.onended = function () { | ||
self.onStreamRemoved({stream: event.stream}); | ||
}; | ||
*/ | ||
@@ -193,0 +215,0 @@ this.parent.emit('peerStreamAdded', this, event.stream); |
@@ -319,3 +319,3 @@ var _ = require('underscore'); | ||
Jingle.prototype.createMediaSession = function (peer, sid) { | ||
Jingle.prototype.createMediaSession = function (peer, sid, stream) { | ||
var session = new MediaSession({ | ||
@@ -325,2 +325,3 @@ sid: sid, | ||
initiator: true, | ||
stream: stream, | ||
parent: this | ||
@@ -327,0 +328,0 @@ }); |
{ | ||
"name": "jingle", | ||
"description": "Generic Jingle via WebRTC session manager.", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"author": "Lance Stout <lance@andyet.net>", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/legastero/jingle.js/issues", |
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
35037
15
655