Skip to content
 
 

Latest commit

 

History

2,628 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RTC-ijkPlayer

A media player for Android, iOS and desktop, based on bilibili/ijkplayer and FFmpeg's ffplay.

This is RongCloud's fork of ijkPlayer. It is the player used by the RongCloud RTC SDK, and it is published here so that the source behind the binaries we ship on Maven Central is available and auditable.

Relationship to upstream

RTC-ijkPlayer is a derivative work of ijkPlayer, which is licensed under LGPL v2.1. The fork diverges from upstream in the following ways:

  • The Java/JNI package was renamed from tv.danmaku.ijk.media to cn.rongcloud.rtc.media. Upstream classes prefixed IjkMediaXxx are named RCMediaXxx here.
  • SEI (Supplemental Enhancement Information) extraction and timed SEI delivery to the application layer.
  • A desktop (PC) player target built with CMake, SDL2, PortAudio and GLFW.
  • Native libraries are named lib_RongRTC_*.so to avoid symbol and file collisions when an app also embeds upstream ijkPlayer.
  • Reworked packaging: two AAR artifacts instead of upstream's per-ABI modules.

Every file changed relative to upstream carries a "Modified by RongCloud" notice in its header.

Using the prebuilt artifacts

Both artifacts are published to Maven Central.

repositories {
    mavenCentral()
}

dependencies {
    implementation 'cn.rongcloud.sdk:nativeplayer:5.3.0.6'
    implementation 'cn.rongcloud.sdk:ffmpeg:5.3.0.6'
}

nativeplayer contains the player and SDL native libraries plus the Java API; ffmpeg contains the FFmpeg native library. Both are required.

ABIs armeabi-v7a, arm64-v8a, x86, x86_64
minSdk 19
compileSdk / targetSdk 30

Building from source

git clone https://github.com/rongcloud/ijkplayer.git
cd ijkplayer

The repository root holds build_android.sh and an ijkplayer/ subdirectory that contains the sources and the per-platform init scripts. Paths in this README are relative to the repository root unless a cd says otherwise — so after cloning, ijkplayer/init-android.sh is the init script, not the clone directory repeating itself.

Prerequisites

  • Android SDK, with ANDROID_SDK exported
  • Android NDK, with ANDROID_NDK exported
  • Xcode (iOS target only)
  • CMake 3.12+ (desktop target only)
  • A working git, yasm and a POSIX shell

Gradle 7.2 and Android Gradle Plugin 7.1.2 are used; the Gradle wrapper in ijkplayer/android/ijkplayer fetches the right Gradle version automatically.

Android

export ANDROID_SDK=/path/to/android-sdk
export ANDROID_NDK=/path/to/android-ndk
export PLAYERSDK_VERSION=0.8.8       # version stamped into the AARs

./build_android.sh

build_android.sh fetches the dependencies, cross-compiles OpenSSL, FFmpeg and the ijk native code for all four ABIs, then assembles the two AARs into ./output.

To also publish to Maven Central, set PUBLISH_TO_MAVEN=true. Publishing is skipped by default and requires credentials — see Publishing below.

The individual steps, if you need to run them by hand:

cd ijkplayer
./init-android.sh                    # fetch FFmpeg, libyuv, soundtouch
./init-android-openssl.sh            # fetch OpenSSL
cd android/contrib
./compile-openssl.sh all
./compile-ffmpeg.sh all
cd ../
./compile-ijk.sh all

iOS

cd ijkplayer
./init-ios.sh all                    # or a single arch: armv7, arm64, i386, x86_64
cd ios
./compile-ffmpeg.sh all
open IJKMediaPlayer/IJKMediaPlayer.xcodeproj

The framework target is IJKMediaFrameworkWithSSL.

Desktop

cd ijkplayer
./init-pc.sh x86_64                  # or: ./init-pc.sh all
cmake -B build -S .
cmake --build build

init-pc.sh detects the host OS itself. On Windows (MSYS) it additionally fetches vcpkg and pthreads-win32; elsewhere it fetches SDL2.

Using your own dependency forks

Each init-*.sh script defaults to a public upstream but accepts an override, so you can build against a patched fork without editing the scripts:

export IJK_FFMPEG_REPO_URL=git@example.com:you/ffmpeg.git
export IJK_FFMPEG_COMMIT=<tag-or-sha>

The same pattern applies to IJK_LIBYUV_*, IJK_SOUNDTOUCH_*, IJK_OPENSSL_* and IJK_PTHREAD_*.

Note that RongCloud's release builds use an internally patched FFmpeg. The public Bilibili/FFmpeg tag configured here is that fork's public ancestor, so a build from a clean checkout may not be bit-identical to the artifacts on Maven Central.

Publishing

No credentials are stored in this repository. Each one is read from an environment variable, or from a Gradle property in ~/.gradle/gradle.properties:

Environment variable Gradle property Purpose
SONATYPE_USERNAME sonatypeUsername Maven Central upload
SONATYPE_PASSWORD sonatypePassword Maven Central upload
SIGNING_KEY_ID signing.keyId GPG signing
SIGNING_PASSWORD signing.password GPG signing
SIGNING_KEY_FILE signing.secretKeyRingFile GPG signing
MAVEN_RONG_URL MAVEN_RONG_REPOSITORY_URL Optional private repository
MAVEN_RONG_USERNAME MAVEN_RONG_REPOSITORY_USERNAME Optional private repository
MAVEN_RONG_PASSWORD MAVEN_RONG_REPOSITORY_PASSWORD Optional private repository

The private repository is optional: if neither MAVEN_RONG_URL nor MAVEN_RONG_REPOSITORY_URL is set, it is simply not declared and only the Maven Central path runs.

Publishing signs the artifacts, stages them under build/staging, and uploads the bundle via the uploadToCentralPortal task. The upload is USER_MANAGED, so the release must still be confirmed manually in the Central Portal.

Repository layout

build_android.sh              Android build entry point
LICENSE                       LGPL v2.1, the project license
NOTICE                        Attribution and third-party inventory
licenses/                     Licenses of third-party code in this tree
ijkplayer/
  init-*.sh                   Dependency fetch scripts
  config/                     FFmpeg feature-set presets
  ijkmedia/
    ijkplayer/                Player core, adapted from ffplay
    ijksdl/                   Rendering and audio output abstraction
    ijkj4a/                   Generated JNI bindings
  android/
    contrib/                  FFmpeg and OpenSSL cross-compilation
    ijkplayer/                Gradle project and Java API
  ios/                        iOS framework and demo apps
  pc/                         Desktop player

Contributing

Bug reports and pull requests are welcome. See CONTRIBUTING.md for what belongs in this repository versus upstream ijkPlayer, how to regenerate the JNI bindings, and the conventions we follow. Release history is in CHANGELOG.md.

License

RTC-ijkPlayer is licensed under the GNU Lesser General Public License, version 2.1. See LICENSE.

Individual files may carry a different, compatible license as indicated by their own header — Apache 2.0 for most Java sources and AOSP-derived code, and BSD-3-Clause for the WebRTC-derived H.264 helpers. NOTICE explains the structure and lists every third-party component, both the code included here and the dependencies fetched at build time.

FFmpeg is configured without --enable-gpl and without --enable-nonfree, so the FFmpeg binaries produced by these scripts are LGPL v2.1. Enabling those options changes the license of your build output.

Acknowledgements

This project would not exist without:

About

Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages