Forum Discussion

Xiaohan75's avatar
Xiaohan75
Copper Contributor
Apr 08, 2022

Health bot Media Qurestion

Hello! I have two questions when using the health bot.

1. I try to use the “getUserMedia” method to access the user’s camera inside the health bot as an action, but that called up an error as “navigator is not defined”. Is this because the Azure Health Bot couldn’t access the getUserMedia API? If that’s the reason, are there any other methods I can use to achieve this requirement? Is there any previous chatbot that has successfully accessed the users’ camera and audio?

The core code I try to use in Action:

// require to access a video and audio input device from user
let constrains = {
    video:true,
    audio: true
};
let promise = navigator.mediaDevices.getUserMedia(constraints);

promise.then(function(mediaStream){
    // get video element and play the video
    var video = document.querySelector("video");
    video.srcObject = mediaStream;
    video.onloadedmetadata = function(e){
        video.play();
    };
});
// if the require is failed
promise.catch(function(err){
    console.log(err)
});

 

2. I try to show back the video that the user uploaded to the bot as an attachment but failed. I try to use a Hero card, but I don't really understand how it works for the card action "playVideo". Can I show the video inside a Hero card or others? What should be the value?

No RepliesBe the first to reply

Resources