我正在使用Angular 7
with Angora.Io
,我的问题是当我在本地运行我的 Angular 项目时,我成功访问了我的相机和麦克风,但是当我尝试像“192.105.2.448”一样在全球范围内运行时,我无法访问我的相机和麦克风并抛出这样的错误。请帮我!
join(): void {
this.client.setClientRole('host');
this.localStream = this.agoraService.createStream({ streamID: this.uid, audio: true, video: true, screen: false });
this.localStream.setVideoProfile('720p_3');
this.assignLocalStreamHandlers();
this.init();
this.client.join(null , this.channel.value, this.uid);
}
publish(): void {
this.liveplay = true;
this.client.publish(this.localStream, err => console.log('Publish local stream error: ' + err)); }
protected init(): void {
this.localStream.init(
() => {
// The user has granted access to the camera and mic.
console.log('getUserMedia successfully' , this.localStream);
this.localStream.play('agora_local');
this.connected = true;
},
err => console.log('getUserMedia failed', err)
);
}
private assignLocalStreamHandlers(): void {
console.log('==========>>>>>>>2 ');
this.localStream.on(StreamEvent.MediaAccessAllowed, () => {
console.log('accessAllowed --->>> ', this.localStream);
});
// The user has denied access to the camera and mic.
this.localStream.on(StreamEvent.MediaAccessDenied, () => {
console.log('accessDenied');
});
}
11:35:01:76 Agora-SDK [错误]:[3] 媒体访问 NOT_SUPPORTED:只允许安全来源
[弃用] getUserMedia() 不再适用于不安全的来源。要使用此功能,您应该考虑将应用程序切换到安全源,例如 HTTPS。