How do I enable logging for Bitmovin's Player SDK for Android?

I’m having an issue using Bitmovin’s Player SDK for Android. However I don’t see any logs, so I can’t understand what’s happening. Is there an option to enable logs?

3 Likes

Bitmovin Android Player SDK uses SLF4J facade API for logging. So the application has to provide a logger implementation of this API to direct the logs to specific output and control the log output levels. A couple of reference implementation are as below.

Quick steps to enable logs using android-logger are as follows:

  1. Add following dependency in your app build.
dependencies {
  compile 'com.github.tony19:logback-android:2.0.0'
}
  1. Create app/src/main/assets/logback.xml containing following in your app.
<configuration>
  <appender name="logcat" class="ch.qos.logback.classic.android.LogcatAppender">
    <tagEncoder>
      <pattern>%logger{12}</pattern>
    </tagEncoder>
    <encoder>
      <pattern>[%-20thread] %msg</pattern>
    </encoder>
  </appender>
  <root level="DEBUG">
    <appender-ref ref="logcat" />
  </root>
</configuration>

Proguard Configuration

When using Proguard, the following line must be added to the proguard file:

-dontwarn org.slf4j.**
4 Likes

I know that this has already been answered, but I would like to add a little to this:

While the SLF4J logging facade is currently the official logger in the Android Player SDK it is also very helpful to subscribe to warning and error events on the Source and the Player:

        // Attach warning and error listeners to player
        player.on<PlayerEvent.Error> { Log.e("PlayerError", "$it") }
        player.on<PlayerEvent.Warning> { Log.w("PlayerWarning", "$it") }

        // Attach warning and error listeners to source
        source.on<SourceEvent.Error> { Log.e("SourceError", "$it") }
        source.on<SourceEvent.Warning> { Log.w("SourceWarning", "$it") }

This can provide you with quick feedback when something is going wrong.

We have published a tutorial that showcases how to do logging with the Bitmovin Android Player SDK.