question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Camera / Mic Indicator is on when the camera was initialising user routed to different page.

See original GitHub issue

I am using the below code to show the preview video before joining the call, but when the camera was initialising if the user navigates to a different page then the LED light indicator keeps on running on different route also. It should get closed as soon as the user leaves the page.

Previe Video Code

import {
	ConsoleLogger,
	DefaultDeviceController,
	LogLevel,
} from "amazon-chime-sdk-js";

const logger = new ConsoleLogger("sdk", LogLevel.INFO);
const deviceController = new DefaultDeviceController(logger, {
enableWebAudio: true,
});

const previewVideo = async () => {
  const audioList = await deviceController.listAudioInputDevices();
  const deviceList = await deviceController.listVideoInputDevices();
  await deviceController.chooseVideoInputDevice(deviceList[0]?.deviceId);
  deviceController.startVideoPreviewForVideoInput(videoElement.current);
};

Render: <video ref={videoElement}></video>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
devalevenkateshcommented, Jan 4, 2022

Thanks for reporting the issue. Yes, if JS SDK has already called getUserMedia as part of await deviceController.chooseVideoInputDevice(deviceList[0]?.deviceId); then the LED will go ON and any re-direction would not stop it automatically.

To turn the LED off, you have to follow this FAQ.

You also have to check for user re-direction though. You can use PageVisibility API to this and do the following:

// Handle page visibility change
document.addEventListener(visibilityChange, handleVisibilityChange, false);

async function handleVisibilityChange() {
  if (document.visibilityState === 'hidden') {
    // Select no video device (releases any previously selected device)
    await meetingSession.audioVideo.chooseVideoInputDevice(null);
    
    // Stop a video preview that was previously started (before session starts)
    meetingSession.audioVideo.stopVideoPreviewForVideoInput(previewVideoElement);
    
    // Stop the meeting session (audio and video)
    meetingSession.audioVideo.stop();
  }
}

Please let me know if this works for you or you have more questions.

0reactions
jing-chen1commented, Feb 2, 2022

Closing it for now, feel free to reopen it if you still have problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows camera, microphone, and privacy - Microsoft Support
In Windows, having a camera and microphone as part of your device lets you make Teams video calls, take pictures, record videos, and...
Read more >
Privacy Indicators | Android Open Source Project
When users click the microphone or camera indicators, they see which apps have accessed their data. This feature is mandatory for all OEMs....
Read more >
Use your camera & microphone - Google Chrome Help
You can use your camera and microphone for sites in Chrome. ... If you're using a different Chrome tab or a different app,...
Read more >
How to Test Webcam and Microphone Settings In ... - ON24
Simple: troubleshoot. Follow our instructions below to test, adjust and fix your microphone and camera settings for any ON24 Webcast Elite event ...
Read more >
How To Enable Webcam/Microphone In Your Cloud Desktop
1. Plug in your webcam and make sure that it is working successfully on the Local desktop. · 2. Locate your RDP file....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found