Use expo plugin for react-native-video

This commit is contained in:
Zoe Roux 2024-08-12 09:20:39 +02:00
parent 5108649bf0
commit e6f4f51aea
No known key found for this signature in database

View File

@ -56,10 +56,6 @@ const config: ExpoConfig = {
backgroundColor: "#eff1f5", backgroundColor: "#eff1f5",
}, },
splash, splash,
permissions: [
"android.permission.FOREGROUND_SERVICE",
"android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK",
],
}, },
updates: { updates: {
url: "https://u.expo.dev/55de6b52-c649-4a15-9a45-569ff5ed036c", url: "https://u.expo.dev/55de6b52-c649-4a15-9a45-569ff5ed036c",
@ -73,27 +69,16 @@ const config: ExpoConfig = {
projectId: "55de6b52-c649-4a15-9a45-569ff5ed036c", projectId: "55de6b52-c649-4a15-9a45-569ff5ed036c",
}, },
}, },
plugins: ["expo-build-properties", "expo-localization"], plugins: [
}; "expo-build-properties",
"expo-localization",
const withForegroundService = (c: ExpoConfig): ExpoConfig => { [
return withAndroidManifest(c, async (config) => { "react-native-video",
const manifest = config.modResults.manifest; {
manifest.application![0].service ??= []; enableNotificationControls: true,
manifest.application![0].service.push({
$: {
"android:name": "com.brentvatne.exoplayer.VideoPlaybackService",
"android:exported": "false",
"android:foregroundServiceType": "mediaPlayback",
}, },
"intent-filter": [ ],
{ ],
action: [{ $: { "android:name": "androidx.media3.session.MediaSessionService" } }],
},
],
});
return config;
});
}; };
export default withForegroundService(config); export default config;