main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[d565449] | 1 | import * as React from 'react';
|
---|
| 2 | export interface HTMLMediaProps extends React.AudioHTMLAttributes<any>, React.VideoHTMLAttributes<any> {
|
---|
| 3 | src: string;
|
---|
| 4 | }
|
---|
| 5 | export interface HTMLMediaState {
|
---|
| 6 | buffered: any[];
|
---|
| 7 | duration: number;
|
---|
| 8 | paused: boolean;
|
---|
| 9 | muted: boolean;
|
---|
| 10 | time: number;
|
---|
| 11 | volume: number;
|
---|
| 12 | playing: boolean;
|
---|
| 13 | }
|
---|
| 14 | export interface HTMLMediaControls {
|
---|
| 15 | play: () => Promise<void> | void;
|
---|
| 16 | pause: () => void;
|
---|
| 17 | mute: () => void;
|
---|
| 18 | unmute: () => void;
|
---|
| 19 | volume: (volume: number) => void;
|
---|
| 20 | seek: (time: number) => void;
|
---|
| 21 | }
|
---|
| 22 | declare type MediaPropsWithRef<T> = HTMLMediaProps & {
|
---|
| 23 | ref?: React.MutableRefObject<T | null>;
|
---|
| 24 | };
|
---|
| 25 | export default function createHTMLMediaHook<T extends HTMLAudioElement | HTMLVideoElement>(tag: 'audio' | 'video'): (elOrProps: HTMLMediaProps | React.ReactElement<HTMLMediaProps>) => readonly [React.ReactElement<MediaPropsWithRef<T>, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>, HTMLMediaState, {
|
---|
| 26 | play: () => Promise<void> | undefined;
|
---|
| 27 | pause: () => void;
|
---|
| 28 | seek: (time: number) => void;
|
---|
| 29 | volume: (volume: number) => void;
|
---|
| 30 | mute: () => void;
|
---|
| 31 | unmute: () => void;
|
---|
| 32 | }, React.MutableRefObject<T | null>];
|
---|
| 33 | export {};
|
---|
Note:
See
TracBrowser
for help on using the repository browser.