Skip to main content
You will first need to have created a project with some articles generated.

First steps

Add the JitPack repository to your root build.gradle at the end of repositories

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Add the dependency to your app build.gradle

dependencies {
    implementation 'com.github.beyondwords-io:player-android:+'
}

Add playerView to your view hierarchy

There are two options:
  1. Add PlayerView to your layout xml file
<io.beyondwords.player.PlayerView
    android:id="@+id/player_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />
  1. Add PlayerView programmatically
val playerView = PlayerView(context)
playerViewParent.addView(playerView)

Load your content into the player

playerView.load(PlayerSettings(
    projectId = <ID>,
    contentId = <ID>
))
You will need to replace the <ID> placeholders with the real identifiers for your project and content. playerView.release() should be called after this PlayerView has been removed from the view system. No other methods may be called on this PlayerView after release. After running the app, the player should load.

How it works

The PlayerView uses a Web Player under the hood to load the Web Player and provides a Kotlin interface which binds to the underlying JavaScript API. You can check the API compatibility between the iOS and the Web player in the compatibility settings. To understand how the underlying Web Player works, please refer to its documentation.

How to configure it

The preferred way to configure the player is by logging into the BeyondWords dashboard, going to the Player tab, and changing its settings. However, you can also override properties at the app level, for example:
playerView.load(PlayerSettings(
    projectId = <ID>,
    contentId = <ID>,
    playerStyle = "large",
    callToAction = "Listen to this recipe",
    backgroundColor = "yellow",
))
These settings will take precedence over those specified in the dashboard and allow more flexibility. These settings can also be changed after loading the player, for example:
playerView.setPlayerStyle("large")
playerView.setBackgroundColor("yellow")
playerView.setPlaybackRate(1.5F)
You can also refer to example app which showcases the core functionality of the player, including how to build a custom UI. You can download a precompiled version of the example app from the assets of the latest GitHub Release.

Android SDK Github repository

Android SDK Documentation

View the Android SDK documentation in our GitHub repository