Browse Source

Fixed event and scope order/update issues created by rooms service.

pull/152/head
Simon Eisenmann 11 years ago
parent
commit
6f174f8517
  1. 46
      static/js/directives/audiovideo.js
  2. 2
      static/js/directives/buddylist.js
  3. 10
      static/js/directives/presentation.js
  4. 2
      static/js/directives/screenshare.js
  5. 16
      static/js/mediastream/webrtc.js

46
static/js/directives/audiovideo.js

@ -215,30 +215,32 @@ define(['jquery', 'underscore', 'text!partials/audiovideo.html', 'text!partials/
mediaStream.webrtc.e.on("done", function() { mediaStream.webrtc.e.on("done", function() {
$scope.hasUsermedia = false; $scope.$apply(function() {
$scope.isActive = false; $scope.hasUsermedia = false;
$scope.peersTalking = {}; $scope.isActive = false;
if (BigScreen.enabled) { $scope.peersTalking = {};
BigScreen.exit(); if (BigScreen.enabled) {
} BigScreen.exit();
_.delay(function() {
if ($scope.isActive) {
return;
} }
$scope.localVideo.src = ''; _.delay(function() {
$scope.miniVideo.src = ''; if ($scope.isActive) {
$($scope.remoteVideos).children(".remoteVideo").remove(); return;
}, 1500); }
$($scope.mini).removeClass("visible"); $scope.localVideo.src = '';
$scope.localVideo.style.opacity = 0; $scope.miniVideo.src = '';
$scope.remoteVideos.style.opacity = 0; $($scope.remoteVideos).children(".remoteVideo").remove();
$element.removeClass('active'); }, 1500);
_.each(streams, function(scope, k) { $($scope.mini).removeClass("visible");
scope.$destroy(); $scope.localVideo.style.opacity = 0;
delete streams[k]; $scope.remoteVideos.style.opacity = 0;
$element.removeClass('active');
_.each(streams, function(scope, k) {
scope.$destroy();
delete streams[k];
});
$scope.rendererName = $scope.defaultRendererName;
$scope.haveStreams = false;
}); });
$scope.rendererName = $scope.defaultRendererName;
$scope.haveStreams = false;
}); });

2
static/js/directives/buddylist.js

@ -42,7 +42,7 @@ define(['underscore', 'text!partials/buddylist.html'], function(_, template) {
}; };
webrtc.e.on("done", function() { webrtc.e.on("done", function() {
updateBuddyListVisibility(); $scope.$apply(updateBuddyListVisibility);
}); });
$scope.$on("room.joined", function(ev) { $scope.$on("room.joined", function(ev) {

10
static/js/directives/presentation.js

@ -704,11 +704,13 @@ define(['jquery', 'underscore', 'text!partials/presentation.html', 'bigscreen'],
}; };
mediaStream.webrtc.e.on("done", function() { mediaStream.webrtc.e.on("done", function() {
_.each($scope.availablePresentations, function(presentation) { $scope.$apply(function() {
presentation.clear(); _.each($scope.availablePresentations, function(presentation) {
presentation.clear();
});
$scope.availablePresentations = [];
$scope.activeDownloads = [];
}); });
$scope.availablePresentations = [];
$scope.activeDownloads = [];
}); });
$(document).on("keyup", function(event) { $(document).on("keyup", function(event) {

2
static/js/directives/screenshare.js

@ -318,7 +318,7 @@ define(['jquery', 'underscore', 'text!partials/screenshare.html', 'text!partials
}; };
mediaStream.webrtc.e.on("done", function() { mediaStream.webrtc.e.on("done", function() {
$scope.stopScreenshare(); $scope.$apply($scope.stopScreenshare);
}); });
$scope.$watch("layout.screenshare", function(newval, oldval) { $scope.$watch("layout.screenshare", function(newval, oldval) {

16
static/js/mediastream/webrtc.js

@ -608,17 +608,21 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u
if (reason !== "receivedbye") { if (reason !== "receivedbye") {
this.api.sendBye(id, reason); this.api.sendBye(id, reason);
} }
if (this.currentcall && currentcall) { _.defer(_.bind(function() {
this.e.triggerHandler("statechange", ["connected", this.currentcall]); if (this.currentcall && currentcall) {
} else { this.e.triggerHandler("statechange", ["connected", this.currentcall]);
this.e.triggerHandler("done", [reason]); } else {
} this.e.triggerHandler("done", [reason]);
}
}, this));
return; return;
} }
} }
if (this.currentcall) { if (this.currentcall) {
id = this.currentcall.id; id = this.currentcall.id;
this.e.triggerHandler("done", [reason]); _.defer(_.bind(function() {
this.e.triggerHandler("done", [reason]);
}, this));
} }
this.stop(); this.stop();
if (id) { if (id) {

Loading…
Cancel
Save