mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 06:31:20 -08:00
docs: 添加 proxy 选项说明,支持代理现有的 video DOM 元素
This commit is contained in:
1 parent
d3c66d8c44
commit
625f96534b
2 files changed
+34
No files matched your search
@@ -1182,3 +1182,20 @@ var art = new Artplayer({
|
|||||||
[artplayer/types/cssVar.d.ts](https://github.com/zhw2590582/ArtPlayer/blob/master/packages/artplayer/types/cssVar.d.ts)
|
[artplayer/types/cssVar.d.ts](https://github.com/zhw2590582/ArtPlayer/blob/master/packages/artplayer/types/cssVar.d.ts)
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
## `proxy`
|
||||||
|
|
||||||
|
- Type: `function`
|
||||||
|
- Default: `undefined`
|
||||||
|
|
||||||
|
The function can return a third-party `HTMLCanvasElement` or `HTMLVideoElement`, for example, it can proxy an existing `video` DOM element
|
||||||
|
|
||||||
|
<div className="run-code">▶ Run Code</div>
|
||||||
|
|
||||||
|
```js{4}
|
||||||
|
var art = new Artplayer({
|
||||||
|
container: '.artplayer-app',
|
||||||
|
url: '/assets/sample/video.mp4',
|
||||||
|
proxy: () => document.createElement('video')
|
||||||
|
});
|
||||||
|
```
|
||||||
@@ -1199,3 +1199,20 @@ var art = new Artplayer({
|
|||||||
[artplayer/types/cssVar.d.d.ts](https://github.com/zhw2590582/ArtPlayer/blob/master/packages/artplayer/types/cssVar.d.ts)
|
[artplayer/types/cssVar.d.d.ts](https://github.com/zhw2590582/ArtPlayer/blob/master/packages/artplayer/types/cssVar.d.ts)
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
## `proxy`
|
||||||
|
|
||||||
|
- Type: `function`
|
||||||
|
- Default: `undefined`
|
||||||
|
|
||||||
|
函数可以返回一个第三方的 `HTMLCanvasElement` 或者 `HTMLVideoElement`,例如可以代理一个已经存在的 `video` dom元素
|
||||||
|
|
||||||
|
<div className="run-code">▶ Run Code</div>
|
||||||
|
|
||||||
|
```js{4}
|
||||||
|
var art = new Artplayer({
|
||||||
|
container: '.artplayer-app',
|
||||||
|
url: '/assets/sample/video.mp4',
|
||||||
|
proxy: () => document.createElement('video')
|
||||||
|
});
|
||||||
|
```
|
||||||
Reference in new issue
Block a user