mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 08:51:20 -08:00
refactor(multiple-subtitles): [PKG-MULTI-SUB-04] expose compatible runtime type entry
This commit is contained in:
1 parent
7f226ff822
commit
d44e81ce22
34 files changed
+3346
-60
No files matched your search
@@ -6,6 +6,29 @@ Multiple subtitles plugin for ArtPlayer
|
||||
|
||||
[https://artplayer.org](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-multiple-subtitles/index.js&example=multiple.subtitles)
|
||||
|
||||
## TypeScript
|
||||
|
||||
The root and `/legacy` type entries preserve historical parameter and return-type extraction.
|
||||
Registration has always been asynchronous. For accurate Promise and selection-method types,
|
||||
use the additive runtime entry, which loads the same implementation:
|
||||
|
||||
```ts
|
||||
import multipleSubtitles from 'artplayer-plugin-multiple-subtitles/runtime'
|
||||
|
||||
const register = multipleSubtitles({
|
||||
subtitles: [{ url: '/subtitles/en.vtt', name: 'en' }],
|
||||
})
|
||||
// With an existing ArtPlayer instance:
|
||||
const result = await register(art)
|
||||
result.tracks(['en'])
|
||||
result.reset()
|
||||
```
|
||||
|
||||
The option object is required; `{}` means no tracks. `tracks()` clears the selection;
|
||||
`reset()` restores all original tracks. Both methods return `void`. The existing `onParser`
|
||||
field remains declared for compatibility but is not invoked by the implementation.
|
||||
See [maintenance notes](ARCHITECTURE.md) for module responsibilities and validation commands.
|
||||
|
||||
## License
|
||||
|
||||
MIT © Harvey Zhao
|
||||
Reference in new issue
Block a user