yodaos-project / yoda.js

Application Framework that powered YodaOS
Apache License 2.0
187 stars 48 forks source link

vui: voice ui component #647

Closed legendecas closed 5 years ago

legendecas commented 5 years ago

Is your feature request related to a problem? Please describe. Ease developer concerned voice UI events implementation.

Describe the solution you'd like

var vf = new VoiceFlow([
  /* Automatically handles SpeechSynthesisUtterance resolution/cancellation */
  () => synth.speak('Playback down'), 
  /* Automatically handles MediaPlayer resolution/cancellation */
  () => new MediaPlayer().start('/data/media/music.mp3'),
  (done, onCancel) => {
    var customPlayer = new SomePlayer()
      .on('end', () => done())
    onCancel(() => player.stop())
  }
])
vf.start() // Acquires audio focus
setTimeout(() => vf.cancel(), 1000) // Abandons audio focus

Describe alternatives you've considered TODO.

yorkie commented 5 years ago

This looks good on linear task, do we need a flow that do works in parallel?

legendecas commented 5 years ago

Landed on https://github.com/yodaos-project/yodart/pull/652