Search code examples
javascriptazure-communication-services

ACS Group video call - not sending video to the call


I'm not getting any video from a group call. I'm able to record the call, but when I watch the video, I only see a round profile option for each participant. No video is getting sent. How do I get the stream sent to the call?

callClient = new CallClient();
        var tokenCredential = new AzureCommunicationTokenCredential(userAccessToken);
        callAgent = await callClient.createCallAgent(tokenCredential);
...
var deviceManager = await callClient.getDeviceManager();
        await deviceManager.askDevicePermission({ video: true });
        await deviceManager.askDevicePermission({ audio: true });
        // Listen for an incoming call to accept.
        callAgent.on('incomingCall', async (args) => {
            try {
                var incomingCall = args.incomingCall;
            } catch (error) {
                console.error(error);
            }
        });
        camera = (await deviceManager.getCameras())[0];
        
        localVideoStream = new LocalVideoStream(camera);
        localVideoStreamRenderer = new VideoStreamRenderer(localVideoStream);
        const view = await localVideoStreamRenderer.createView();

          document.getElementById("myVideo").appendChild(view.target);  
...
        const destinationToCall = { groupId: "E51F195A-45D2-4F83-8CE4-565A333A9706" };
        call = callAgent.join(destinationToCall);
...
        await call.startVideo(localVideoStream);


Solution

  • found the call = callAgent.join( destinationToCall, { videoOptions: { localVideoStreams: localVideoStream ? [localVideoStream] : undefined }, audioOptions: { muted: false } }); issue. I had to input the video and audio streams into the initiation of the call, rather than later. So instead of

    call = callAgent.join(destinationToCall);
    

    I had to call

            call = callAgent.join(
                destinationToCall,
                {
                    videoOptions: {
                        localVideoStreams: localVideoStream ? [localVideoStream] : undefined
                    },
                    audioOptions: { muted: false }
                });