添加字幕url的getter和setter

This commit is contained in:
zhw2590582 committed 2019-10-01 19:51:10 +08:00
1 parent 8d6dcdf6aa
commit 31d1949da0
5 files changed
+98 -23

No files matched your search

+23 -5
View File
@@ -1247,8 +1247,8 @@ art.contextmenu.yourContextmenu.show = false;
| propertie | type | Description |
| --------- | ---------- | --------------- |
| `init` | `Function` | Init subtitle |
| `switch` | `Function` | Switch subtitle |
| `show` | `setter` | Show or hide |
| `url` | `setter` | Switch subtitle |
[Run Code](/)
@@ -1260,10 +1260,28 @@ var art = new Artplayer({
subtitle: {
url: url + '/subtitle/one-more-time-one-more-chance.srt',
},
});
art.once('video:canplay', () => {
art.subtitle.init(url + '/subtitle/one-more-time-one-more-chance.vtt');
controls: [
function subtitle1(art) {
return {
position: 'right',
index: 10,
html: 'subtitle1',
click: function() {
art.subtitle.url = url + '/subtitle/one-more-time-one-more-chance.srt';
},
};
},
function subtitle2(art) {
return {
position: 'right',
index: 20,
html: 'subtitle2',
click: function() {
art.subtitle.url = url + '/subtitle/one-more-time-one-more-chance.vtt';
},
};
},
],
});
```