Kmp External Codec Libvlcjni.so «360p – 720p»
implementation("org.videolan.android:libvlc-all:3.5.0") This includes libvlcjni.so (armeabi-v7a, arm64-v8a, x86, x86_64) automatically.
Actual implementation:
actual fun play() mediaPlayer.play() actual fun stop() mediaPlayer.stop() actual fun isPlaying(): Boolean = mediaPlayer.isPlaying kmp external codec libvlcjni.so
libvlcjni.so loads decoders like libavcodec.so internally – external codecs work immediately. 3.3 iOS / Darwin Target iOS uses MobileVLCKit (Objective-C framework) which also bundles FFmpeg. A Kotlin/Native interop can be created, or use cinterop to call VLCKit, achieving identical external codec support. 4. Verifying External Codec Activation To confirm that libvlcjni.so is using its own decoders and not Android’s MediaCodec:
val args = arrayOf("-vvv", "--codec=avcodec") // force ffmpeg decoders libVLC = LibVLC(context, args) Look for logcat output: implementation("org
On Android, the libvlcjni.so ‑backed player will output audio correctly, whereas ExoPlayer would fail with No decoder for: audio/ac3 . libvlcjni.so provides KMP developers with a powerful, unified way to handle external codecs that are absent from platform decoders. By wrapping VLC’s engine in a KMP expect/actual pattern, you can achieve cross-platform playback with near‑identical behavior and extensive format support.
Enable verbose logging:
This paper is structured as a technical brief suitable for developers integrating advanced playback capabilities into KMP applications (Android/iOS/Desktop). 1. Introduction Kotlin Multiplatform (KMP) allows sharing business logic across Android, iOS, and Desktop JVM targets. However, media playback with support for proprietary or less common codecs (e.g., E-AC-3, DTS, RV40, some MPEG-4 variants) remains a challenge because native platform players (ExoPlayer, AVFoundation, MediaPlayer) rely on system codecs.