--- title: 控制器插件 sidebar_position: 5 --- ## 演示 👉 [查看完整演示](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-control/index.js&example=control) ## 安装 ### 通过 `npm` 安装: ```bash $ npm install artplayer-plugin-control ``` ### 通过 `yarn` 安装: ```bash $ yarn add artplayer-plugin-control ``` ### 通过 `script` 安装: ```html ``` 然后你可以通过 `window.artplayerPluginControl` 访问到插件函数 ## 使用
▶ Run Code
```js var art = new Artplayer({ container: '.artplayer-app', url: '/assets/sample/video.mp4', fullscreen: true, fullscreenWeb: true, plugins: [ artplayerPluginControl(), ], }); ``` ## 接口 ### enable - 类型: `Getter/Setter` 是否启用新的控制器UI
▶ Run Code
```js var art = new Artplayer({ container: '.artplayer-app', url: '/assets/sample/video.mp4', fullscreen: true, fullscreenWeb: true, controls: [ { position: 'right', html: '', click: function () { const { enable } = art.plugins.artplayerPluginControl; art.plugins.artplayerPluginControl.enable = !enable; }, }, ], plugins: [ artplayerPluginControl(), ], }); ``