Integrate the AI Education Solution on Android

Updated at:

This topic describes how to integrate the AI Education Solution on Android. It covers the core capabilities, prerequisites, integration steps, architecture, App Server API, and data model.

Scenario overview

The AI Education scenario uses the player as a unified entry point. ApsaraVideo VOD provides the video content and service support, and the scenario integrates AI content understanding to generate summaries, chapters, and key points automatically. These capabilities let viewers grasp the content structure, locate key clips, and review content on demand.

The solution applies to online courses, professional training, enterprise learning, paid knowledge, and academic lectures. It improves learning efficiency and the viewing experience, makes better use of your existing video content, and reduces the cost of integrating the player and AI features.

ai-education-ui-preview

Core capabilities

The AI Education scenario provides the following capabilities for quick understanding, precise positioning, and efficient review:

Capability

Description

Smart chapters

Identifies the content structure of a video and generates chapters automatically. Chapters are displayed on the progress bar and in the chapter list. Click a chapter to jump to the corresponding clip.

Content summary

Provides an overall video summary and per-chapter summaries to help viewers understand the main content and the key points of each chapter.

Key point extraction

Extracts the key points of each chapter automatically and displays them in a structured format for learning and review.

Chapter thumbnails

Displays a representative frame for each chapter to help viewers identify and locate the target content.

Portrait and landscape adaptation

Adjusts the interaction layout based on the screen orientation: the bottom panel in portrait mode and the right-side panel in landscape mode.

Prerequisites

Before you begin, make sure the following requirements are met:

Preparation

Requirement

Alibaba Cloud services

You have activated the ApsaraVideo VOD console and Intelligent Media Services console.

Media assets

You have prepared a test video and completed AI content analysis for it.

App Server

You have deployed the App Server to provide playback credentials and AI analysis data. You can refer to the open source project VodAppServer.

SDK version

ApsaraVideo Player SDK 7.16.0 or later is required. Earlier versions do not support SceneType.AI_VOD.

After you complete these preparations, configure the App Server address and the test video ID in the AiContentConstants class to start experiencing the AI Education scenario.

Quick start

Common integration

The AI Education scenario is built on the PlayerKit scene layer. If you have not completed the common integration steps, first see:

  • Integration Preparation: Scene layer integration (copy the playerkit and scene-ai-education modules, and complete project registration and dependency adjustments).

  • Quick start: Scene layer access (launch the scenario page).

Configure the App Server and test video

After you complete the common integration, configure the App Server address and test video ID.

Open AiContentConstants.java and modify the following configuration:

You can use the official App Server address for a quick trial. For production, deploy your own service first and use its address. For deployment instructions, see the VodAppServer open source project listed in the prerequisites.

public static final String APP_SERVER_BASE_URL = "http://your-server-host:port";

public static final String DEFAULT_MEDIA_ID = "your-media-id";

Verify the integration

The AI Education scenario uses the following entry points:

Item

Value

Activity

AiEducationActivity

Schema

playerkit://scenes/aieducation

After the page starts, the video loads automatically and the player displays the chapter entry button. Click the button to view the chapter list and the AI analysis content. If the chapter button appears and the AI content is displayed, the integration is successful.

If verification fails, check the following:

  • The App Server address in AiContentConstants is correct and reachable.

  • The video ID is valid and AI analysis has been completed for the video.

  • The network connection is available.

    For more troubleshooting information, see Integration FAQ.

Architecture overview

The AI Education scenario consists of the client, the App Server, the ICE/AI analysis workflow, and the ApsaraVideo VOD service.

The overall pipeline is divided into two stages:

  • Production stage: The App Server triggers the AI analysis workflow. ICE retrieves the media asset and performs chapter extraction, summary generation, and key point analysis, and then writes the structured results back to ApsaraVideo VOD.

  • Consumption stage: The client obtains the playback credential and the AI analysis results through the App Server, and PlayerKit handles video playback, chapter jumping, and AI content display.

End-to-end business process

The end-to-end business process describes the complete pipeline of AI analysis results, from production and storage to client consumption.

In this process, ApsaraVideo VOD provides unified storage for media assets and AI analysis results, the ICE/AI analysis workflow performs content understanding and structured analysis, and the App Server encapsulates the server-side capabilities and provides a unified API to the client.

