クイックスタート - AndroidプレーヤーSDK

This guide will walk you through the steps to start a BlendVision One streaming playback using the Android player SDK.

Before We Start

Before proceeding, ensure that you have prepared your BlendVision One streaming content. You can prepare your content in two ways:

Step 1: Obtain a Playback Token

  • Obtain a valid API token by following the authentication steps
  • Retrieve the resource_id and  resource_type of the streaming content you would like to playback. There are two ways to obtain this information:
    • Retrieve using the API
    • Copy from your BlendVision One console
      • VOD > Publishing Tools > Player SDK > VOD ID
      • Live > Publishing Tools > Player SDK > Event ID

  • Obtain the resource token using the API: /bv/cms/v1/resources/tokens, with the resource_id and  resource_type as body parameters.
    • You can also include customer_id in the body parameters if you want to track user playback with your own defined user ID
  • Obtain the playback token using the API: /bv/playback/v1/tokens, with the resource token as a body parameter.


const val API_DOMAIN = ""

interface ApiService {


    suspend fun createResourceToken(

        @Header("Authorization") cmsToken: String, // CMS token

        @Body req: ResourceTokenRequest

    ): ResourceTokenResponse



    suspend fun getPlaybackToken(

        @Header("Authorization") resourceToken: String

    }: PlaybackTokenResponse


// data for resource token

data class ResourceTokenRequest(


    val resourceId: String,


    val resourceType: String


data class ResourceTokenResponse(


    val resourceToken: String


// data for playback token

data class PlaybackTokenResponse(


    val playbackToken: String


Step 2: Start a Playback Session


const val API_DOMAIN = ""

interface ApiService {


    suspend fun startPlaybackSession(

        @Header("Authorization") playbackToken: String,

        @Path("deviceId") deviceId: String

    ): StartSessionResponse



    suspend fun getStreamInfo(

        @Header("Authorization") playbackToken: String,

        @Path("deviceId") deviceId: String

    ): GetStreamInfoResponse


// data for start a session

data class StartSessionResponse(


    val endPoint: String


// data for get stream information

data class GetStreamInfoResponse(


    val sources: List<Source>


data class Source(


    val manifests: List<Manifest>,


    val thumbnailSeekingUrl: String


data class Manifest(


    val protocal: String,


    val url: String,


    val resolutions: List<Resolution>


data class Resolution(


    val height: String,


    val width: String


Step 3: Initialize the Player

  • To play the streaming content, create a player instance with the license key and stream information in the initialization configuration:


// create the player instance

private var player: UniPlayer? = null

player = UniPlayer.Builder(



            license = "YOUR_LICENSE_KEY"




// set player view type


    defaultContentType = ContentType.STANDALONE


// bind the new created player to player view


// load stream information



        source = listOf(


                url = streamInfoResponse.sources[0].manifests.filter { it.protocol == MediaConfig.Protocol.DASH }[0].url,

                protocal = MediaConfig.Protocol.DASH,

                drm = MediaConfig.DrmInfo.Widevine(

                    licenseUrl = startSessionResponse.endPoint,

                    headers = mapOf("" to "")




        title = "",

        imageUrl = "",

        thumbnailSeekingUrl = ""



// start playback


// pause/play during playback



// release the player


Step 4: Manage the Lifecycle of a Playback Session

  • To keep the playback session alive, periodically invoke the heartbeat API every 10 seconds
  • When the user leaves the player, release the session using the end playback session API


const val API_DOMAIN = ""

interface ApiService {

    // post this API every 10 seconds


    suspend fun Heartbeat(

        @Header("Authorization") playbackToken: String,

        @Path("deviceId") deviceId: String




    suspend fun EndPlaybackSession(

        @Header("Authorization") playbackToken: String,

        @Path("deviceId") deviceId: String



What's More