mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-22 21:31:20 -08:00
update
This commit is contained in:
1 parent
5e9057f060
commit
4d66a8538d
18 files changed
+137
-118
No files matched your search
@@ -0,0 +1,44 @@
|
||||
---
|
||||
title: 怎么添加设置面板
|
||||
sidebar_position: 6
|
||||
---
|
||||
|
||||
设置面板类似于列表选择的集合,而且支持多层嵌套
|
||||
|
||||
### 切换字幕
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
```js
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
setting: true,
|
||||
flip: true,
|
||||
playbackRate: true,
|
||||
aspectRatio: true,
|
||||
settings: [
|
||||
{
|
||||
html: 'Subtitle',
|
||||
selector: [
|
||||
{
|
||||
default: true,
|
||||
html: '<span style="color:red">Subtitle 01</span>',
|
||||
url: '/assets/sample/subtitle.srt?id=1',
|
||||
},
|
||||
{
|
||||
html: '<span style="color:yellow">Subtitle 02</span>',
|
||||
url: '/assets/sample/subtitle.srt?id=2',
|
||||
},
|
||||
],
|
||||
onSelect: function (item, $dom) {
|
||||
console.info(item, $dom);
|
||||
|
||||
art.subtitle.url = item.url;
|
||||
|
||||
return '你点击了 ' + item.html;
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
```
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
title: 怎么添加设置面板
|
||||
sidebar_position: 6
|
||||
---
|
||||
@@ -1,65 +0,0 @@
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: 'https://artplayer.org/assets/sample/video.mp4',
|
||||
muted: true,
|
||||
autoSize: true,
|
||||
autoplay: true,
|
||||
ads: [
|
||||
{
|
||||
url: '/assets/sample/test1.mp4'
|
||||
},
|
||||
{
|
||||
url: '/assets/sample/test2.webm'
|
||||
},
|
||||
],
|
||||
controls: [
|
||||
{
|
||||
position: 'right',
|
||||
html: '跳过广告',
|
||||
click: function () {
|
||||
art.ads.end();
|
||||
},
|
||||
},
|
||||
],
|
||||
layers: [
|
||||
{
|
||||
html: '跳过广告',
|
||||
style: {
|
||||
position: 'absolute',
|
||||
top: '20px',
|
||||
right: '20px',
|
||||
},
|
||||
click: function () {
|
||||
art.ads.end();
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// 当每个视频广告播放时触发
|
||||
art.on('ads:start', function(item) {
|
||||
console.info('广告开始播放: ' + item.url);
|
||||
});
|
||||
|
||||
// 当全部视频广告播放完成
|
||||
art.on('ads:end', function() {
|
||||
console.info('广告已经结束');
|
||||
});
|
||||
|
||||
// 当前广告的下标
|
||||
console.info(art.ads.index);
|
||||
|
||||
// 广告是否已经结束
|
||||
console.info(art.ads.isEnd);
|
||||
|
||||
// 广告是否正在播放
|
||||
console.info(art.ads.playing);
|
||||
|
||||
// 上一个广告的对象
|
||||
console.info(art.ads.prev);
|
||||
|
||||
// 当前广告的对象
|
||||
console.info(art.ads.current);
|
||||
|
||||
// 下一个广告的对象
|
||||
console.info(art.ads.next);
|
||||
Reference in new issue
Block a user