Issues Rendering Video in VideoGallery on React

Manoj Gavel 0 Reputation points
2024-11-06T11:06:22.5+00:00

Stuck on using VideoGallery to render video in a React project. Successfully receiving a call response after joining the call, but unable to render the video optimally. Here’s the method used:

import { VideoGallery } from "@azure/communication-react";

<VideoGallery
            layout={layout}
            localParticipant={MockLocalParticipant}
            remoteParticipants={mockRemoteParticipants}
            localVideoViewOptions={localVideoViewOptions}
            pinnedParticipants={pinnedParticipants}
            onPinParticipant={(communicationUserId) => {
              setPinnedParticipants(pinnedParticipants.concat(communicationUserId));
            }}
            onUnpinParticipant={(communicationUserId) => {
              console.log(pinnedParticipants.filter((u) => u !== communicationUserId));
              setPinnedParticipants(
                pinnedParticipants.filter((u) => u !== communicationUserId)
              );
            }}
            remoteVideoTileMenu={true}
          />
Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
1,003 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Shree Hima Bindu Maganti 3,130 Reputation points Microsoft Vendor
    2024-11-07T08:34:31.27+00:00

    Hi @Manoj Gavel ,
    welcome to the Microsoft Q&A Platform!
    It seems you're encountering an issue with rendering video in the VideoGallery component of your React project while using the Azure Communication Services React SDK.

    Ensure Video Streams Are Available

    Make sure both the local and remote participants have valid video streams:

    const MockLocalParticipant = {
      videoStream: mockLocalVideoStream, // Ensure video stream exists
    };
    const mockRemoteParticipants = [
      {
        videoStream: mockRemoteVideoStream, // Ensure each remote participant has a video stream
      },
    ];
    

    Layout Configuration

    Ensure the layout is correctly defined for both local and remote videos:

    const layout = {
      local: "floating", // Options: "floating", "grid", "stacked"
      remote: "grid",    // Options: "grid", "stacked"
    };
    

    Local Video Options

    Ensure localVideoViewOptions is correctly set to display the local video:

    const localVideoViewOptions = {
      isMirrored: true, // Optional: Mirrors the local video
    };
    

    Disable VideoTileMenu for Testing

    Temporarily set remoteVideoTileMenu to false for debugging:

    <VideoGallery
      layout={layout}
      localParticipant={MockLocalParticipant}
      remoteParticipants={mockRemoteParticipants}
      localVideoViewOptions={localVideoViewOptions}
      pinnedParticipants={pinnedParticipants}
      onPinParticipant={(userId) => setPinnedParticipants([...pinnedParticipants, userId])}
      onUnpinParticipant={(userId) => setPinnedParticipants(pinnedParticipants.filter(id => id !== userId))}
      remoteVideoTileMenu={false} // Disable for testing
    />
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.