ijkplayer_flutter_sdk

A Video Player Flutter plugin based on ijkplayer, support most popular protocols and codecs.

Features

  • Support most popular video formats and protocols
  • Based on ijkplayer
  • Cross-platform support (Android & iOS)

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  ijkplayer_flutter_sdk: ^1.0.1

Then run:

flutter pub get

Android 配置(重要)

由于本插件包含 native AAR 依赖(fijkplayer-full-release.aar),某些 Flutter 项目可能需要额外配置才能正确构建。

方案 A:自动配置(推荐,适用于大多数项目)

本插件的 AAR 文件已包含在包中,通常无需额外配置。如果构建成功,可以跳过以下步骤。

方案 B:手动配置(如果遇到构建错误)

如果在构建时遇到以下错误:

Could not find :fijkplayer-full-release:.

需要在 Android 项目中添加 flatDir 仓库配置。

步骤 1:定位 pub cache 中的 AAR 文件

AAR 文件位于:

~/.pub-cache/hosted/pub.dev/ijkplayer_flutter_sdk-1.0.1/android/libs/fijkplayer-full-release.aar

步骤 2:选择以下任一方案

方案 B1:修改 build.gradle(推荐)

android/app/build.gradleandroid/build.gradle 中添加:

allprojects {
    repositories {
        google()
        mavenCentral()
        // 添加以下配置
        flatDir {
            dirs "${project.rootDir}/../.pub-cache/hosted/pub.dev/ijkplayer_flutter_sdk-1.0.1/android/libs"
        }
    }
}

⚠️ 注意:路径中的版本号需要与你使用的插件版本匹配

方案 B2:复制 AAR 到项目(适合团队协作)

如果你的项目已经有 libs 目录配置,可以将 AAR 复制到项目中:

# 复制到项目的 libs 目录
cp ~/.pub-cache/hosted/pub.dev/ijkplayer_flutter_sdk-1.0.1/android/libs/fijkplayer-full-release.aar \
   your_project/android/app/libs/

然后在 android/app/build.gradle 中确保有 flatDir 配置:

repositories {
    flatDir {
        dirs 'libs'
    }
}

验证配置

运行构建命令验证配置是否成功:

cd android
./gradlew app:assembleDebug

如果构建成功,配置完成!

Usage

import 'package:ijkplayer_flutter_sdk/ijkplayer_flutter_sdk.dart';

// TODO: Add usage examples

Platform Support

Platform Support
Android
iOS

License

MIT License - see the LICENSE file for details.

Libraries

fijkplayer