0

I'm trying to get google meet caption(when user complete talking) but I'm unable to do that, I receive captions in pieces,

so My question is how can i get the google meet caption when user complete his talk using javascript mutation observe.

this is what I'm trying...

var mutationObserver = new MutationObserver(function(mutations) {
    // observe the caption text element for changes in the text and then console the text from google meet
    let name = "";
    let caption = "";
    mutations.forEach(function(mutation) {
        if (mutation.type === 'childList') {
            if (mutation.addedNodes.length > 0) {
                if(mutation.addedNodes[0].className == "K6EKFb"){
                    name = mutation.addedNodes[0].childNodes[1].innerText;
                }
                if (mutation.addedNodes[0].nodeName === "SPAN") {
                    caption = mutation.addedNodes[0].innerText;;
                    let meetingName = document.getElementsByClassName("u6vdEc ouH3xe")[0].innerText
                    let textToSend = createCaption(name,caption);
                    chrome.runtime.sendMessage({message: "update_file",captions: textToSend,meeting_name: meetingName});
                }
            }
        }
    });
let mutationConfig = {  
    characterData: true,
    childList: true,
    subtree: true,
    characterDataOldValue: true,
    attributes: true,
    attributeOldValue: true
}
mutationObserver.observe(document.documentElement,mutationConfig);

Thank You

0 Answers0