image

Client interaction flow

The client interaction flow describes the call relationships among the client, PlayerKit, and the App Server after a user enters the AI Education playback page.

During page initialization, the client obtains the playback credential and the AI analysis results in parallel or in sequence. After the data is loaded, you can view chapters, summaries, and key points in the chapter content panel and jump to the corresponding position in the video.

image

If the AI analysis API request fails or returns an empty result, the client can still use the playback credential for normal video playback, but it does not display the chapter and AI analysis panels.

Client layered architecture

The client uses a layered design that consists of the scenario layer, the PlayerKit capability layer, and the Player SDK.

The scenario layer handles page orchestration, data loading, and AI content display. PlayerKit uses the slot mechanism to provide the player control bar entry and panel extension capabilities. The underlying Player SDK handles media asset playback, progress control, and playback state callbacks.

LayeredArchitecture-Android

App Server API

Get a playback credential

Item

Value

Method

GET

Path

/appServer/GetVideoPlayAuth

Parameter

videoId (required, the video ID)

Sample request:

GET http://your-server-host:port/appServer/GetVideoPlayAuth?videoId=201558617a9e71f1bfb9e6e7e5780102

Sample response:

{
  "code": 0,
  "success": true,
  "data": {
    "videoId": "your-video-id",
    "playAuth": "eyJ..."
  }
}

Response fields:

Field

Type

Description

code

Integer

The business status code. A value of 0 indicates success.

success

Boolean

Indicates whether the request is successful.

data.videoId

String

The video ID.

data.playAuth

String

The Base64-encoded playback credential.

Get AI analysis content

Item

Value

Method

GET

Path

/GetMediaAiAnalysisByResultType

Required parameter

MediaId (the video ID)

Optional parameter

ResultType (Chapter or Summary. If you do not specify this parameter, all results are returned.)

Sample request:

GET http://your-server-host:port/GetMediaAiAnalysisByResultType?MediaId=201558617a9e71f1bfb9e6e7e5780102

Sample response:

{
  "AiAnalysisResult": [
    {
      "ResultType": "Chapter",
      "Title": "Video chapters",
      "chapterContentItems": [
        {
          "ChapterId": 1,
          "StartTime": 0,
          "EndTime": 120000,
          "ChapterTitle": "Course introduction",
          "Summary": "This chapter introduces the overall framework of the course...",
          "ThumbnailUrl": "https://example.com/thumb1.jpg",
          "KnowledgePoints": [
            { "PointId": 1, "Point": "Core concept", "Description": "Description..." }
          ]
        }
      ]
    },
    {
      "ResultType": "Summary",
      "Title": "Video summary",
      "summaryContent": {
        "ParagraphSummary": "This video mainly covers...",
        "MindMapSummary": [
          { "Title": "Core concept", "Topics": [...] }
        ],
        "MarkdownContent": "# Course summary\n\n..."
      }
    }
  ]
}

To connect your own server, return the same JSON structure. The client does not depend on how the server is implemented.

Chapter fields:

Field

Type

Description

ChapterId

Integer

The chapter ID.

StartTime

Long

The start time of the chapter, in milliseconds.

EndTime

Long

The end time of the chapter, in milliseconds.

ChapterTitle

String

The chapter title.

Summary

String

The text summary of the chapter.

ThumbnailUrl

String

The URL of the chapter thumbnail.

KnowledgePoints[].PointId

Integer

The key point ID.

KnowledgePoints[].Point

String

The name of the key point.

KnowledgePoints[].Description

String

The description of the key point.

Summary fields:

Field

Type

Description

ParagraphSummary

String

The paragraph summary text.

MindMapSummary

Array

The mind map summary list. This is a recursive structure in which each item contains Title and Topics.

MarkdownContent

String

The content in Markdown format.

API conventions:

Item

Description

HTTP timeout

5 seconds (connect + read).

Error handling

If the API fails, the client falls back to normal playback mode without the AI panel.

Time unit

StartTime and EndTime are in milliseconds.

Data model and mapping

Data mapping

Server JSON field

Client DTO

Business model

Description

ChapterId

ChapterContentItem.chapterId

ChapterInfo.id

Converted to String.

StartTime

ChapterContentItem.startTime

