mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-13 07:46:17 -08:00
完成selector
This commit is contained in:
1 parent
53d2f12ab6
commit
aee225bc7f
10 files changed
+138
-89
No files matched your search
@@ -4,3 +4,4 @@
|
||||
- [Events](/events)
|
||||
- [Class](/class)
|
||||
- [Libraries](/libraries)
|
||||
- [Question](/question)
|
||||
@@ -0,0 +1,35 @@
|
||||
## Create selector in the controls
|
||||
|
||||
Sometimes you need to customize the behavior of the selector, then you can add `selector` and `onSelect` properties when adding a control. At the same time, you can also perform custom operations by listening to the `selector` event
|
||||
|
||||
[Run Code](/Question.selector)
|
||||
|
||||
```js
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
controls: [
|
||||
{
|
||||
position: 'right',
|
||||
html: 'Subtitle 01',
|
||||
selector: [
|
||||
{
|
||||
name: 'Subtitle 01',
|
||||
url: '/assets/sample/subtitle.srt?id=1',
|
||||
},
|
||||
{
|
||||
name: 'Subtitle 02',
|
||||
url: '/assets/sample/subtitle.srt?id=2',
|
||||
},
|
||||
],
|
||||
onSelect: function (item) {
|
||||
art.subtitle.switch(item.url, item.name);
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
art.on('selector', function (item) {
|
||||
console.info(item);
|
||||
});
|
||||
```
|
||||
Reference in new issue
Block a user