yodaos-project / yoda.js

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

media-player: refactor #726

Closed legendecas closed 5 years ago

legendecas commented 5 years ago

Compatible mode:

var MediaPlayer = require('@yoda/multimedia').MediaPlayer
var player = new MediaPlayer()
player.start('/opt/media/awake_01.wav')
player.on('playbackcomplete', () => player.stop())

Exact new API:

var MediaPlayer = require('@yoda/multimedia').MediaPlayer
var player = new MediaPlayer()
player.setDataSource('/opt/media/awake_01.wav')
player.prepare()
player.start() // automatically delayed on to prepared
player.on('playbackcomplete', () => player.stop())
Checklist
rokidbot commented 5 years ago

Can one of the admins verify this patch?

yorkie commented 5 years ago

BTW, we should tweak all the apps before landing this PR :)

yorkie commented 5 years ago

The following apps need changes, too:

legendecas commented 5 years ago

The following apps need changes, too:

We strived to have the API compatible with previous version. So no migration was expected alone with this PR now.