feat: add notification controls (#3723)
* feat(ios): add `showNotificationControls` prop * feat(android): add `showNotificationControls` prop * add docs * feat!: add `metadata` property to srouce This is breaking change for iOS/tvOS as we are moving some properties, but I believe that this will more readable and more user friendly * chore(ios): remove UI blocking function * code review changes for android * update example * fix readme * fix typos * update docs * fix typo * chore: improve sample metadata notification * update codegen types * rename properties * update tvOS example * reset metadata on source change * update docs --------- Co-authored-by: Olivier Bouillet <freeboub@gmail.com>
This commit is contained in:
@@ -166,10 +166,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
startPosition: resolvedSource.startPosition ?? -1,
|
||||
cropStart: resolvedSource.cropStart || 0,
|
||||
cropEnd: resolvedSource.cropEnd,
|
||||
title: resolvedSource.title,
|
||||
subtitle: resolvedSource.subtitle,
|
||||
description: resolvedSource.description,
|
||||
customImageUri: resolvedSource.customImageUri,
|
||||
metadata: resolvedSource.metadata,
|
||||
};
|
||||
}, [source]);
|
||||
|
||||
|
@@ -19,6 +19,13 @@ type Headers = ReadonlyArray<
|
||||
}>
|
||||
>;
|
||||
|
||||
type VideoMetadata = Readonly<{
|
||||
title?: string;
|
||||
subtitle?: string;
|
||||
description?: string;
|
||||
imageUri?: string;
|
||||
}>;
|
||||
|
||||
export type VideoSrc = Readonly<{
|
||||
uri?: string;
|
||||
isNetwork?: boolean;
|
||||
@@ -31,10 +38,7 @@ export type VideoSrc = Readonly<{
|
||||
startPosition?: Float;
|
||||
cropStart?: Float;
|
||||
cropEnd?: Float;
|
||||
title?: string;
|
||||
subtitle?: string;
|
||||
description?: string;
|
||||
customImageUri?: string;
|
||||
metadata?: VideoMetadata;
|
||||
}>;
|
||||
|
||||
type DRMType = WithDefault<string, 'widevine'>;
|
||||
@@ -300,7 +304,7 @@ export interface VideoNativeProps extends ViewProps {
|
||||
restoreUserInterfaceForPIPStopCompletionHandler?: boolean;
|
||||
localSourceEncryptionKeyScheme?: string;
|
||||
debug?: DebugConfig;
|
||||
|
||||
showNotificationControls?: WithDefault<boolean, false>; // Android, iOS
|
||||
bufferConfig?: BufferConfig; // Android
|
||||
contentStartTime?: Int32; // Android
|
||||
currentPlaybackTime?: Double; // Android
|
||||
|
@@ -22,10 +22,7 @@ export type ReactVideoSourceProperties = {
|
||||
startPosition?: number;
|
||||
cropStart?: number;
|
||||
cropEnd?: number;
|
||||
title?: string;
|
||||
subtitle?: string;
|
||||
description?: string;
|
||||
customImageUri?: string;
|
||||
metadata?: VideoMetadata;
|
||||
};
|
||||
|
||||
export type ReactVideoSource = Readonly<
|
||||
@@ -34,6 +31,14 @@ export type ReactVideoSource = Readonly<
|
||||
}
|
||||
>;
|
||||
|
||||
export type VideoMetadata = Readonly<{
|
||||
title?: string;
|
||||
subtitle?: string;
|
||||
description?: string;
|
||||
artist?: string;
|
||||
imageUri?: string;
|
||||
}>;
|
||||
|
||||
export type DebugConfig = Readonly<{
|
||||
enable?: boolean;
|
||||
thread?: boolean;
|
||||
@@ -221,6 +226,7 @@ export interface ReactVideoProps extends ReactVideoEvents, ViewProps {
|
||||
repeat?: boolean;
|
||||
reportBandwidth?: boolean; //Android
|
||||
resizeMode?: EnumValues<VideoResizeMode>;
|
||||
showNotificationControls?: boolean; // Android, iOS
|
||||
selectedAudioTrack?: SelectedTrack;
|
||||
selectedTextTrack?: SelectedTrack;
|
||||
selectedVideoTrack?: SelectedVideoTrack; // android
|
||||
|
Reference in New Issue
Block a user