This example assumes using AssemblyAI; is in scope and apiKey contains your AssemblyAI API key.
1 2 3 4 5 6 7 8 910111213141516171819202122
usingvarclient=GetAuthenticatedApi();varfileUrl="https://github.com/AssemblyAI-Community/audio-examples/raw/main/20230607_me_canadian_wildfires.mp3";// You can also transcribe a local file by uploading bytes first:// var apiKey = Environment.GetEnvironmentVariable("ASSEMBLYAI_API_KEY")!;// var uploaded = await client.Files.UploadAsync(apiKey, await File.ReadAllBytesAsync("./path/to/file.mp3"));// fileUrl = uploaded.UploadUrl!;varqueued=awaitclient.Transcripts.SubmitAsync(newTranscriptParams{AudioUrl=fileUrl,SpeechModels=[],LanguageDetection=true,SpeakerLabels=true,AutoHighlights=true,});// Submit returns immediately; poll Transcripts.GetAsync until the status is Completed (or Error).vartranscript=awaitPollUntilTerminalAsync(client,queued.Id);transcript.EnsureStatusCompleted();