简体   繁体   English

Twilio 2.7.2 可编程摄像机保持开启状态

[英]Twilio 2.7.2 Programmable Video Camera Stays On

I have had a nightmare of a time attempting to stop the video tracks and turn off the camera.我曾做过一次噩梦,试图停止视频轨道并关闭相机。 Can ANYONE tell me what I am missing here?任何人都可以告诉我我在这里缺少什么吗? Snippet below is the event handler for when a room is disconnected.下面的代码段是房间断开连接时的事件处理程序。 The code executes fine, but the camera stays on.代码执行良好,但相机保持开启状态。 Thanks in advance.提前致谢。

 this.roomObj.once('disconnected', (room: Room, error) => { // if (error) { // console.log(`An error has occurred with the room connection: ${error}`); // } room.localParticipant.tracks.forEach(publication => { publication.track.stop(); const attachedElements = publication.track.detach(); attachedElements.forEach(element => { element.stop(); element.remove(); }); room.localParticipant.videoTracks.forEach(video => { const trackConst = [video][0].track; trackConst.stop(); // <- error trackConst.detach().forEach(element => { element.stop(); element.remove(); }); room.localParticipant.unpublishTrack(trackConst); }); let element = this.remoteVideo1Container.nativeElement; while (element.firstChild) { element.removeChild(element.firstChild); } let localElement = this.localVideo.nativeElement; while (localElement.firstChild) { localElement.removeChild(localElement.firstChild); } //this.router.navigate(['thanks']); }); }, (error) => { alert(error.message); });

I triggered a full page redirect to shut off the camera with window.location.replace rather than using react-router-dom 's <Redirect to={} /> to fully shut off the camera.我触发了一个完整的页面重定向以使用window.location.replace关闭相机,而不是使用react-router-dom<Redirect to={} />来完全关闭相机。 This may not be possible in your case, and there maybe a better solution.在您的情况下这可能是不可能的,并且可能有更好的解决方案。

If you could use the same route that you were going to anyway.如果您可以使用无论如何都要去的相同路线。 If you weren't planning on changing page, though my solution won't be of much use.如果您不打算更改页面,尽管我的解决方案不会有太大用处。

But having an issue with shutting off the desktop camera light in react, I figured I would share my solution.但是在反应中关闭桌面摄像头灯时遇到问题,我想我会分享我的解决方案。 I can delete or remove this post if this answer displeases anyone or once a Twilio rep (or some mystery person) comes by with a better response.如果此答案令任何人不悦,或者一旦 Twilio 代表(或某个神秘人物)提出更好的回复,我可以删除或删除此帖子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Twilio 可编程视频变焦摄像头 - Twilio programmable video zoom in camera Twilio可编程视频聊天室 - Twilio Programmable Video chatroom Twilio 可编程视频使用 Javascript - Twilio Programmable Video Using Javascript Twilio可编程视频JS /离子 - Twilio Programmable Video JS / Ionic Twilio 可编程视频 - 某些参与者禁用视频,仍需要摄像头权限 - Twilio Programmable Video - Disabled videos for certain participants, camera permission is still requested 我们可以禁用可编程视频中的视频 API - P2P 连接 - Twilio - Can we disable the Video in the Programmable Video API - P2P connection - Twilio 删除包含轨道的 HTML 元素是否足够,还是需要先在 Twilio Programmable Video 中分离它们? - Is it enough to remove the HTML elements containing tracks or do they need to be detached first in Twilio Programmable Video? Twilio 可编程视频:当dominantSpeaker 更改时,音频似乎音量增加并构建static - Twilio Programmable Video: when dominantSpeaker changes, the audio seems to increase in volume and build static 使用来自IP Camera RTSP的Twilio流式传输视频 - Stream Video using Twilio from IP Camera RTSP 有没有办法在 twilio 可编程聊天中添加私人频道? - Is there a way to add private channels to twilio programmable chat?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM