mirror of https://github.com/vector-im/riot-web
commit
dc9a7e5e28
|
@ -23,8 +23,9 @@ module.exports = React.createClass({
|
||||||
displayName: 'CallView',
|
displayName: 'CallView',
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
// js-sdk room object
|
// js-sdk room object. If set, we will only show calls for the given
|
||||||
room: React.PropTypes.object.isRequired,
|
// room; if not, we will show any active call.
|
||||||
|
room: React.PropTypes.object,
|
||||||
|
|
||||||
// A Conference Handler implementation
|
// A Conference Handler implementation
|
||||||
// Must have a function signature:
|
// Must have a function signature:
|
||||||
|
@ -44,7 +45,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
this.dispatcherRef = dis.register(this.onAction);
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
this.showCall(this.props.room.roomId);
|
this.showCall();
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
|
@ -54,20 +55,27 @@ module.exports = React.createClass({
|
||||||
onAction: function(payload) {
|
onAction: function(payload) {
|
||||||
// don't filter out payloads for room IDs other than props.room because
|
// don't filter out payloads for room IDs other than props.room because
|
||||||
// we may be interested in the conf 1:1 room
|
// we may be interested in the conf 1:1 room
|
||||||
if (payload.action !== 'call_state' || !payload.room_id) {
|
if (payload.action !== 'call_state') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.showCall(payload.room_id);
|
this.showCall();
|
||||||
},
|
},
|
||||||
|
|
||||||
showCall: function(roomId) {
|
showCall: function() {
|
||||||
var call = (
|
var call;
|
||||||
CallHandler.getCallForRoom(roomId) ||
|
|
||||||
(this.props.ConferenceHandler ?
|
if (this.props.room) {
|
||||||
this.props.ConferenceHandler.getConferenceCallForRoom(roomId) :
|
var roomId = this.props.room.roomId;
|
||||||
null
|
call = CallHandler.getCallForRoom(roomId) ||
|
||||||
)
|
(this.props.ConferenceHandler ?
|
||||||
);
|
this.props.ConferenceHandler.getConferenceCallForRoom(roomId) :
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
call = CallHandler.getAnyActiveCall();
|
||||||
|
}
|
||||||
|
|
||||||
if (call) {
|
if (call) {
|
||||||
call.setLocalVideoElement(this.getVideoView().getLocalVideoElement());
|
call.setLocalVideoElement(this.getVideoView().getLocalVideoElement());
|
||||||
call.setRemoteVideoElement(this.getVideoView().getRemoteVideoElement());
|
call.setRemoteVideoElement(this.getVideoView().getRemoteVideoElement());
|
||||||
|
|
Loading…
Reference in New Issue