完成selector

This commit is contained in:
Harvey committed 2020-08-26 10:43:06 +08:00
1 parent 53d2f12ab6
commit aee225bc7f
10 files changed
+138 -89

No files matched your search

+1
View File
@@ -4,3 +4,4 @@
- [Events](/events)
- [Class](/class)
- [Libraries](/libraries)
- [Question](/question)
+35
View File
@@ -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);
});
```