Obtenez des données à partir de transcriptions en attente ou terminées
Transcrire le discours en direct à partir d'un microphone ou d'un flux en direct
Surveiller et gérer l'état de la transcription avec des sessions
Traduire le texte transcrit dans une autre langue
Créer un jeton d'authentification temporaire pour les requêtes côté client
Options et réponses de requête communes pour toutes les opérations de transcription
Créer une session pouvant être utilisée pour diffuser une transcription en direct via un lien public partageable
JavaScriptimport { UrlTranscription } from '@vocalstack/js-sdk'; const sdk = new UrlTranscription({ apiKey: 'YOUR-API-KEY' }); const transcription = await sdk.connect({ url: 'http://example.com/files/meaningless.mp3', }); transcription.start(); // This will print the transcription data as it comes in transcription.onData(console.log); /* { status: 'processing', data: { id: 'd1e7b3b0-7b3b-4b3b-8b3b-0b3b7b3b3b3b', operation: 'transcription-prerecorded', progress: 0.1, timeline: [ { start: 0, end: 7.52, text: 'Meaningless, meaningless, says the teacher, utterly meaningless, everything is meaningless.', language: 'en', translations: { ... }, }, ... ] } } */
JavaScript// Run "npm install @voca l-stack/js-sdk" to install the package import { UrlTranscription } from '@vocalstack/js-sdk'; // Get your key here ⇢ https://www.vocalstack.com/dashboard/api-keys const sdk = new UrlTranscription({ apiKey: 'YOUR-API-KEY' }); const transcription = await sdk.connect({ // URL to the audio file url: 'http://example.com/files/audio.mp3', // Optional: language of the speech spoken // (this can be used to improve the transcription accuracy) language: 'en', // Optional: the maximum duration to transcribe, in seconds // (if not provided, the entire audio file will be transcribed) max_duration_s: 1800, // Optional: the actual duration of the audio file, in seconds // (the transcription starts only if the audio file matches this duration) duration_s: 3600, }); // Start the transcription transcription.start(); // Listen for transcription data transcription.onData((response) => { const { status, data } = response; console.log(status); // 'waiting', 'processing', 'done', or 'error' if (data) { console.log(data.progress); // a value between 0 and 1 console.log(data.timeline); // an object with the transcription timeline } if (status === 'done') { console.log(data.summary); // a summary of the transcription console.log(data.keywords); // an array of keywords console.log(data.paragraphs); // the entire transcription in paragraph form } });