mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 17:01:20 -08:00
refactor: Update video element in Artplayer to support custom canvas or video
This commit updates the `libmedia.js`, `option.d.ts`, `index.js`, `template.js`, and `scheme/index.js` files in the Artplayer repository. The changes introduce a new `video` property in the `Option` type, allowing for the use of a custom video element in Artplayer. The `video` property can be set to `null`, an `HTMLCanvasElement`, or an `HTMLVideoElement`. This enhancement provides flexibility in rendering video content and improves compatibility with different platforms and use cases.
This commit is contained in:
1 parent
5d6b94afa6
commit
66010cb376
8 files changed
+94
-12
No files matched your search
@@ -14,6 +14,13 @@ function validElement(value, type, paths) {
|
||||
);
|
||||
}
|
||||
|
||||
function validVideo(value, _type, paths) {
|
||||
return errorHandle(
|
||||
value === null || value instanceof HTMLCanvasElement || value instanceof HTMLVideoElement,
|
||||
`${paths.join('.')} require 'HTMLVideoElement' or 'HTMLCanvasElement' type`,
|
||||
);
|
||||
}
|
||||
|
||||
export const ComponentOption = {
|
||||
html: validElement,
|
||||
disable: `?${b}`,
|
||||
@@ -68,6 +75,7 @@ export default {
|
||||
autoPlayback: b,
|
||||
autoOrientation: b,
|
||||
airplay: b,
|
||||
video: validVideo,
|
||||
plugins: [f],
|
||||
layers: [ComponentOption],
|
||||
contextmenu: [ComponentOption],
|
||||
|
||||
Reference in new issue
Block a user