frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

12-HarmonyOS5-SpeechKit-AICaptionComponent-Case

2•zhousg•4h ago
Case Study of SpeechKit AICaption Component in HarmonyOS 5.0 Abstract This article introduces how to use @hms.ai.AICaption and @kit.AudioKit to implement voice recording and AI caption display functions in HarmonyOS 5.0. By creating the SpeechKitAICaptionComponent component, users can control the start and end of recording and display AI captions during recording. import { AICaptionComponent, AICaptionController, AudioData } from '@hms.ai.AICaption'; import { audio } from '@kit.AudioKit';

@Entry @Component struct SpeechKitAICaptionComponent {

  controller = new AICaptionController 

  audioCapturer?:  audio.AudioCapturer 

  @State isShown: boolean = false 

  async start () { 
    let audioStreamInfo: audio.AudioStreamInfo = { 
      samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000, 
      channels: audio.AudioChannel.CHANNEL_1, 
      sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, 
      encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW 
    }; 

    let audioCapturerInfo: audio.AudioCapturerInfo = { 
      source: audio.SourceType.SOURCE_TYPE_MIC, 
      capturerFlags: 0 
    }; 

    let audioCapturerOptions: audio.AudioCapturerOptions = { 
      streamInfo: audioStreamInfo, 
      capturerInfo: audioCapturerInfo 
    }; 

    this.audioCapturer = await audio.createAudioCapturer(audioCapturerOptions) 
    this.audioCapturer.on('readData', (buffer) => { 
      const audioData: AudioData = { data: new Uint8Array(buffer) } 
      this.controller.writeAudio(audioData) 
    }) 
    await this.audioCapturer.start() 
    this.isShown = true 
  } 

  async stop () { 
    await this.audioCapturer?.release() 
    this.isShown = false 
  } 

  build() { 
    Column({ space: 15 }) { 
      Button('Start Recording') 
        .onClick(() => { 
          this.start() 
        }) 
      Button('Stop Recording') 
        .onClick(() => { 
          this.stop() 
        }) 
      if (this.isShown) { 
        AICaptionComponent({ 
          isShown: this.isShown, 
          controller: this.controller, 
          options: { 
            initialOpacity: 1, 
            onPrepared: () => { 
              // 
            }, 
            onError: (e) => { 
              // 
            } 
          } 
        }) 
          .width('100%') 
          .height(100) 
      } 
    } 
    .padding(15) 
    .height('100%') 
    .width('100%') 
  } 
}

I built a gamified app to help you quit bad habits – feedback wanted

1•skyzouw•2m ago•0 comments

Ask HN: Why do so few tools import data from their competitors?

1•sigalor•6m ago•0 comments

In light of US sanctions, China unveils first parallel optical computing chip

https://www.scmp.com/news/china/science/article/3315496/light-us-sanctions-china-unveils-first-parallel-optical-computing-chip-meteor-1
1•01-_-•6m ago•0 comments

New York is building a new nuclear power plant to supply a million new homes

https://stansberryresearch.com/articles/new-york-is-building-a-new-advanced-nuclear-power-plant-to-supply-a-million-new-homes-or-one-artificial-intelligence-data-center
2•01-_-•8m ago•0 comments

Does a Focus on Royalty Obscure British History?

https://www.historytoday.com/archive/head-head/does-focus-royalty-obscure-british-history
1•pepys•9m ago•0 comments

Fair(er) DRM GPU Scheduler

https://blogs.igalia.com/tursulin/fair-er-drm-gpu-scheduler/
2•Bogdanp•10m ago•0 comments

Orienting Towards Wizard Power

https://www.lesswrong.com/posts/Wg6ptgi2DupFuAnXG/orienting-toward-wizard-power
1•desmondwillow•11m ago•0 comments

Enterprise Application Modernization and the Role of an IDP

https://wso2.com/library/blogs/enterprise-application-modernization-and-the-role-of-an-internal-developer-platform/
2•kavishkafdo•12m ago•0 comments

U.S. House tells staffers not to use Meta's WhatsApp

https://www.cnbc.com/2025/06/23/meta-whatsapp-us-house.html
1•robtherobber•12m ago•0 comments

Debugging memory leaks in Postgres, jemalloc edition

https://www.enterprisedb.com/blog/debugging-memory-leaks-postgres-jemalloc-edition
1•ibobev•13m ago•0 comments

How to Make Money from Yoursurveynow.com

1•RainbowJ•19m ago•0 comments

Repeat Yourself

https://endler.dev/2025/repeat-yourself/
3•M3t0r•19m ago•0 comments

Crowd-Sourcing a Dataset to Make Agents Code Like Humans

https://pdoom.org/crowd_code.html
4•anougaret•20m ago•0 comments

Scientists Generated "Impossible" Photons Directly from Quantum Vacuum

https://www.rudebaguette.com/en/2025/06/they-created-light-from-nothing-scientists-achieve-the-impossible-by-generating-photons-directly-from-quantum-vacuum/
2•vednig•23m ago•0 comments

A decade of power posing: where do we stand? (2021)

https://www.bps.org.uk/psychologist/decade-power-posing-where-do-we-stand
1•mellosouls•24m ago•0 comments

Goldman Sachs launches AI assistant firmwide, for 10k employees at the bank

https://www.thehindu.com/sci-tech/technology/goldman-sachs-launches-ai-assistant-firmwide-memo-shows/article69730486.ece
1•Bluestein•24m ago•0 comments

Tesla Launches Robotaxi in Austin

https://arstechnica.com/cars/2025/06/tesla-launches-robotaxi-service-in-austin/
2•worik•25m ago•0 comments

Timdle: Place 8 historical events in chronological order

https://www.timdle.com/
1•kaharvi•27m ago•0 comments

Detachable terminal sessions without breaking scrollback

https://ansuz.sooke.bc.ca/entry/389
1•tosh•30m ago•0 comments

Solving LinkedIn Queens Using Haskell

https://imiron.io/post/linkedin-queens/
9•agnishom•30m ago•0 comments

Show HN: Promptive – A native macOS utility for system-wide AI actions

https://www.promptiveai.app
4•helro•40m ago•2 comments

Why is there no consistent single signon API flow?

https://mjg59.dreamwidth.org/72688.html
2•ingve•44m ago•0 comments

Project Indigo – the best camera app for smart phones

https://gregbenzphotography.com/photography-reviews/project-indigo-the-best-camera-app-for-smart-phones/
1•walterbell•48m ago•0 comments

Dutch cloud pioneers face the hard limits of digital sovereignty

https://www.computerweekly.com/news/366626105/Dutch-cloud-pioneers-face-the-hard-limits-of-digital-sovereignty
5•Vinnl•53m ago•1 comments

Trusted Medical Abortion Pill

https://www.homeabortionpillsrx.com/buy-mtp-kit-online
1•IrinaWeindorf00•55m ago•0 comments

Leave Some Work for Tomorrow

https://proteinlanguagemodel.com/blog/leave_work
2•ravishar313•56m ago•1 comments

What CSS length unit should you use?

https://whatunit.com/
1•edent•58m ago•0 comments

A simple, smart tool designed to help users protect every photo and video

1•WuMask•59m ago•0 comments

Continuous Patient Monitoring with AI

https://doi.org/10.3389/fimag.2025.1547166
2•lastboson•1h ago•1 comments

Waiting for Vectors in SQL:202y

http://peter.eisentraut.org/blog/2025/06/24/waiting-for-sql-202y-vectors
2•chmaynard•1h ago•0 comments