我无法从我当时的承诺中访问某个功能。 gotStream(stream)显示为undefined。我尝试过NgZone,但这也没有帮助。非常感谢你。
for indate, enddate in zip(datelist, datelist[1:]):
indateunix = tm.mktime(indate.timetuple())
enddateunix = tm.mktime(enddate.timetuple())
...
将函数定义为箭头函数也将gotstream显示为undefined:
gotStream(stream) {
this.localVideo.nativeElement.srcObject = stream;
this.localStream = stream;
this.callButton.nativeElement.disabled = false;
}
start() {
navigator.mediaDevices.getUserMedia({ audio: true, video: true }).then(function (e) {
debugger;
this.gotStream(e);
}).catch(function (e) {
alert('getUserMedia() error: ' + e.name);
});
}