Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/415.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 要求remoteParticipant在房间视频通话中共享屏幕前获得批准_Javascript_Php_Typescript_Twilio - Fatal编程技术网

Javascript 要求remoteParticipant在房间视频通话中共享屏幕前获得批准

Javascript 要求remoteParticipant在房间视频通话中共享屏幕前获得批准,javascript,php,typescript,twilio,Javascript,Php,Typescript,Twilio,我有两类用户:顾问和客人 咨询师可以在房间的视频通话中分享他们的屏幕。当客人去共享屏幕时,我想通知顾问,客户点击了共享屏幕按钮,允许顾问接受/拒绝客人共享屏幕的请求 在屏幕共享曲目发布之前,没有任何事件会触发,以便我收听并提示顾问接受/拒绝客人在实时视频通话中共享屏幕 以下是启动屏幕共享的代码: export const startScreenShare = async (room: Room): Promise<boolean> => { if (isParticipa

我有两类用户:顾问和客人

咨询师可以在房间的视频通话中分享他们的屏幕。当客人去共享屏幕时,我想通知顾问,客户点击了共享屏幕按钮,允许顾问接受/拒绝客人共享屏幕的请求

在屏幕共享曲目发布之前,没有任何事件会触发,以便我收听并提示顾问接受/拒绝客人在实时视频通话中共享屏幕

以下是启动屏幕共享的代码:

export const startScreenShare = async (room: Room): Promise<boolean> => {

  if (isParticipantSharingScreen(room.localParticipant)) {
    disableParticipantsScreenSharingTrack(room.localParticipant);
    return false;
  }

  // Only allow one participant to share their screen at a time.
  room.participants.forEach((participant) => {
    if (isParticipantSharingScreen(participant)) {
      throw new Error("Only one participant may share their screen at a time.");
    }
  });

  const stream = await navigator.mediaDevices.getDisplayMedia({
    video: {
      width: 1280,
      height: 720,
      frameRate: 10,
    },
  });

  const screenTrack = new LocalVideoTrack(stream.getTracks()[0], {
    name: SCREEN_SHARE_TRACK_NAME,
    logLevel: "warn",
  });

  const track = room.localParticipant.publishTrack(screenTrack);

  screenTrack.once("stopped", () => {
    room.localParticipant.unpublishTrack(screenTrack);
    stopScreenSharing();
  });

  return true;
};
导出常量startScreenShare=async(房间:房间):Promise=>{ if(iParticipantSharingScreen(room.localParticipant)){ 禁用参与者ScreensharingTrack(room.localParticipant); 返回false; } //一次只允许一名参与者共享他们的屏幕。 房间.参与者.forEach((参与者)=>{ if(参与者共享屏幕(参与者)){ 抛出新错误(“一次只能有一名参与者共享屏幕”); } }); const stream=等待navigator.mediaDevices.getDisplayMedia({ 视频:{ 宽度:1280, 身高:720, 帧率:10, }, }); const screenTrack=new LocalVideoTrack(stream.getTracks()[0]{ 名称:屏幕\共享\轨道\名称, 日志级别:“警告”, }); const track=room.localParticipant.publishTrack(屏幕跟踪); 屏幕跟踪。一旦(“停止”,()=>{ room.localParticipant.unpublishTrack(屏幕跟踪); 停止屏幕共享(); }); 返回true; }; 我已经研究了如何使用LocalDataTrack在参与者之间进行对话,以隐藏/显示屏幕共享按钮。我还研究了如何设置订阅规则,以便排除视频聊天中其他人订阅的屏幕曲目。感谢您的帮助