mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 04:01:20 -08:00
refactor(dash): [PKG-DASH-04] migrate strict TypeScript and compatible declarations
This commit is contained in:
1 parent
7de04573b6
commit
6840544e0e
38 files changed
+1744
-102
No files matched your search
@@ -0,0 +1,12 @@
|
||||
import Artplayer from 'artplayer'
|
||||
import dashControl from 'artplayer-plugin-dash-control'
|
||||
|
||||
type OldOption = Parameters<typeof dashControl>[0]
|
||||
type OldQuality = NonNullable<OldOption['quality']>
|
||||
const options: OldOption = { quality: { control: true, getName: (level: object) => String(level) }, audio: { setting: true } }
|
||||
const quality: OldQuality = { title: 'Quality', auto: 'Auto' }
|
||||
const formatter: NonNullable<OldQuality['getName']> = value => String(value)
|
||||
const art = new Artplayer({ container: '#player', url: 'video.mpd', plugins: [dashControl(options)] })
|
||||
const plugin: { name: 'artplayerPluginDashControl', update: () => void } = dashControl({ quality })(art)
|
||||
const done: void = plugin.update()
|
||||
void [formatter, done]
|
||||
Reference in new issue
Block a user