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 VideoRef = ElementRef<VideoHandle> & {
  readonly playing: ReadonlySignal<boolean>;
  readonly loaded: ReadonlySignal<boolean>;
  readonly buffering: ReadonlySignal<boolean>;
  readonly fullscreen: ReadonlySignal<boolean>;
  readonly pictureInPicture: ReadonlySignal<boolean>;
  readonly error: ReadonlySignal<string | null>;
  /** Seconds from the start. */
  readonly time: Motion<number>;
  /** Seconds; 0 until loaded, and for a live stream. */
  readonly duration: Motion<number>;
  /** Calls `listener` each time playback reaches the end. */
  watch(event: 'ended', listener: () => void): EventSubscription;
};

Members 10

NameTypeRequiredDescription
currentVideoHandleYes—
playingreadonlyReadonlySignal<boolean>Yes—
loadedreadonlyReadonlySignal<boolean>Yes—
bufferingreadonlyReadonlySignal<boolean>Yes—
fullscreenreadonlyReadonlySignal<boolean>Yes—
pictureInPicturereadonlyReadonlySignal<boolean>Yes—
errorreadonlyReadonlySignal<string>Yes—
timereadonlyMotion<number>YesSeconds from the start.
durationreadonlyMotion<number>YesSeconds; 0 until loaded, and for a live stream.
watch(event: "ended", listener: () => void) => EventSubscriptionYesCalls listener each time playback reaches the end.
watch — method signatures

Signatures

ts
(event: "ended", listener: () => void): EventSubscription

Parameters

NameTypeRequiredDescription
event"ended"Yes—
listener() => voidYes—

Returns

EventSubscription

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