fix(core): fix circular import and simplify media types (#569)

This commit is contained in:
Sam Potts
2026-02-19 16:39:16 +11:00
committed by GitHub
parent 846d38e79b
commit 38b3a8f55c
4 changed files with 8 additions and 5 deletions
-1
View File
@@ -1,5 +1,4 @@
export * from './feature';
export type { AudioApiProxy, MediaApiProxy, MediaApiProxyTarget, VideoApiProxy } from './media/proxy';
export * from './media/types';
export * from './store/features';
export * from './store/selectors';
+2 -1
View File
@@ -1,6 +1,7 @@
import type { MediaApiProxyTarget } from '@videojs/core';
import type { AnyConstructor } from '@videojs/utils/types';
import Hls from 'hls.js';
import type { MediaApiProxyTarget } from '../../core/media/proxy';
import { VideoApiProxy } from './proxy';
// This is used by the web component because it needs to extend HTMLElement!
+1 -1
View File
@@ -19,7 +19,7 @@ export type MediaBaseApi = {
export type MediaApi = WithOptional<MediaBaseApi, HTMLVideoElement>;
export type Media = MediaApi | HTMLMediaElement | HTMLAudioElement | HTMLVideoElement | null;
export type Media = HTMLMediaElement | HTMLAudioElement | HTMLVideoElement;
export interface MediaContainer extends HTMLElement {}
@@ -1,6 +1,9 @@
import type { MediaApiProxy } from '@videojs/core/dom';
interface Attachable {
attach(target: EventTarget): void;
detach(): void;
}
export function attachMediaElement<T extends HTMLVideoElement>(media: MediaApiProxy): (element: T | null) => void {
export function attachMediaElement<T extends HTMLVideoElement>(media: Attachable): (element: T | null) => void {
return (element: T | null) => {
if (element) {
media.attach(element);