chore(sample): additionnal sample cleanup (#4122)

* chore: move MultiValueControl & toggleControl to component
* fix(sample): fix import / export to avoid circular deps
* chore(sample): fix warning
This commit is contained in:
Olivier Bouillet 2024-08-31 18:32:32 +02:00 committed by GitHub
parent 451806c547
commit fb3c0da6af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 26 additions and 22 deletions

View File

@ -21,7 +21,7 @@ interface MultiValueControlType<T> {
onPress: (arg: T) => void; onPress: (arg: T) => void;
} }
const MultiValueControl = <T extends number | string | ResizeMode>({ export const MultiValueControl = <T extends number | string | ResizeMode>({
values, values,
selected, selected,
onPress, onPress,

View File

@ -7,9 +7,7 @@ import React, {
} from 'react'; } from 'react';
import {View} from 'react-native'; import {View} from 'react-native';
import styles from '../styles.tsx'; import styles from '../styles.tsx';
import ToggleControl from '../ToggleControl.tsx';
import {isAndroid, isIos, textTracksSelectionBy} from '../constants'; import {isAndroid, isIos, textTracksSelectionBy} from '../constants';
import MultiValueControl from '../MultiValueControl.tsx';
import { import {
ResizeMode, ResizeMode,
VideoRef, VideoRef,
@ -23,14 +21,15 @@ import {
type VideoTrack, type VideoTrack,
type AudioTrack, type AudioTrack,
} from 'react-native-video'; } from 'react-native-video';
import {
toast, import {toast} from './Toast';
Seeker, import {Seeker} from './Seeker';
AudioTrackSelector, import {AudioTrackSelector} from './AudioTracksSelector';
TextTrackSelector, import {VideoTrackSelector} from './VideoTracksSelector';
VideoTrackSelector, import {TextTrackSelector} from './TextTracksSelector';
TopControl, import {TopControl} from './TopControl';
} from '../components'; import {ToggleControl} from './ToggleControl';
import {MultiValueControl} from './MultiValueControl';
type Props = { type Props = {
channelDown: () => void; channelDown: () => void;

View File

@ -25,7 +25,7 @@ interface ToggleControlType {
onPress: () => void; onPress: () => void;
} }
const ToggleControl = ({ export const ToggleControl = ({
isSelected, isSelected,
selectedText, selectedText,
unselectedText, unselectedText,

View File

@ -7,3 +7,5 @@ export * from './TextTracksSelector';
export * from './Overlay'; export * from './Overlay';
export * from './TopControl'; export * from './TopControl';
export * from './Toast'; export * from './Toast';
export * from './ToggleControl';
export * from './MultiValueControl';

View File

@ -94,9 +94,9 @@ export const srcAllPlatformList = [
}, },
]; ];
export const srcIosList = []; export const srcIosList: SampleVideoSource[] = [];
export const srcAndroidList = [ export const srcAndroidList: SampleVideoSource[] = [
{ {
description: 'Another live sample', description: 'Another live sample',
uri: 'https://live.forstreet.cl/live/livestream.m3u8', uri: 'https://live.forstreet.cl/live/livestream.m3u8',
@ -149,9 +149,12 @@ export const srcAndroidList = [
}, },
]; ];
export const srcList: SampleVideoSource[] = srcAllPlatformList.concat( const platformSrc: SampleVideoSource[] = isAndroid
isAndroid ? srcAndroidList : srcIosList, ? srcAndroidList
); : srcIosList;
export const srcList: SampleVideoSource[] =
platformSrc.concat(srcAllPlatformList);
export const bufferConfig: BufferConfig = { export const bufferConfig: BufferConfig = {
minBufferMs: 15000, minBufferMs: 15000,

View File

@ -1,11 +1,11 @@
import {Drm, ReactVideoSource, TextTracks} from 'react-native-video'; import {Drm, ReactVideoSource, TextTracks} from 'react-native-video';
export type AdditionalSourceInfo = { export type AdditionalSourceInfo = {
textTracks: TextTracks; textTracks?: TextTracks;
adTagUrl: string; adTagUrl?: string;
description: string; description?: string;
drm: Drm; drm?: Drm;
noView: boolean; noView?: boolean;
}; };
export type SampleVideoSource = ReactVideoSource | AdditionalSourceInfo; export type SampleVideoSource = ReactVideoSource | AdditionalSourceInfo;