C
C
chincharovpc2019-09-16 21:39:17
JavaScript
chincharovpc, 2019-09-16 21:39:17

SpeechKit API in JS?

I record from a microphone in .ogg
format . The function returns me a link to a file like " blob: https://xn--80aaj5aiiy2b.xn--p1ai/ce8b1088-7f67-45... "
Then I have to transfer via API to Yandex SpeechKit , only it is not possible to transfer
Here is the function itself

function SpeechKit(link) {
    console.log(link);

    var data = null;
    var xhr = new XMLHttpRequest();

    xhr.addEventListener("readystatechange", function () {
        if (this.readyState === 4) {
            console.log(this.responseText);
        }
    });

    xhr.open("POST", "https://stt.api.cloud.yandex.net/speech/v1/stt:recognize",true);
    xhr.setRequestHeader("Authorization", "Api-Key ........");
    xhr.setRequestHeader("Content-Type", "text/plain");
    xhr.setRequestHeader("Accept", "/");
    xhr.setRequestHeader("Cache-Control", "no-cache");
    xhr.setRequestHeader("Postman-Token", "9d5bfa....");
    xhr.setRequestHeader("cache-control", "no-cache");

    xhr.send(data);
}

How should I send link via API ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chincharovpc, 2019-09-18
@chincharovpc

Smog.

  • We return the answer
  • Didn't find what you were looking for?

    Ask your question

    Ask a Question

    731 491 924 answers to any question