mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
fix(core): fix circular import and simplify media types (#569)
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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!
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user