Skip to content

ndungudedan/media-kit

 
 

Repository files navigation

Video Player and Media Kit Problems

Media Kit Override 16KB Page Size Support

This section outlines how to override media-kit dependencies to fix 16KB page size support for Android.

Solution

Override the media-kit dependencies with a custom fork that updates the NDK version to 28.2.13676358 and compileSdkVersion to 36 as well as gradle version to 8.6.0.

How to use

1. pubspec.yaml Configuration

Add these dependencies to your pubspec.yaml:

dependencies:
  # Standard video dependencies
  video_player: ^2.9.2
  video_player_media_kit: ^1.0.6
  media_kit_libs_android_video: any

dependency_overrides:
  # Replace video_player_media_kit and its core dependencies with GitHub version
  video_player_media_kit:
    git:
      url: https://github.com/ndungudedan/media-kit.git
      path: video_player_media_kit
      ref: main
  
  # Core dependency
  media_kit:
    git:
      url: https://github.com/ndungudedan/media-kit.git
      path: media_kit
      ref: main
  
  # Core Video dependency
  media_kit_video:
    git:
      url: https://github.com/ndungudedan/media-kit.git
      path: media_kit_video
      ref: main

  media_kit_libs_android_video:
    git:
      url: https://github.com/ndungudedan/media-kit.git
      path: libs/android/media_kit_libs_android_video
      ref: main
  # Add other relevant overrides here

Black Screen when playing Videos

  • This happens when using the packages media_kit on recent Android versions. Confirmed on Android 14 and 15.
  • Removing the media_kit dependency fixes the issue, but breaks the video player on older Android versions. Confirmed on Android 10.

Solution

  • Conditional integration of media kit based on the Android version. Sample code below, main.dart:
void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  if (Platform.isAndroid) {
    final sdkInt = (await DeviceInfoPlugin().androidInfo).version.sdkInt;
    // Use media kit on Android 10 and older
    if (sdkInt <= 29) {
      await VideoPlayerMediaKit.ensureInitialized(
        android: true,
      );
    }
  }
}

About

A cross-platform video player & audio player for Flutter & Dart.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Dart 73.2%
  • C++ 11.5%
  • CMake 4.7%
  • Swift 4.4%
  • Java 1.9%
  • C 1.3%
  • Other 3.0%