ChapterInfo.startMs

In milliseconds.

EndTime

ChapterContentItem.endTime

ChapterInfo.endMs

In milliseconds.

ChapterTitle

ChapterContentItem.chapterTitle

ChapterInfo.title

ThumbnailUrl

ChapterContentItem.thumbnailUrl

ChapterInfo.thumbnailUrl

Summary

ChapterContentItem.summary

KnowledgeInfo.contentMarkdown

Generated through a three-level fallback.

KnowledgePoints[]

ChapterContentItem.knowledgePoints

KnowledgeInfo.contentMarkdown

Concatenated into Markdown. This field takes precedence over Summary.

ParagraphSummary

SummaryContent.paragraphSummary

SummaryInfo.paragraphSummary

The global video summary.

MindMapSummary

SummaryContent.mindMapSummary

SummaryInfo.mindMapTitles

Extracts the list of top-level Title values.

MarkdownContent

SummaryContent.markdownContent

SummaryInfo.markdownContent

The content in Markdown format.

Presentation model

The data is assembled into AiContentViewModel, which is generated at once by AiContentAssembler.buildViewModel(AiAnalysisResponse) and is the single data entry for the panel:

Field or method

Type

Description

chapters

List<ChapterInfo>

The chapter list. An empty list indicates that no chapter data is available.

knowledgeItems

List<KnowledgeInfo>

The list of key point items.

summaryInfo

SummaryInfo

The video summary information. This value can be null.

hasChapterData()

boolean

Indicates whether chapter data is included.

hasSummaryData()

boolean

Indicates whether summary data is included.

@AiContentType is not a field of the aggregate model. It is a tab-level rendering style enum (CHAPTERS_ONLY/TEXT_ANALYSIS/GRAPHIC_ANALYSIS) that is derived from the internal mTab0Type/mTab1Type values of ChapterContentDialogFragment.

Client data architecture

The client uses a layered design that separates data assembly from UI rendering. The server response lands as a plain DTO, which the assembler converts into a presentation model before the UI layer consumes it.

Data flow:

Server JSON -> AiAnalysisResponse (DTO) -> AiContentAssembler -> AiContentViewModel -> ChapterContentDialogFragment (UI)

Client models:

Class

Responsibility

AiContentAssembler

A pure static, stateless assembler that converts DTOs into presentation models. Public methods: buildViewModel(AiAnalysisResponse), buildChapters, buildKnowledgeItems, buildSummaryInfo, and hasAnyContent.

AiContentViewModel

The presentation-layer ViewModel for the panel. Fields: chapters, knowledgeItems, and summaryInfo. Methods: hasChapterData() and hasSummaryData().

KnowledgeInfo

Key point information. Fields: title, startMs, endMs, and contentMarkdown (preformatted as - **{Point}**: {Description}).

SummaryInfo

Video summary information. Fields: paragraphSummary, mindMapTitles (List<String>), and markdownContent.

Design principles:

  • Single responsibility: The DTO handles only JSON mapping, the assembler handles only data conversion, and the UI handles only rendering.

  • Lazy construction: The ViewModel is built only when the panel is displayed and is released when the panel is hidden to avoid wasting memory.

  • Stateless assembly: The assembler uses pure static methods without instance state, so you can call it any number of times.

  • Three-level fallback: The generation rule for KnowledgeInfo.contentMarkdown is KnowledgePoints first, then Summary, and null if both are empty.

    Tab combination rules:

Data condition

Tab structure

tab0 type

tab1 type

Chapters only (no summary)

Two tabs

CHAPTERS_ONLY

TEXT_ANALYSIS

Summary only (no chapters)

No tabs

GRAPHIC_ANALYSIS

--

Both

Two tabs

CHAPTERS_ONLY

GRAPHIC_ANALYSIS

Customization and extension

The customization path depends on your integration requirements:

  • Replace the data source: Choose this path if you want to keep the built-in UI and activity but load data from your own backend.

  • Customize the UI: Choose this path if you want to change the appearance of the AI content panels while keeping the built-in activity.

  • Integrate into an existing activity: Choose this path if you have an existing activity and want to embed the AI Education capabilities into it.

Replace the data source

The built-in AiEducationActivity loads data through AiContentLoader. To use your own data source, refer to the implementation of the activity and replace the data loading logic:

