## **Step 1:** Add & configure your Bitmovin Player

First, add a link to our Maven repository in your application's `build.gradle` or `settings.gradle` file. Make sure not to remove the Google Maven repository.



Next, add the Bitmovin Player as a dependency to your project as shown below:



We recommend you use the latest version of our Bitmovin Player. You can find all versions [here](🔗).

Now, add the Bitmovin Player License Key to your `AndroidManifest.xml`:



And finally, register the package name of your application in your [Bitmovin Dashboard](🔗) under **"Player" -> "Licenses"**. This security mechanism protects your license from being used elsewhere.



## **Step 2:** Remove the ExoPlayer dependencies

In your Gradle file, remove all ExoPlayer dependencies:



Note

By default, an application cannot use both the Bitmovin Player and ExoPlayer as they define identical symbols. Thus, it is recommended that you migrate all ExoPlayer instances of your app to the Bitmovin Player. Alternatively, you can use the Bitmovin `+jason` variant to use both Players in the same project as described [here](🔗).

## **Step 3:** Replace ExoPlayer references in your project

### User Interface

To migrate the UI, simply replace occurrences of `StylePlayerView` with `PlayerView`. An example:



Learn how to customize your cross-platform Bitmovin UI [here](🔗).

### Replace ExoPlayer API

The APIs of ExoPlayer and Bitmovin Player are similar in functionality. As a result, the migration is mostly about changing method names and signatures.

Here is an example of creating a new Bitmovin Player:



Next, replace occurrences of `MediaItem` by `SourceConfig` and load your sources. Here is an example of loading a Dash stream:



Note

Android Studio will also support you by flagging errors for any other ExoPlayer code. To support you with the further migration, we've created [mapping tables](🔗) between the ExoPlayer and Bitmovin Player API, which you can refer to - especially for more advanced use cases.

And that's it!

You're ready to play a video in your application using the Bitmovin Player 😀

## **Summary**

In this guide, we demonstrated how easy it is to migrate from ExoPlayer to the Bitmovin Player in just **three simple steps**: adding the Bitmovin Player, removing the ExoPlayer dependencies and mapping the ExoPlayer API to the Bitmovin Player API.

Next, you can

  • check out our [Getting Started Guide](🔗).

  • download fully working [examples](🔗) and explore more features in our GitHub repository.

  • choose additional platforms to deploy on in our [Getting Started Hub](🔗) and try our no-code wizards.

  • browse our [Bitmovin Player API reference](🔗).

  • try our [Analytics](🔗) product to get real-time insights into your new Android Player.

  • see if some of the questions you might have are answered in our [Community](🔗) and ask your own!

## **Appendix:** Mapping Tables

For more advanced use cases, we've created the following mapping tables to support your migration. In comparison, the Bitmovin Player API is written in Kotlin and allows more expressive and terse syntax by using default values whereas ExoPlayer makes heavy use of the builder pattern.

Note

Methods and classes are only listed if their names are different.

### Package mapping

ExoPlayerBitmovin Player
`com.google.android.exoplayer2``com.bitmovin.player.api`
`com.google.android.exoplayer2.ui``com.bitmovin.player`

### Class mapping

ExoPlayerBitmovin Player
`ExoPlayer``Player`
`ExoPlayer.Builder``PlayerConfig`
`MediaItem``SourceConfig`
`DrmConfiguration``DrmConfig`
`StylePlayerView``PlayerView`

### `ExoPlayer` ➡️ `Player` method mapping

ExoPlayerBitmovin Player
`Builder.build()``create`
`setMediaItem``load`
`prepare`Not needed, done in `load`
`seekTo*`See the [Seeking](🔗) section
`release``destroy`
`setMediaItems``load`
`addMediaItem``PlaylistConfig` or `playlist.add`
`moveMediaItem``playlist.remove` then `add`
`setPlayWhenReady(true)``play`
`setPlayWhenReady(false)``pause`
`setDeviceMuted(true)``mute`
`setDeviceMuted(false)``unmute`
`*Volume``volume`
`getCurrentPosition``currentTime`
`getCurrentTimeline``playlist`
`getCurrentTracks``source.get*Tracks`
`getPlayerError`See the [Events](🔗) section
`isLoading``isStalled`
`isPlayingAd``isAd`
`isCurrentMediaItemLive``isLive`

### `MediaItem` ➡️ `Source` method mapping

ExoPlayerBitmovin Player
`MediaItem.fromUri``SourceConfig.fromUrl`
`MediaItem.setClippingConfiguration`Not supported

### Additional Notes

#### Seeking

[`ExoPlayer.seekTo(positionMs)`](🔗) (seeking in the current source) is equivalent to:

  • [`player.seek()`](🔗) for **non-live** streams

  • [`player.timeShift()`](🔗) for **live** streams

[`ExoPlayer.seekTo(mediaItemIndex, positionMs)`](🔗) (seeking in any source of the playlist) is equivalent to:

  • [`player.playlist.seek()`](🔗) for **non-live** streams

  • Live streams are currently not supported in Playlists.

ExoPlayer has some other seek helper methods to seek in the timeline. (`seekForward`, `seekToDefaultPosition`, `seekToNextMediaItem`, etc.). When using the Bitmovin Player you can get the seek position using `player.currentPosition` and `player.playlist`.

#### Events

The Bitmovin Player provides an extensive Event Framework. Listening to a `Player` event is as simple as:



If you were using `exoPlayer.addAnalyticsListener(EventLogger())` to log ExoPlayer events to the logcat, you may use the equivalent described [here](🔗)

For more advanced use cases, take a look at our API documentation for the `EventEmitter` [here](🔗).