我在我的angular 2应用程序上使用Sinch,当我加入一个小组时,我无法挂断电话。但是,当我是该频道的创建者时,它的效果很好。这是我正在使用的一些代码:
export class ConferenceComponent {
remoteCalls: any[] = [];
theChannel: string = "";
groupCall: any;
constructor(private globalsService: GlobalsService) {
}
joinChannel() {
var _self = this;
var callClient = this.globalsService.sinchClient.getCallClient();
this.groupCall = callClient.callGroup(_self.theChannel);
this.groupCall.addEventListener({
onGroupRemoteCallAdded: function (call) {
_self.remoteCalls.push(call);
var callIdx = _self.remoteCalls.indexOf(call);
$('video#other' + callIdx).attr('src', call.incomingStreamURL);
},
onGroupLocalMediaAdded: function (stream) {
$('video#me').attr('src', window.URL.createObjectURL(stream));
$("video#me").prop("volume", 0);
},
onGroupRemoteCallRemoved: function (call) {
var callIdx = _self.remoteCalls.indexOf(call);
_self.remoteCalls.splice(callIdx, 1);
$('video[id^=other]').attr('src', function (index) {
$('video#other' + index).attr('src', (_self.remoteCalls[index] || {}).incomingStreamURL || '');
});
},
});
}
hangup() {
this.groupCall.hangupGroup();
}