import{_ as a,c as n,o as l,a7 as s,j as i}from"./chunks/framework.DHbvjPBJ.js";const w=JSON.parse('{"title":"Settings Panel","description":"","frontmatter":{},"headers":[],"relativePath":"en/component/setting.md","filePath":"en/component/setting.md","lastUpdated":1729412494000}'),p={name:"en/component/setting.md"},t=s('
Settings Panel Built-in First, open the settings panel, and then it comes with four built-in items: flip, playbackRate, aspectRatio, subtitleOffset
',3),e=i("div",{className:"run-code"},"▶ Run Code",-1),h=s(`js var art = new Artplayer ({
container: '.artplayer-app' ,
url: '/assets/sample/video.mp4' ,
setting: true ,
flip: true ,
playbackRate: true ,
aspectRatio: true ,
subtitleOffset: true ,
}); 1 2 3 4 5 6 7 8 9
Create - Selection List Property Type Description htmlString, ElementItem DOM iconString, ElementItem Icon selectorArrayItem selector onSelectFunctionClick event widthNumberList Width tooltipStringTooltip text
`,3),k=i("div",{className:"run-code"},"▶ Run Code",-1),E=s(`js var art = new Artplayer ({
container: '.artplayer-app' ,
url: '/assets/sample/video.mp4' ,
setting: true ,
settings: [
{
html: 'Subtitle' ,
width: 250 ,
tooltip: 'Subtitle 01' ,
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 , event ) {
console. info (item, $dom, event);
art.subtitle.url = item.url;
return item.html;
},
},
{
html: 'Quality' ,
width: 150 ,
tooltip: '1080P' ,
selector: [
{
default: true ,
html: '1080P' ,
url: '/assets/sample/video.mp4?id=1080' ,
},
{
html: '720P' ,
url: '/assets/sample/video.mp4?id=720' ,
},
{
html: '360P' ,
url: '/assets/sample/video.mp4?id=360' ,
},
],
onSelect : function ( item , $dom , event ) {
console. info (item, $dom, event);
art. switchQuality (item.url, item.html);
return item.html;
},
},
],
}); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
Creating - Nested Lists `,2),r=i("div",{className:"run-code"},"▶ Run Code",-1),d=s(`js var art = new Artplayer ({
container: '.artplayer-app' ,
url: '/assets/sample/video.mp4' ,
setting: true ,
settings: [
{
html: 'Multi-level' ,
selector: [
{
html: 'Setting 01' ,
width: 150 ,
selector: [
{
html: 'Setting 01 - 01' ,
},
{
html: 'Setting 01 - 02' ,
},
],
onSelect : function ( item , $dom , event ) {
console. info (item, $dom, event);
return item.html;
},
},
{
html: 'Setting 02' ,
width: 150 ,
selector: [
{
html: 'Setting 02 - 01' ,
},
{
html: 'Setting 02 - 02' ,
},
],
onSelect : function ( item , $dom , event ) {
console. info (item, $dom, event);
return item.html;
},
},
],
},
],
}); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
Property Type Description htmlString, ElementElement's DOM element iconString, ElementElement's icon switchBooleanButton's default state onSwitchFunctionButton toggle event tooltipStringTooltip text
`,3),g=i("div",{className:"run-code"},"▶ Run Code",-1),c=s(`js var art = new Artplayer ({
container: '.artplayer-app' ,
url: '/assets/sample/video.mp4' ,
setting: true ,
settings: [
{
html: 'PIP Mode' ,
tooltip: 'Close' ,
icon: '<img width="22" heigth="22" src="/assets/img/state.svg">' ,
switch: false ,
onSwitch : function ( item , $dom , event ) {
console. info (item, $dom, event);
const nextState = ! item.switch;
art.pip = nextState;
item.tooltip = nextState ? 'Open' : 'Close' ;
return nextState;
},
},
],
}); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Create - Range Slider Attribute Type Description htmlString, ElementThe element's DOM element iconString, ElementThe element's icon rangeArrayDefault state array onRangeFunctionEvent triggered upon completion onChangeFunctionEvent triggered on change tooltipStringTooltip text
js const range = [ 5 , 1 , 10 , 1 ];
const value = range[ 0 ];
const min = range[ 1 ];
const max = range[ 2 ];
const step = range[ 3 ]; 1 2 3 4 5
`,4),y=i("div",{className:"run-code"},"▶ Run Code",-1),b=s(`js var art = new Artplayer ({
container: '.artplayer-app' ,
url: '/assets/sample/video.mp4' ,
setting: true ,
settings: [
{
html: 'Slider' ,
tooltip: '5x' ,
icon: '<img width="22" height="22" src="/assets/img/state.svg">' ,
range: [ 5 , 1 , 10 , 1 ],
onChange : function ( item , $dom , event ) {
console. info (item, $dom, event);
return item.range[ 0 ] + 'x' ;
},
},
],
}); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Add `,2),o=i("div",{className:"run-code"},"▶ Run Code",-1),F=s(`js var art = new Artplayer ({
container: '.artplayer-app' ,
url: '/assets/sample/video.mp4' ,
setting: true ,
});
art.setting.show = true ;
art.setting. add ({
html: 'Slider' ,
tooltip: '5x' ,
icon: '<img width="22" heigth="22" src="/assets/img/state.svg">' ,
range: [ 5 , 1 , 10 , 1 ],
}); 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Delete `,2),u=i("div",{className:"run-code"},"▶ Run Code",-1),m=s(`js var art = new Artplayer ({
container: '.artplayer-app' ,
url: '/assets/sample/video.mp4' ,
setting: true ,
flip: true ,
settings: [
{
name: 'slider' ,
html: 'Slider' ,
tooltip: '5x' ,
icon: '<img width="22" heigth="22" src="/assets/img/state.svg">' ,
range: [ 5 , 1 , 10 , 1 ],
},
],
});
art.setting.show = true ;
art. on ( 'ready' , () => {
setTimeout (() => {
// Delete the setting by name
art.setting. remove ( 'slider' );
}, 3000 );
}); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Updates `,2),C=i("div",{className:"run-code"},"▶ Run Code",-1),B=s(`js var art = new Artplayer ({
container: '.artplayer-app' ,
url: '/assets/sample/video.mp4' ,
setting: true ,
settings: [
{
name: 'slider' ,
html: 'Slider' ,
tooltip: '5x' ,
icon: '<img width="22" heigth="22" src="/assets/img/state.svg">' ,
range: [ 5 , 1 , 10 , 1 ],
},
],
});
art.setting.show = true ;
art. on ( 'ready' , () => {
setTimeout (() => {
// Update the setting by name
art.setting. update ({
name: 'slider' ,
html: 'PIP Mode' ,
tooltip: 'Close' ,
icon: '<img width="22" heigth="22" src="/assets/img/state.svg">' ,
switch: false ,
});
}, 3000 );
}); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
`,1),_=[t,e,h,k,E,r,d,g,c,y,b,o,F,u,m,C,B];function A(v,D,S,T,q,f){return l(),n("div",null,_)}const x=a(p,[["render",A]]);export{w as __pageData,x as default};