Permalink
Browse files

working on ms edge πŸŽ‰

  • Loading branch information...
contra committed Jan 3, 2016
1 parent 9de62aa commit e2eca02f44cad13518972333d1be018ba00cb0bd
Showing with 30 additions and 15 deletions.
  1. +12 βˆ’8 examples/loopback/index.js
  2. +9 βˆ’5 platforms/edge/rtc.js
  3. +9 βˆ’2 util/onMicChange.js
View
@@ -25,29 +25,32 @@ function bootstrap(){
if (err) {
return console.error(err);
}
console.debug('User camera:', stream);
createLoopback(stream);
});
}
function createLoopback(stream){
onStreamLoaded(stream, function(err, res){
onStreamLoaded(stream.clone(), function(err, res){
if (err) console.error('StreamLoaded error:', err);
if (res) console.log('StreamLoaded:', res);
});
var initiator = new Peer({
initiator: true,
stream: stream,
trickle: (rtc.platform === 'edge'),
stream: stream.clone(),
wrtc: rtc
});
var receiver = new Peer({
stream: stream,
stream: stream.clone(),
trickle: (rtc.platform === 'edge'),
wrtc: rtc
});
//debug(initiator);
//debug(receiver);
debug(initiator, 'initiator');
debug(receiver, 'receiver');
initiator.on('error', console.error.bind(console));
receiver.on('error', console.error.bind(console));
@@ -60,18 +63,19 @@ function createLoopback(stream){
});
initiator.once('stream', function(stream){
console.debug('Stream relayed between peers');
console.debug('Stream relayed receiver -> initiator');
crel(document.body, makeVideo(stream));
});
receiver.once('stream', function(stream){
console.debug('Stream relayed initiator -> receiver');
crel(document.body, makeVideo(stream));
});
}
function debug(peer){
function debug(peer, id){
peer.on('signal', function(m){
console.debug('Signal:', m);
console.debug(id, 'signal:', JSON.stringify(m));
});
}
View
@@ -1,12 +1,16 @@
'use strict';
function fakeDC(name){
return {
label: name,
send: function(){},
close: function(){}
};
}
module.exports = function() {
var ortc = require('ortc-adapter');
ortc.RTCPeerConnection.prototype.createDataChannel = function(name){
return {
label: name
};
};
ortc.RTCPeerConnection.prototype.createDataChannel = fakeDC;
return {
RTCPeerConnection: ortc.RTCPeerConnection,
View
@@ -19,16 +19,23 @@ module.exports = function(stream, cb) {
var meter = watchVolume(ctx, meterOpt, cb);
var gain = ctx.createGain();
gain.gain.value = 0;
// stream -> meter -> zero gain -> dest
src.connect(meter);
src.connect(gain);
meter.connect(gain);
gain.connect(ctx.destination);
return {
end: function(){
// TODO: verify this works
if (meter.disconnect) meter.disconnect();
if (gain.disconnect) gain.disconnect();
if (src.disconnect) src.disconnect();
if (meter.stop) meter.stop();
if (gain.stop) gain.stop();
if (src.stop) src.stop();
if (ctx.close) ctx.close();
src.disconnect();
}
};
};

0 comments on commit e2eca02

Please sign in to comment.