mirror of
https://github.com/zoriya/react-native-video.git
synced 2025-12-06 07:16:12 +00:00
Fix typescript issues
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Platform } from 'react-native';
|
||||
import { NitroModules } from 'react-native-nitro-modules';
|
||||
import { type VideoPlayer as VideoPlayerImpl } from '../spec/nitro/VideoPlayer.nitro';
|
||||
import type { VideoPlayer as VideoPlayerImpl } from '../spec/nitro/VideoPlayer.nitro';
|
||||
import type { VideoPlayerSource } from '../spec/nitro/VideoPlayerSource.nitro';
|
||||
import type { IgnoreSilentSwitchMode } from './types/IgnoreSilentSwitchMode';
|
||||
import type { MixAudioMode } from './types/MixAudioMode';
|
||||
|
||||
@@ -63,10 +63,11 @@ class VideoPlayer extends VideoPlayerEvents implements VideoPlayerBase {
|
||||
|
||||
// Source
|
||||
get source(): VideoPlayerSource {
|
||||
// TODO: properly implement this
|
||||
return {
|
||||
uri: this.player.getAssetUri()!,
|
||||
config: {},
|
||||
};
|
||||
} as any;
|
||||
}
|
||||
|
||||
// Status
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import {
|
||||
ALL_PLAYER_EVENTS,
|
||||
type VideoPlayerEvents as NativePlayerEvents,
|
||||
type AllPlayerEvents as PlayerEvents,
|
||||
} from './types/Events';
|
||||
} from "./types/Events";
|
||||
|
||||
export class VideoPlayerEvents {
|
||||
protected eventEmitter: PlayerEvents;
|
||||
protected eventEmitter: NativePlayerEvents;
|
||||
protected eventListeners: Partial<
|
||||
Record<keyof PlayerEvents, Set<(...params: any[]) => void>>
|
||||
> = {};
|
||||
@@ -12,7 +13,7 @@ export class VideoPlayerEvents {
|
||||
protected readonly supportedEvents: (keyof PlayerEvents)[] =
|
||||
ALL_PLAYER_EVENTS;
|
||||
|
||||
constructor(eventEmitter: PlayerEvents) {
|
||||
constructor(eventEmitter: NativePlayerEvents) {
|
||||
this.eventEmitter = eventEmitter;
|
||||
for (const event of this.supportedEvents) {
|
||||
// @ts-expect-error we narrow the type of the event
|
||||
|
||||
@@ -2,7 +2,6 @@ import * as React from 'react';
|
||||
import type { ViewStyle } from 'react-native';
|
||||
import { NitroModules } from 'react-native-nitro-modules';
|
||||
import type {
|
||||
SurfaceType,
|
||||
VideoViewViewManager,
|
||||
VideoViewViewManagerFactory,
|
||||
} from '../../spec/nitro/VideoViewViewManager.nitro';
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
useRef,
|
||||
} from "react";
|
||||
import { View, type ViewStyle } from "react-native";
|
||||
import { VideoError } from "../types/VideoError";
|
||||
import type { VideoPlayer } from "../VideoPlayer.web";
|
||||
import type { VideoViewProps, VideoViewRef } from "./ViewViewProps";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { ViewProps, ViewStyle } from "react-native";
|
||||
import type { SurfaceType } from "../../spec/nitro/VideoViewViewManager.nitro";
|
||||
import type { VideoViewEvents } from "../types/Events";
|
||||
import type { ResizeMode } from "../types/ResizeMode";
|
||||
import type { VideoPlayer } from "../VideoPlayer";
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
export { useEvent } from './core/hooks/useEvent';
|
||||
export { useVideoPlayer } from './core/hooks/useVideoPlayer';
|
||||
export type * from './core/types/Events';
|
||||
export type { IgnoreSilentSwitchMode } from './core/types/IgnoreSilentSwitchMode';
|
||||
export type { MixAudioMode } from './core/types/MixAudioMode';
|
||||
export type { ResizeMode } from './core/types/ResizeMode';
|
||||
export type { TextTrack } from './core/types/TextTrack';
|
||||
export type { VideoConfig, VideoSource } from './core/types/VideoConfig';
|
||||
export { useEvent } from "./core/hooks/useEvent";
|
||||
export { useVideoPlayer } from "./core/hooks/useVideoPlayer";
|
||||
export type * from "./core/types/Events";
|
||||
export type { IgnoreSilentSwitchMode } from "./core/types/IgnoreSilentSwitchMode";
|
||||
export type { MixAudioMode } from "./core/types/MixAudioMode";
|
||||
export type { ResizeMode } from "./core/types/ResizeMode";
|
||||
export type { TextTrack } from "./core/types/TextTrack";
|
||||
export type { VideoConfig, VideoSource } from "./core/types/VideoConfig";
|
||||
export type {
|
||||
LibraryError,
|
||||
PlayerError,
|
||||
@@ -16,12 +16,12 @@ export type {
|
||||
VideoErrorCode,
|
||||
VideoRuntimeError,
|
||||
VideoViewError,
|
||||
} from './core/types/VideoError';
|
||||
export type { VideoPlayerStatus } from './core/types/VideoPlayerStatus';
|
||||
} from "./core/types/VideoError";
|
||||
export type { VideoPlayerStatus } from "./core/types/VideoPlayerStatus";
|
||||
|
||||
export { VideoPlayer } from './core/VideoPlayer';
|
||||
export {
|
||||
default as VideoView,
|
||||
type VideoViewProps,
|
||||
type VideoViewRef,
|
||||
} from './core/video-view/VideoView';
|
||||
export { VideoPlayer } from "./core/VideoPlayer";
|
||||
export { default as VideoView } from "./core/video-view/VideoView";
|
||||
export type {
|
||||
VideoViewProps,
|
||||
VideoViewRef,
|
||||
} from "./core/video-view/ViewViewProps";
|
||||
|
||||
Reference in New Issue
Block a user