I have this context:

export const ChimeProvider: React.FC = ({ children }) => {
.../
const updateVideoPreferences = useCallback(() => {


  const videoPreferences = VideoPreferences.prepare();


    // Initialize `VideoPreferences`.

    for (const attendeeId in roster) {
      videoPreferences.add(
        new VideoPreference(`${attendeeId}#content`, 1, TargetDisplaySize.High)
      );

      if (roster[attendeeId]["subscribeToVideo"]) {
        videoPreferences.add(
          new VideoPreference(attendeeId, 1, TargetDisplaySize.High)
        );
      } else {
        videoPreferences.remove(
          new VideoPreference(attendeeId, 1, TargetDisplaySize.High)
        );
      }
      // The remaining remote video sources are not subscribed,
      // so they do not cost bandwidth.
    }

    

    priorityBasedPolicy.chooseRemoteVideoSources(videoPreferences.build());

  }, [roster]);
useEffect(() => {
    if (!roster) return;
    // Reset the video preferences
    for (const attendeeId in roster) {
      roster[attendeeId]["subscribeToVideo"] = false;
    }

    // Only set the most active instructor and the page size students to subscribe video
    const mostActiveInstructor = activeInstructors[0];
    if (mostActiveInstructor && roster[mostActiveInstructor.chimeAttendeeId]) {
      roster[mostActiveInstructor.chimeAttendeeId]["subscribeToVideo"] = true;
    }
    const studentsToSubscribe = filterBySelf(activeStudents, user.id).slice(
      page * pageSize,
      (page + 1) * pageSize
    );

    studentsToSubscribe.forEach((student) => {
      if (!roster[student.chimeAttendeeId]) return;
      roster[student.chimeAttendeeId]["subscribeToVideo"] = true;
    });
    updateVideoPreferences();
  }, [page, activeStudents, activeInstructors, roster, user?.id]);
}

I use const { sharingAttendeeId } = useContentShareState(); in several places in my aplication, it used to work well but after making the changes to the videoPreferences policy it now appers allways as null in all participants that are not the local participant. sharingAttendeeId does update in the client that shares the sceen

I expect sharingAttendeeId to update with the information of the attendee that is sharing the screen as it used to.

0

There are 0 best solutions below