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

10
static/js/directives/presentation.js

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

2
static/js/directives/screenshare.js

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

16
static/js/mediastream/webrtc.js

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

Loading…
Cancel
Save