メインコンテンツまでスキップ

Introduction

BlendVision Android & Android TV Player SDK offers a rich set of APIs that enable you to control and customize the playback experience, designed to seamlessly integrate with the player into your native applications.

Getting Started

To begin your journey with Android & Android TV Player SDK APIs, follow this guide to install the SDK and initialize the player.

API Overview

Control the Player

The APIs allow you to control the behaviors of the player. Below are some examples:

  • Start the playback: player.play()
  • Pause the playback: player.pause()
  • Seek to the 30th second of the media: player.seek(30)

Additionally, APIs with a set prefix enable you to define parameters for player behaviors. Below are some examples:

  • Set the playback volume to 50%: player.setVolume(0.5)
  • Set the playback speed to 1.25x: player.setPlaybackSpeed(1.25)

Get Information

The APIs with a get prefix allow you to retrieve the media information and the playback status. Below are some examples:

  • Get the total duration of the media: player.getDuration()
  • Get the current playback speed: player.getCurrentPlaybackSpeed()

Track Event

The APIs allow you to register listeners to track the event logs:

// Playback Event Listener
player.addStateEventListener(object: StateEventListener {
override fun onPlayerStateChanged(playerState) { // playerState = IDLE, READY, BUFFERING, ENDED
// do something
}
})

// Error Event Listener
player.addErrorEventListener(object: ErrorEventListener {
override fun onUniError(errorEvent: UniErrorEvent): Boolean // UniErrorEvent = Exception defined in Java/Kotlin
// do something
}
})

You can gain valuable insights into your content performance and perform customized actions when events are triggered.

Multiple Players Targeting

In situations where you have more than one player on single page of your native applications, it's essential to specify which player you would like to interact with.

val player1 = UniPlayer.Builder(context, PlayerConfig()).build()
binding.playerView1.setUnifiedPlayer(player1)
with(player1) {
// do something with player 1
}

val player2 = UniPlayer.Builder(context, PlayerConfig()).build()
binding.playerView2.setUnifiedPlayer(player2)
with(player2) {
// do something with player 2
}

Assets