ijkplayer

repository·master·Indexed 12 days ago

https://github.com/bilibili/ijkplayer

A high-performance video player based on FFmpeg for Android and iOS platforms. It provides a MediaPlayer-like API for mobile application integration and supports various build profiles (Lite, Default, HEVC) and ABI configurations for version 0.8.8.

Tokens
1.4K
Snippets
3
Records
5
Agent score
49%

What's inside ijkplayer

  1. Configure FFmpeg build profiles (Lite vs Default)

    master

    You can customize the FFmpeg build to trade off codec support for binary size by switching configuration modules in the config directory before running the compilation scripts.

    Option 1: Default (More codecs/formats)

    cd config
    rm module.sh
    ln -s module-default.sh module.sh
    cd android/contrib
    sh compile-ffmpeg.sh clean

    Option 2: Lite with HEVC support (Smaller size, includes HEVC)

    cd config
    rm module.sh
    ln -s module-lite-hevc.sh module.sh
    cd android/contrib
    sh compile-ffmpeg.sh clean

    Option 3: Lite (Smallest size, default)

    cd config
    rm module.sh
    ln -s module-lite.sh module.sh
    cd android/contrib
    sh compile-ffmpeg.sh clean
  2. Build ijkplayer for Android

    master

    Follow these steps to build ijkplayer from source for Android. Ensure you have set your ANDROID_SDK and ANDROID_NDK environment variables in your ~/.bash_profile or ~/.profile before starting.

    1. Clone the repository and checkout the target version:
      git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-android
      cd ijkplayer-android
      git checkout -B latest k0.8.8
    2. Initialize the environment:
      ./init-android.sh
    3. Compile FFmpeg and ijkplayer:
      cd android/contrib
      ./compile-ffmpeg.sh clean
      ./compile-ffmpeg.sh all
      cd ..
      ./compile-ijk.sh all
    4. Import into Android Studio:
      • Open android/ijkplayer/ as an existing project.
      • Define the ext block in your root build.gradle with your specific compileSdkVersion, buildToolsVersion, and targetSdkVersion (e.g., 23).
    git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-android
    cd ijkplayer-android
    git checkout -B latest k0.8.8
    
    ./init-android.sh
    
    cd android/contrib
    ./compile-ffmpeg.sh clean
    ./compile-ffmpeg.sh all
    
    cd ..
    ./compile-ijk.sh all
  3. Build ijkplayer for iOS

    master

    Follow these steps to build ijkplayer from source for iOS.

    1. Clone the repository and checkout the target version:
      git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-ios
      cd ijkplayer-ios
      git checkout -B latest k0.8.8
    2. Initialize the environment:
      ./init-ios.sh
    3. Compile FFmpeg and ijkplayer:
      cd ios
      ./compile-ffmpeg.sh clean
      ./compile-ffmpeg.sh all
    4. Import into your Xcode project:
      • Add ios/IJKMediaPlayer/IJKMediaPlayer.xcodeproj to your project.
      • Add your application's target to the project.
      • In Build Phases -> Target Dependencies, add IJKMediaFramework.
      • In Build Phases -> Link Binary with Libraries, add the following frameworks:
        • IJKMediaFramework.framework
        • AudioToolbox.framework
        • AVFoundation.framework
        • CoreGraphics.framework
        • CoreMedia.framework
        • CoreVideo.framework
        • libbz2.tbd
        • libz.tbd
        • MediaPlayer.framework
        • MobileCoreServices.framework
        • OpenGLES.framework
        • QuartzCore.framework
        • UIKit.framework
        • VideoToolbox.framework
    git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-ios
    cd ijkplayer-ios
    git checkout -B latest k0.8.8
    
    ./init-ios.sh
    
    cd ios
    ./compile-ffmpeg.sh clean
    ./compile-ffmpeg.sh all
  4. Enable native debugging with LLDB on Android

    master

    To debug ijkplayer's native modules in Android Studio 2.2+, follow these steps:

    1. Run the patch script for your target architecture:
      sh android/patch-debugging-with-lldb.sh armv7a
    2. In Android Studio, ensure LLDB, NDK, Android SDK Build-tools, and Cmake are installed via the SDK Manager.
    3. Open the android/ijkplayer project.
    4. Sync the project with Gradle files.
    5. Go to Run -> Edit Configurations -> Debugger -> Symbol Directories.
    6. Add the following path to Symbol Directories: ijkplayer-armv7a/.externalNativeBuild/ndkBuild/release/obj/local/armeabi-v7a
    7. Run Debug on ijkplayer-example.

    To reverse the patches, run:

    sh patch-debugging-with-lldb.sh reverse armv7a
  5. Add ijkplayer to Android projects via Gradle

    master

    To use ijkplayer in an Android application, add the following dependencies to your build.gradle file. You must include the Java wrapper and the specific ABI (Application Binary Interface) required for your target devices.

    Required dependencies (covers most devices):

    • tv.danmaku.ijk.media:ijkplayer-java:0.8.8
    • tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8

    Optional ABIs:

    • tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8
    • tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8
    • tv.danmaku.ijk.media:ijkplayer-x86:0.8.8
    • tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8

    Experimental ExoPlayer backend:

    • tv.danmaku.ijk.media:ijkplayer-exo:0.8.8
    allprojects {
        repositories {
            jcenter()
        }
    }
    
    dependencies {
        # required, enough for most devices.
        compile 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
        compile 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8'
    
        # Other ABIs: optional
        compile 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8'
        compile 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8'
        compile 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8'
        compile 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8'
    
        # ExoPlayer as IMediaPlayer: optional, experimental
        compile 'tv.danmaku.ijk.media:ijkplayer-exo:0.8.8'
    }