feat: KSPlayer as an option for iOS + other improvements (#1266)

This commit is contained in:
Fredrik Burmester
2026-01-03 13:05:50 +01:00
committed by GitHub
parent d1795c9df8
commit 74d86b5d12
191 changed files with 88479 additions and 2316 deletions

View File

@@ -0,0 +1,34 @@
const { withAppBuildGradle } = require("expo/config-plugins");
module.exports = function withExcludeMedia3Dash(config) {
return withAppBuildGradle(config, (config) => {
const contents = config.modResults.contents;
// Add exclusion for duplicate media3 modules before dependencies block
const exclusionBlock = `
configurations.all {
// Exclude duplicate media3 modules to avoid conflict between react-native-video and react-native-track-player
exclude group: 'androidx.media3', module: 'media3-exoplayer-dash'
exclude group: 'androidx.media3', module: 'media3-exoplayer-smoothstreaming'
exclude group: 'androidx.media3', module: 'media3-exoplayer-rtsp'
}
`;
// Check if exclusion already exists
if (contents.includes("media3-exoplayer-dash")) {
return config;
}
// Insert before the dependencies block
const dependenciesIndex = contents.indexOf("dependencies {");
if (dependenciesIndex !== -1) {
config.modResults.contents =
contents.slice(0, dependenciesIndex) +
exclusionBlock +
"\n" +
contents.slice(dependenciesIndex);
}
return config;
});
};

38
plugins/withKSPlayer.js Normal file
View File

@@ -0,0 +1,38 @@
const { withDangerousMod } = require("@expo/config-plugins");
const fs = require("node:fs");
const path = require("node:path");
const withKSPlayer = (config) => {
return withDangerousMod(config, [
"ios",
async (config) => {
const podfilePath = path.join(
config.modRequest.platformProjectRoot,
"Podfile",
);
let podfileContent = fs.readFileSync(podfilePath, "utf8");
// KSPlayer and its dependencies
const ksPlayerPods = `
# KSPlayer dependencies (GPU acceleration + native PiP)
pod 'KSPlayer', :git => 'https://github.com/kingslay/KSPlayer.git', :tag => '2.3.4', :modular_headers => true
pod 'DisplayCriteria', :git => 'https://github.com/kingslay/KSPlayer.git', :tag => '2.3.4', :modular_headers => true
pod 'FFmpegKit', :git => 'https://github.com/kingslay/FFmpegKit.git', :tag => '6.1.3', :modular_headers => true
pod 'Libass', :git => 'https://github.com/kingslay/FFmpegKit.git', :tag => '6.1.3', :modular_headers => true
`;
// Only add if not already present
if (!podfileContent.includes("pod 'KSPlayer'")) {
podfileContent = podfileContent.replace(
/use_expo_modules!/,
`use_expo_modules!\n${ksPlayerPods}`,
);
fs.writeFileSync(podfilePath, podfileContent);
}
return config;
},
]);
};
module.exports = withKSPlayer;