|
|
@ -177,13 +177,7 @@ define(['jquery', 'underscore', 'text!partials/presentation.html'], function($, |
|
|
|
var currentToken = null; |
|
|
|
var currentToken = null; |
|
|
|
var tokenHandler = null; |
|
|
|
var tokenHandler = null; |
|
|
|
|
|
|
|
|
|
|
|
var connector = function(token, peercall) { |
|
|
|
var mediaStreamSendPresentation = function(peercall, token, params) { |
|
|
|
console.log("XXX connector", token, peercall, peers); |
|
|
|
|
|
|
|
if (peers.hasOwnProperty(peercall.id)) { |
|
|
|
|
|
|
|
// Already got a connection.
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
peers[peercall.id] = true; |
|
|
|
|
|
|
|
mediaStream.api.apply("sendPresentation", { |
|
|
|
mediaStream.api.apply("sendPresentation", { |
|
|
|
send: function(type, data) { |
|
|
|
send: function(type, data) { |
|
|
|
if (!peercall.peerconnection.datachannelReady) { |
|
|
|
if (!peercall.peerconnection.datachannelReady) { |
|
|
@ -194,26 +188,28 @@ define(['jquery', 'underscore', 'text!partials/presentation.html'], function($, |
|
|
|
return peercall.peerconnection.send(data); |
|
|
|
return peercall.peerconnection.send(data); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
})(peercall.id, token, { |
|
|
|
})(peercall.id, token, params); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var connector = function(token, peercall) { |
|
|
|
|
|
|
|
console.log("XXX connector", token, peercall, peers); |
|
|
|
|
|
|
|
if (peers.hasOwnProperty(peercall.id)) { |
|
|
|
|
|
|
|
// Already got a connection.
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
peers[peercall.id] = true; |
|
|
|
|
|
|
|
mediaStreamSendPresentation(peercall, token, { |
|
|
|
Type: "Show", |
|
|
|
Type: "Show", |
|
|
|
Show: true |
|
|
|
Show: true |
|
|
|
}); |
|
|
|
}); |
|
|
|
if ($scope.currentFileInfo !== null) { |
|
|
|
if ($scope.currentFileInfo !== null) { |
|
|
|
mediaStream.api.apply("sendPresentation", { |
|
|
|
mediaStreamSendPresentation(peercall, token, { |
|
|
|
send: function(type, data) { |
|
|
|
|
|
|
|
return peercall.peerconnection.send(data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
})(peercall.id, token, { |
|
|
|
|
|
|
|
Type: "FileInfo", |
|
|
|
Type: "FileInfo", |
|
|
|
FileInfo: $scope.currentFileInfo |
|
|
|
FileInfo: $scope.currentFileInfo |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
if ($scope.currentPage !== null) { |
|
|
|
if ($scope.currentPage !== null) { |
|
|
|
mediaStream.api.apply("sendPresentation", { |
|
|
|
mediaStreamSendPresentation(peercall, token, { |
|
|
|
send: function(type, data) { |
|
|
|
|
|
|
|
return peercall.peerconnection.send(data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
})(peercall.id, token, { |
|
|
|
|
|
|
|
Type: "Page", |
|
|
|
Type: "Page", |
|
|
|
Page: $scope.currentPage |
|
|
|
Page: $scope.currentPage |
|
|
|
}); |
|
|
|
}); |
|
|
@ -249,11 +245,7 @@ define(['jquery', 'underscore', 'text!partials/presentation.html'], function($, |
|
|
|
|
|
|
|
|
|
|
|
$scope.currentPage = page; |
|
|
|
$scope.currentPage = page; |
|
|
|
mediaStream.webrtc.callForEachCall(function(peercall) { |
|
|
|
mediaStream.webrtc.callForEachCall(function(peercall) { |
|
|
|
mediaStream.api.apply("sendPresentation", { |
|
|
|
mediaStreamSendPresentation(peercall, currentToken, { |
|
|
|
send: function(type, data) { |
|
|
|
|
|
|
|
return peercall.peerconnection.send(data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
})(peercall.id, currentToken, { |
|
|
|
|
|
|
|
Type: "Page", |
|
|
|
Type: "Page", |
|
|
|
Page: page |
|
|
|
Page: page |
|
|
|
}); |
|
|
|
}); |
|
|
@ -264,11 +256,7 @@ define(['jquery', 'underscore', 'text!partials/presentation.html'], function($, |
|
|
|
console.log("Advertising file", file, fileInfo); |
|
|
|
console.log("Advertising file", file, fileInfo); |
|
|
|
// TODO(fancycode): other peers should either request the file or subscribe rendered images (e.g. for mobile app), for now we send the whole file
|
|
|
|
// TODO(fancycode): other peers should either request the file or subscribe rendered images (e.g. for mobile app), for now we send the whole file
|
|
|
|
mediaStream.webrtc.callForEachCall(function(peercall) { |
|
|
|
mediaStream.webrtc.callForEachCall(function(peercall) { |
|
|
|
mediaStream.api.apply("sendPresentation", { |
|
|
|
mediaStreamSendPresentation(peercall, currentToken, { |
|
|
|
send: function(type, data) { |
|
|
|
|
|
|
|
return peercall.peerconnection.send(data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
})(peercall.id, currentToken, { |
|
|
|
|
|
|
|
Type: "FileInfo", |
|
|
|
Type: "FileInfo", |
|
|
|
FileInfo: fileInfo |
|
|
|
FileInfo: fileInfo |
|
|
|
}); |
|
|
|
}); |
|
|
@ -339,11 +327,7 @@ define(['jquery', 'underscore', 'text!partials/presentation.html'], function($, |
|
|
|
console.log("Presentation disabled"); |
|
|
|
console.log("Presentation disabled"); |
|
|
|
if (currentToken) { |
|
|
|
if (currentToken) { |
|
|
|
mediaStream.webrtc.callForEachCall(function(peercall) { |
|
|
|
mediaStream.webrtc.callForEachCall(function(peercall) { |
|
|
|
mediaStream.api.apply("sendPresentation", { |
|
|
|
mediaStreamSendPresentation(peercall, currentToken, { |
|
|
|
send: function(type, data) { |
|
|
|
|
|
|
|
return peercall.peerconnection.send(data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
})(peercall.id, currentToken, { |
|
|
|
|
|
|
|
Type: "Hide", |
|
|
|
Type: "Hide", |
|
|
|
Hide: true |
|
|
|
Hide: true |
|
|
|
}); |
|
|
|
}); |
|
|
|