// Custom loading example
AiContentLoader loader = new AiContentLoader();
loader.loadPlayAuth(vid, playAuth -> {
    // After you get playAuth, continue to load the AI content...
});
loader.loadAiAnalysis(vid, response -> {
    // After you get the AiAnalysisResponse (a plain DTO), the consumer must explicitly call AiContentAssembler to assemble it...
});

The chapter data is assembled from the DTO by AiContentAssembler.buildChapters() and passed to AliPlayerModel, and is delivered only when it is not empty. AI content such as the video summary and chapter segments cannot be carried by AliPlayerModel, so the scenario layer must pass it in by calling ChapterContentPanelSlot.updateAiContent().

Customize the UI

  • Replace the style of the chapter content panel: inherit ChapterContentDialogFragment and override the layout.

  • Extend slots: register a custom slot through CustomSlotType.

  • For more information, see Slot System.

Integrate into an existing activity

If you do not want to use the built-in AiEducationActivity, refer to its implementation and do the following in your own activity:

  • Initialize AliPlayerController.

  • Register ChapterButtonSlot and ChapterContentPanelSlot, and save the instance references during registration.

  • Load the playAuth value and the AI content.

  • Configure and attach the player. After the player is attached, pass the AI content to the panel slot.

    Example:

Example code

public class MyActivity extends AppCompatActivity {

    @Nullable
    private ChapterContentPanelSlot mChapterContentPanelSlot;
    @Nullable
    private ChapterButtonSlot mChapterButtonSlot;

    private void registerSlots() {
        SlotManager slotManager = playerView.getSlotManager();
        slotManager.register(ChapterButtonSlot.TYPE, parent -> {
            mChapterButtonSlot = new ChapterButtonSlot(parent.getContext());
            return mChapterButtonSlot;
        });
        slotManager.register(ChapterContentPanelSlot.TYPE, parent -> {
            // Save the slot instance and pass the AI content after attach
            mChapterContentPanelSlot = new ChapterContentPanelSlot(parent.getContext());
            return mChapterContentPanelSlot;
        });
    }

    private void configurePlayer(@NonNull String vid, @NonNull String playAuth,
                                 @Nullable AiAnalysisResponse response) {
        // The consumer explicitly calls the assembler to build the chapter list
        List<ChapterInfo> chapters = response != null ? AiContentAssembler.buildChapters(response) : null;
        boolean hasChapters = chapters != null && !chapters.isEmpty();

        AliPlayerModel.Builder builder = new AliPlayerModel.Builder()
                .videoSource(VideoSourceFactory.createVidAuthSource(vid, playAuth))
                .sceneType(SceneType.AI_VOD);
        if (hasChapters) {
            builder.chapters(chapters);
        }
        AliPlayerModel playerModel = builder.build();

        playerController.configure(playerModel);
        playerView.attach(playerController);

        // After attach, explicitly pass the AI DTO to the panel slot
        if (mChapterContentPanelSlot != null) {
            mChapterContentPanelSlot.updateAiContent(response);
        }

        // Show or hide the chapter button based on whether AI content exists
        boolean chapterAvailable = AiContentAssembler.hasAnyContent(response);
        if (mChapterButtonSlot != null) {
            mChapterButtonSlot.updateChapterAvailable(chapterAvailable);
        }
    }
}

After the integration is complete, verify that the chapter button appears in the player when AI content is available, and that clicking the button opens the chapter content panel with chapters, summaries, and key points.

Integration FAQ

Question

Solution

The playback credential fails to be obtained

Check whether the App Server address is correct, the network is connected, and the VideoId value is valid.

The AI content is empty

Confirm that AI analysis is enabled for the video. The client falls back to normal playback mode without the AI panel.

How do I use my own video ID

Modify AiContentConstants.DEFAULT_MEDIA_ID or configure it on the settings page.

The panel behaves abnormally when switching between portrait and landscape

Confirm that the activity declares android:configChanges="orientation".

How do I disable a specific AI capability

Do not return the corresponding ResultType value in the App Server API. For example, return only Chapter and not Summary.

SDK version compatibility

ApsaraVideo Player SDK 7.16.0 or later is required. Earlier versions do not support SceneType.AI_VOD.