mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-08-16 02:56:22 +00:00
feat: add notification controls (#4721)
This commit is contained in:
@@ -146,6 +146,7 @@ const VideoDemo = () => {
|
||||
player.playWhenInactive = settings.playWhenInactive;
|
||||
player.mixAudioMode = settings.mixAudioMode;
|
||||
player.ignoreSilentSwitchMode = settings.ignoreSilentSwitchMode;
|
||||
player.showNotificationControls = settings.showNotificationControls;
|
||||
}, [settings, player]);
|
||||
|
||||
const handleSeek = (val: number) => {
|
||||
@@ -315,6 +316,13 @@ const VideoDemo = () => {
|
||||
value={settings.playWhenInactive}
|
||||
onValueChange={(value) => updateSetting('playWhenInactive', value)}
|
||||
/>
|
||||
<SwitchControl
|
||||
label="Notification Controls"
|
||||
value={settings.showNotificationControls}
|
||||
onValueChange={(value) =>
|
||||
updateSetting('showNotificationControls', value)
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ export interface VideoSettings {
|
||||
ignoreSilentSwitchMode: IgnoreSilentSwitchMode;
|
||||
playInBackground: boolean;
|
||||
playWhenInactive: boolean;
|
||||
showNotificationControls: boolean;
|
||||
}
|
||||
|
||||
export const defaultSettings: VideoSettings = {
|
||||
@@ -32,4 +33,5 @@ export const defaultSettings: VideoSettings = {
|
||||
ignoreSilentSwitchMode: 'auto',
|
||||
playInBackground: true,
|
||||
playWhenInactive: false,
|
||||
showNotificationControls: true,
|
||||
};
|
||||
|
||||
@@ -103,5 +103,14 @@ export const getVideoSource = (type: VideoType): VideoConfig => {
|
||||
type: 'vtt',
|
||||
},
|
||||
],
|
||||
metadata: {
|
||||
title: 'Big Buck Bunny',
|
||||
artist: 'Blender Foundation',
|
||||
imageUri:
|
||||
'https://peach.blender.org/wp-content/uploads/title_anouncement.jpg',
|
||||
subtitle: 'By the Blender Institute',
|
||||
description:
|
||||
'Big Buck Bunny is a short computer-animated comedy film by the Blender Institute, part of the Blender Foundation. It was made using Blender, a free and open-source 3D creation suite.',
|
||||
},
|
||||
} as VideoConfig;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user