Pass the call around different CallViews to keep media flowing
Previously, the CallView was attached to the RoomView, so you would get a new CallView each time you changed the room and the one you changed from would be destroyed. This would destroy media capture/playback as the element was no longer in the DOM. This is now fixed by having a "global" CallView which is attached at the MatrixChat "page" level in the DOM hierarchy. This CallView isn't scoped to a particular room; it will render any "active" call it can find that *isn't the current room being displayed*. This has the side effect of enforcing 1 call per app semantics as only the first active call found is returned. This fixes https://github.com/vector-im/vector-web/issues/31 This is unfinished (CSS for the global call view isn't done)
This commit is contained in:
+12
-1
@@ -106,7 +106,7 @@ function _setCallListeners(call) {
|
||||
play("ringbackAudio");
|
||||
}
|
||||
else if (newState === "ended" && oldState === "connected") {
|
||||
_setCallState(call, call.roomId, "ended");
|
||||
_setCallState(undefined, call.roomId, "ended");
|
||||
pause("ringbackAudio");
|
||||
play("callendAudio");
|
||||
}
|
||||
@@ -239,5 +239,16 @@ dis.register(function(payload) {
|
||||
module.exports = {
|
||||
getCall: function(roomId) {
|
||||
return calls[roomId] || null;
|
||||
},
|
||||
|
||||
getAnyActiveCall: function() {
|
||||
var roomsWithCalls = Object.keys(calls);
|
||||
for (var i = 0; i < roomsWithCalls.length; i++) {
|
||||
if (calls[roomsWithCalls[i]] &&
|
||||
calls[roomsWithCalls[i]].call_state !== "ended") {
|
||||
return calls[roomsWithCalls[i]];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user