mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat: add native hls media + refactor (#1154)
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { NativeHlsVideo } from '../../media/native-hls-video';
|
||||
import { safeDefine } from '../safe-define';
|
||||
|
||||
export class NativeHlsVideoElement extends NativeHlsVideo {
|
||||
static readonly tagName = 'native-hls-video';
|
||||
}
|
||||
|
||||
safeDefine(NativeHlsVideoElement);
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
[NativeHlsVideoElement.tagName]: NativeHlsVideoElement;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
// Core
|
||||
export type { Delegate } from '@videojs/core';
|
||||
export { DelegateMixin } from '@videojs/core';
|
||||
export * from '@videojs/core/dom';
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { NativeHlsCustomMedia, NativeHlsMediaDelegate } from '@videojs/core/dom/media/native-hls';
|
||||
import { MediaAttachMixin } from '../../store/media-attach-mixin';
|
||||
import { MediaPropsMixin } from '../../utils/media-props-mixin';
|
||||
|
||||
export class NativeHlsVideo extends MediaPropsMixin(MediaAttachMixin(NativeHlsCustomMedia), NativeHlsMediaDelegate) {
|
||||
constructor() {
|
||||
super();
|
||||
this.attach(this.target);
|
||||
}
|
||||
|
||||
disconnectedCallback(): void {
|
||||
super.disconnectedCallback?.();
|
||||
|
||||
if (!this.hasAttribute('keep-alive')) {
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ function buildAttrPropMap(DelegateClass: AnyClass): Map<string, string> {
|
||||
const map = new Map<string, string>();
|
||||
for (let proto = DelegateClass.prototype; proto && proto !== Object.prototype; proto = Object.getPrototypeOf(proto)) {
|
||||
for (const key of Object.getOwnPropertyNames(proto)) {
|
||||
if (key.startsWith('_')) continue;
|
||||
const desc = Object.getOwnPropertyDescriptor(proto, key);
|
||||
if (desc?.set) map.set(camelToKebab(key), key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user