feat(android): make buffering strategy dynamic (#3756)
* chore: rework bufferConfig to make it more generic and reduce ReactExoplayerView code size * feat: expose bufferingStrategy to app and change default behavior rename disableBuffering undocumented prop to bufferingStrategy and document it. before this change, default was 'dependingOnMemory'. It can trigger some unnecessary gc() call on android.
This commit is contained in:
@@ -93,6 +93,8 @@ export type Seek = Readonly<{
|
||||
tolerance?: Float;
|
||||
}>;
|
||||
|
||||
type BufferingStrategyType = WithDefault<string, 'Default'>;
|
||||
|
||||
type BufferConfig = Readonly<{
|
||||
minBufferMs?: Float;
|
||||
maxBufferMs?: Float;
|
||||
@@ -317,6 +319,7 @@ export interface VideoNativeProps extends ViewProps {
|
||||
subtitleStyle?: SubtitleStyle; // android
|
||||
useTextureView?: boolean; // Android
|
||||
useSecureView?: boolean; // Android
|
||||
bufferingStrategy?: BufferingStrategyType; // Android
|
||||
onVideoLoad?: DirectEventHandler<OnLoadData>;
|
||||
onVideoLoadStart?: DirectEventHandler<OnLoadStartData>;
|
||||
onVideoAspectRatio?: DirectEventHandler<OnVideoAspectRatioData>;
|
||||
|
@@ -68,6 +68,12 @@ export type Drm = Readonly<{
|
||||
/* eslint-enable @typescript-eslint/no-unused-vars */
|
||||
}>;
|
||||
|
||||
export enum BufferingStrategyType {
|
||||
DEFAULT = 'Default',
|
||||
DISABLE_BUFFERING = 'DisableBuffering',
|
||||
DEPENDING_ON_MEMORY = 'DependingOnMemory',
|
||||
}
|
||||
|
||||
export type BufferConfig = {
|
||||
minBufferMs?: number;
|
||||
maxBufferMs?: number;
|
||||
@@ -195,6 +201,7 @@ export interface ReactVideoProps extends ReactVideoEvents, ViewProps {
|
||||
audioOutput?: AudioOutput; // Mobile
|
||||
automaticallyWaitsToMinimizeStalling?: boolean; // iOS
|
||||
bufferConfig?: BufferConfig; // Android
|
||||
bufferingStrategy?: BufferingStrategyType;
|
||||
chapters?: Chapters[]; // iOS
|
||||
contentStartTime?: number; // Android
|
||||
controls?: boolean;
|
||||
|
Reference in New Issue
Block a user