mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-30 03:51:25 -08:00
feat: add new properties and methods to enhance player functionality and documentation
This commit is contained in:
1 parent
4681a8bc7a
commit
47085d1275
4 files changed
+149
-4
No files matched your search
@@ -546,4 +546,24 @@ var art = new Artplayer({
|
||||
url: '/assets/sample/video.mp4',
|
||||
miniProgressBar: true,
|
||||
});
|
||||
```
|
||||
```
|
||||
|
||||
## REMOVE_SRC_WHEN_DESTROY
|
||||
|
||||
在销毁播放器时,是否同时移除视频的 `src` 属性并调用 `load()` 以主动释放媒体资源,默认为 `true`。
|
||||
|
||||
开启后可以在单页应用或频繁创建/销毁播放器的场景下,减少视频资源占用;如果你希望保留 video 元素的状态,仅移除界面,可将其设置为 `false`。
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
```js
|
||||
Artplayer.REMOVE_SRC_WHEN_DESTROY = false;
|
||||
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
});
|
||||
|
||||
// 只销毁界面,不主动清空 src
|
||||
art.destroy();
|
||||
```
|
||||
Reference in new issue
Block a user