Usage

Seek a lesson video back to the beginning.

This type is used by videoRef

tsx
// Seek a lesson video back to the beginning.
import { Button, Video, VStack, videoRef } from 'kuito';

export function Lesson() {
  const player = videoRef();
  return (
    <VStack flex={1}>
      <Video ref={player} src={{ uri: 'https://example.com/lesson.mp4' }} height={240} controls />
      <Button onPress={() => void player.current?.seek(0).catch(console.error)}>
        Restart lesson
      </Button>
    </VStack>
  );
}

Type declaration

ts
export type VideoHandle = NativeViewHandle<VideoMethods>;

Members 16

NameTypeRequiredDescription
idreadonlystringYes—
parentreadonlyElementHandleYes—
childrenreadonlyElementHandle[]Yes—
focus() => voidYes—
blur() => voidYes—
setProperty<K extends keyof ElementProperties>(key: K, value: ElementProperties[K] | null) => voidYesSets a native prop on the view now, until its binding writes it again.
addEventListener(type: string, fn: (e: KuitoNativeEvent) => void, options?: boolean | { capture?: boolean; once?: boolean; signal?: AbortSignal;}) => voidYes—
removeEventListener(type: string, fn: (e: KuitoNativeEvent) => void, options?: boolean | { capture?: boolean;}) => voidYes—
dispatchEvent(event: { type: string; bubbles?: boolean; cancelable?: boolean;}) => booleanYesSends an event through the tree, capture to bubble, as a native one travels: a KuitoCustomEvent, or any object with a type. False when a listener called preventDefault() on a cancelable event.
seek(seconds: number) => Promise<void>YesSeconds from the start; exact, not the nearest key frame.
play() => Promise<void>Yes—
pause() => Promise<void>Yes—
enterFullscreen() => Promise<void>Yes—
exitFullscreen() => Promise<void>Yes—
startPictureInPicture() => Promise<void>YesiOS only: rejects with ERR_UNSUPPORTED on Android (docs/video.md).
stopPictureInPicture() => Promise<void>Yes—
focus — method signatures

Signatures

ts
(): void

Parameters

No parameters.

Returns

void

blur — method signatures

Signatures

ts
(): void

Parameters

No parameters.

Returns

void

setProperty — method signatures

Signatures

ts
<K extends keyof ElementProperties>(key: K, value: ElementProperties[K] | null): void

Type parameters

NameConstraintDefault
Kkeyof ElementProperties—

Parameters

NameTypeRequiredDescription
keyKYes—
valueElementProperties[K]Yes—

Returns

void

addEventListener — method signatures

Signatures

ts
(type: string, fn: (e: KuitoNativeEvent) => void, options?: boolean | { capture?: boolean; once?: boolean; signal?: AbortSignal; }): void

Parameters

NameTypeRequiredDescription
typestringYes—
fn(e: KuitoNativeEvent) => voidYes—
optionsboolean | { capture?: boolean; once?: boolean; signal?: AbortSignal;}No—

Returns

void

removeEventListener — method signatures

Signatures

ts
(type: string, fn: (e: KuitoNativeEvent) => void, options?: boolean | { capture?: boolean; }): void

Parameters

NameTypeRequiredDescription
typestringYes—
fn(e: KuitoNativeEvent) => voidYes—
optionsboolean | { capture?: boolean;}No—

Returns

void

dispatchEvent — method signatures

Signatures

ts
(event: { type: string; bubbles?: boolean; cancelable?: boolean; }): boolean

Parameters

NameTypeRequiredDescription
event{ type: string; bubbles?: boolean; cancelable?: boolean;}Yes—

Returns

boolean

seek — method signatures

Signatures

ts
(seconds: number): Promise<void>

Parameters

NameTypeRequiredDescription
secondsnumberYes—

Returns

Promise<void>

play — method signatures

Signatures

ts
(): Promise<void>

Parameters

No parameters.

Returns

Promise<void>

pause — method signatures

Signatures

ts
(): Promise<void>

Parameters

No parameters.

Returns

Promise<void>

enterFullscreen — method signatures

Signatures

ts
(): Promise<void>

Parameters

No parameters.

Returns

Promise<void>

exitFullscreen — method signatures

Signatures

ts
(): Promise<void>

Parameters

No parameters.

Returns

Promise<void>

startPictureInPicture — method signatures

Signatures

ts
(): Promise<void>

Parameters

No parameters.

Returns

Promise<void>

stopPictureInPicture — method signatures

Signatures

ts
(): Promise<void>

Parameters

No parameters.

Returns

Promise<void>

Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.