WebRTC API allows you to turn on the flashlight feature on your phone from Chrome. However you can not turn it off. I have seen this problem on my Xiaomi phone and on Samsung devices.
function toggleFlash() {
let that = this;
const mediaStreamTrack = this.$refs.video.srcObject.getVideoTracks()[0];
const imageCapture = new window.ImageCapture(mediaStreamTrack);
imageCapture.getPhotoCapabilities().then(() => {
if (that.tourch === false) {
that.tourch = true;
mediaStreamTrack.applyConstraints({
advanced: [{ torch: true }]
});
} else if (that.tourch === true) {
that.tourch = false;
mediaStreamTrack.applyConstraints({
advanced: [{ torch: false }]
});
}
});
}