Superplayer for Android

Last updated: 2021-05-19 16:38:16


    The superplayer SDK for Android is a player component used to play back videos in VOD. It can implement powerful playback functionality similar to Tencent Video with just a few lines of code.

    • Basic features: landscape/portrait mode switch, definition selection, gestures, small window playback, etc.
    • Advanced features: video buffering, software/hardware decoding switch, adjustable-speed playback, video thumbnails, DRM-encrypted playback, etc.

    The superplayer SDK supports more formats and has better compatibility and functionality than system-default players. In addition, it features instant playback on splash screen and low latency.

    SDK Download

    The VOD superplayer SDK for Android can be downloaded here.

    Quick Integration

    It takes just a few simple steps to integrate with the VOD superplayer SDK for video playback.

    aar integration

    1. Download the SDK and Demo development kit for Android here: SuperPlayer_Android.

    2. Import SDK/LiteAVSDK_XXX.aar and Demo/superplayerkit into the project.

    3. Add dependencies to app/build.gradle:

      compile(name: 'LiteAVSDK_Player_7.4.9211', ext: 'aar')
      compile project(':superplayerkit')
      // Third-party library for integration of the on-screen commenting feature of superplayer
      compile 'com.github.ctiao:DanmakuFlameMaster:0.5.3'
    4. Add the following to the project's build.gradle:

      allprojects {
      repositories {
          flatDir {
              dirs 'libs'
    5. Declare the permissions:

      <!--network permission-->
      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
      <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
      <!--VOD player floating window permission -->
      <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
      <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    Preparing videos

    Log in to the VOD Console, click Media Assets on the left sidebar, and you will see the uploaded video and its corresponding ID (i.e., FileId) in the video list in the Uploaded column. If you don't have a video, please click Upload Video to upload one.

    You can initiate an adaptive bitrate streaming task for the uploaded video through ProcessMedia:
    You are recommended to enter 10 for MediaProcessTask.AdaptiveDynamicStreamingTaskSet.Definition in the API parameter, indicating transcoding to adaptive bitstream in HLS format.

    Starting playback

    The main class of the player is SuperPlayerView, and videos can be played back after it is created.

    mSuperPlayerView = findViewById(;
    // Configure video information through `fileid`
    SuperPlayerModel model = new SuperPlayerModel();
    model.appid = 1256993030;   // AppId
    model.fileid = "7447398157015849771"; // Video `FileId`
    model.videoId.playDefinition = "10";  // Playback template
    model.videoId.version = SuperPlayerVideoId.FILE_ID_V3;
    // Start playback

    In the code, appid is your AppId, fileid is the ID of the video you want to play back, playDefinition is the ID of the playback template used for playback, and version is fixed to SuperPlayerVideoId.FILE_ID_V3.

    Run the code and you can see that the video is played back on the phone and most of the features in the UI are available.

    Thumbnails and Timestamps

    When videos are played back, the "thumbnails" and "timestamps" on the progress bar can help viewers find the points of interest easily. Thumbnails are implemented through image sprites, while timestamps by modifying timestamp information in media assets.

    After image sprites are generated and timestamps are added, new elements will be displayed in the player UI.

    How to use

    First, the application needs to get the token from your business backend. Then, play back the video through FileId and Token with the following playback code:

    SuperPlayerModel model = new SuperPlayerModel();
    String fileId = "7447398157015849771";
    model.appId = 1256993030;
    model.videoId = new SuperPlayerVideoId();
    model.videoId.fileId = fileId;
    model.videoId.playDefinition = "20";  // Playback template
    model.videoId.version = SuperPlayerVideoId.FILE_ID_V3; // The V3 protocol needs to be used for DRM
    try {
      // The token needs to be URL-encoded
      String encodedToken = URLEncoder.encode("Token issued by the business", "UTF-8");
      model.token = encodedToken;
    } catch (UnsupportedEncodingException e) {

    Small Window Playback

    Small window playback can float on top of all Activities. It is very simple. You just need to call the following code before playback starts:

    // Player configuration
    SuperPlayerGlobalConfig prefs = SuperPlayerGlobalConfig.getInstance();
    // Enable floating window playback
    prefs.enableFloatWindow = true;
    // Set the initial position, width, and height of the floating window
    SuperPlayerGlobalConfig.TXRect rect = new SuperPlayerGlobalConfig.TXRect();
    rect.x = 0;
    rect.y = 0;
    rect.width = 810;
    rect.height = 540;
    // Other configurations

    Exiting Playback

    If the player is no longer needed, please call resetPlayer to clear the internal state of the player and free up the memory.


    More Features

    To try out the complete features, scan the QR code below to download the Tencent Video Cloud toolkit or run the project demo directly.