Integrate the AI Education solution for iOS
The AI Education solution is an end-to-end AI video solution that Alibaba Cloud builds on AliPlayerKit and ApsaraVideo VOD for businesses such as online education, course training, and knowledge distribution. This topic describes how to integrate the solution on iOS, including the prerequisites, the available integration paths, the App Server operations, and the client data models.
Use cases
The AI Education solution uses the player as the unified entry point. ApsaraVideo VOD provides the video content and the supporting services, and the solution adds automated content understanding that generates summaries, chapters, and key points. Viewers see how the content is organized, locate important segments, and review them at any time, so a long video becomes content that they browse on demand instead of watching end to end.
Online courses, vocational training, enterprise learning, paid knowledge, and academic lectures can all use the solution to improve learning efficiency and the viewing experience, make better use of existing video content, and reduce the cost of integrating and building player and AI features.

Core capabilities
The AI Education solution provides the following capabilities for quick understanding, precise navigation, and efficient review:
Capability | Description |
AI chapters | Automatically identifies the structure of the video content and generates chapters, which appear on the progress bar and in the chapter list at the same time. Click a chapter to jump to the corresponding segment. |
Content summary | Provides an overall video summary and chapter summaries, which help viewers quickly understand the main content and the key points of each chapter. |
Key point extraction | Automatically extracts the key points of each chapter and displays them in a structured form for learning and review. |
Chapter thumbnails | Displays a representative frame for each chapter, which helps viewers identify and locate the content that they want. |
Portrait and landscape adaptation | Adjusts the interaction layout based on the screen orientation: the panel appears at the bottom in portrait mode and on the right in landscape mode. |
How the AI Education solution works
The AI Education solution consists of the client, the App Server, Intelligent Media Services (ICE) AI workflows, and the ApsaraVideo VOD service.
The end-to-end process has two phases:
Production phase — The App Server triggers the AI analysis workflow. ICE retrieves the media asset, extracts chapters, generates summaries, and analyzes key points, and then writes the structured results back to ApsaraVideo VOD.
Consumption phase — The client gets the playback credential and the AI analysis results from the App Server, and PlayerKit handles video playback, chapter navigation, and AI content display.
End-to-end business process
The end-to-end business process of the AI Education solution covers the full path of AI analysis results from production and storage to consumption on the client.
In this process, ApsaraVideo VOD stores the media assets and the AI analysis results in a unified way. ICE AI workflows handle content understanding and structured analysis. The App Server encapsulates the server-side capabilities and provides a unified interface to the client.
Client interaction process
The client interaction process describes the calls between the client, PlayerKit, and the App Server after the AI Education playback page opens.
When the page initializes, the client gets the playback credential and then the AI analysis results. After the data finishes loading, the chapter content panel shows chapters, summaries, and key points, and viewers can jump to the corresponding position in the video.
If the AI analysis request fails or returns an empty result, the client can still use the playback credential to play the video as usual, but the chapter list and the AI analysis panel do not appear.
Client layered architecture
The client of the AI Education solution 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 slots to provide the entry in the player control bar and the panel extension capabilities. The underlying Player SDK handles media asset playback, progress control, and playback status callbacks.

Prerequisites
Complete the following preparations before you integrate the AI Education solution on iOS:
Player SDK version — Use ApsaraVideo Player SDK 7.16.0 or later.
Podfile dependency — Import the Down dependency (
~> 0.11.0) in the Podfile. Markdown rendering in the AI analysis panel depends on it.PlayerKit scenario layer — The AI Education solution is built on the PlayerKit scenario layer, so complete the general integration first: Integration preparation—Scenario layer integration (import the
PlayerKitandSceneAiEducationmodules), and Quick start—Scenario layer setup (start the scenario page).Alibaba Cloud services — Activate ApsaraVideo VOD in the ApsaraVideo VOD console and activate Intelligent Media Services in the Intelligent Media Services console.
Media asset — A test video is ready and AI content analysis for the video is complete.
App Server — Deploy an App Server that provides playback credentials and AI analysis data. For an implementation reference, see the VodAppServer open source project.
Choose an integration path
The AI Education solution supports three integration paths. Choose the path that matches how much of the built-in scenario page you reuse:
Integration path | When to use |
Built-in scenario page (Recommended) | You want the shortest path to a working page. |
You keep the built-in loading flow but get playback credentials and AI analysis data from your own data source. | |
You do not want to use the built-in |
Integrate with the built-in scenario page
After the general integration of the PlayerKit scenario layer is complete, the AI Education solution requires only the following configuration.
Configure the App Server and the test video
Open AiContentConstants.m and modify the following constants:
NSString * const AiContentAppServerBaseURL = @"http://your-server-host:port";
NSString * const AiContentDefaultMediaId = @"your-media-id";Set AiContentAppServerBaseURL to the base URL of the App Server that you deployed, and set AiContentDefaultMediaId to the ID of the media asset that you use for testing.
Start the scenario page
Start the AI Education page with the scenario layer setup method. The following table lists the view controller and the URL scheme that identify the page.
Item | Value |
View controller |
|
URL scheme |
|
Verify the integration
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 both appear, the integration is successful.
If the video plays but the chapter entry button or the AI analysis content does not appear, see Integration FAQ.
Replace the data source
By default, SceneAiEducationViewController loads data through AiContentLoader. To use your own data source, refer to the implementation flow of the view controller and replace the data loading logic. Load the playback credential first, and then load the AI analysis content in the completion block:
// Sample custom loading
AiContentLoader *loader = [[AiContentLoader alloc] initWithBaseURL:@"http://your-server"];
[loader loadPlayAuthWithVideoId:@"your-vid"
completion:^(NSString * _Nullable playAuth) {
// After you get playAuth, continue to load the AI content...
[loader loadAiAnalysisWithMediaId:@"your-vid"
completion:^(AiAnalysisResponse * _Nullable response) {
// After you get AiAnalysisResponse, configure the player...
}];
}];Both the connection timeout and the read timeout of AiContentLoader are 5 seconds. To use different values, implement a custom loader.
Integrate into an existing view controller
If you do not want to use the built-in SceneAiEducationViewController, refer to its implementation and orchestrate the page yourself:
1. Create the player components — Initialize
AliPlayerViewandAliPlayerController.2. Configure the playback source — Create the video source and set
AliPlayerModel.sceneTypetoSceneTypeAIVod.3. Assemble the AI analysis data — Load the playback credential and the AI analysis data, and then set
AliPlayerModel.chaptersto the chapter list of the assembled view model.4. Register the chapter button custom slot — Register
ChapterButtonSlotthrough the slot manager of the player view.5. Configure and attach the player — Playback starts automatically after the player is attached.
In the following sample,
mediaIdis the ID of the media asset,playAuthis the playback credential, andresponseis theAiAnalysisResponseobject. LoadplayAuthandresponsefrom the App Server as described in Replace the data source. Theordervalue in the slot registration is a sample value.
// 1. Create the player components
AliPlayerView *playerView = [[AliPlayerView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:playerView];
AliPlayerController *playerController = [[AliPlayerController alloc] init];
// 2. Configure the playback source by using VidAuth
VideoSource *source = [VideoSource vidAuthSourceWithVid:mediaId playAuth:playAuth];
AliPlayerModel *model = [[AliPlayerModel alloc] initWithVideoSource:source];
model.sceneType = SceneTypeAIVod;
// 3. Assemble the AI analysis response and pass the chapter list to the player
AiContentViewModel *viewModel = [AiContentAssembler buildViewModelFromResponse:response];
model.chapters = viewModel.chapters;
// 4. Register the chapter button custom slot
CustomSlotType *slotType = [CustomSlotType typeWithKey:@"chapter_button" order:85];
[playerView.slotManager registerCustomSlotType:slotType
provider:^UIView<SlotProtocol> *(UIView *parentView) {
return [[ChapterButtonSlot alloc] initWithFrame:parentView.bounds];
}];
// 5. Configure and attach the player. Playback starts automatically after the player is attached.
[playerController configure:model];
[playerView attach:playerController];Customize the UI
Panel style — To replace the style of the chapter content panel, inherit
ChapterContentViewand customize the layout.Slots — To extend the player controls, register custom slots through
SlotManager.For more information, see Slot system.
App Server operations
The AI Education solution consumes two App Server operations: one returns the playback credential, and one returns the AI analysis content of the media asset.
Get a playback credential
GET {AppServerBaseURL}/appServer/GetVideoPlayAuth?videoId={vid}Request parameters:
Parameter | Type | Required | Description |
| String | Yes | The ID of the video |
Sample response:
{
"code": 0,
"success": true,
"data": {
"videoId": "your-video-id",
"playAuth": "eyJ..."
}
}Response fields:
Field | Type | Description |
| Integer | The business return code. A value of 0 indicates success |
| Boolean | Indicates whether the request was successful |
| String | The ID of the video |
| String | The Base64-encoded playback credential, which expires after a period of time |
Get AI analysis content
GET {AppServerBaseURL}/GetMediaAiAnalysisByResultType?MediaId={vid}To return only one type of result, add the optional ResultType parameter:
GET {AppServerBaseURL}/GetMediaAiAnalysisByResultType?MediaId={vid}&ResultType=ChapterRequest parameters:
Parameter | Type | Required | Description |
| String | Yes | The ID of the media asset |
| String | No | The type of the result: |
Sample response:
{
"AiAnalysisResult": [
{
"ResultType": "Chapter",
"Title": "Video title",
"Extra": "{\"Summary\":\"Fallback summary text\"}",
"ChapterContentItems": [
{
"ChapterId": "1",
"StartTime": 0,
"EndTime": 120000,
"ChapterTitle": "Course overview",
"Summary": "This chapter introduces the overall content of the course...",
"ThumbnailUrl": "https://example.com/thumb1.jpg",
"KnowledgePoints": [
{
"PointId": "1",
"Point": "Core concept",
"PointDescription": "A detailed description of the core concept in this chapter..."
}
]
}
]
},
{
"ResultType": "Summary",
"Title": "Video title",
"SummaryContent": {
"ParagraphSummary": "An overall summary of the video content...",
"MarkdownContent": "# Chapter title\nDetailed content...",
"MindMapSummary": [
{
"Title": "Topic branch",
"Topic": ["Subtopic A", "Subtopic B"]
}
]
},
"Tags": ["Education", "Technology"]
}
]
}To connect your own server, return the same JSON structure. The client does not depend on how the server is implemented.
The AiAnalysisResult array contains one item per result type. The following tables describe the fields of the Chapter item and the Summary item.
Chapter fields:
Field | Type | Description |
| String | The unique identifier of the chapter |
| Integer | The start time of the chapter, in milliseconds |
| Integer | The end time of the chapter, in milliseconds |
| String | The title of the chapter |
| String | The summary of the chapter |
| String | The URL of the chapter thumbnail |
| Array | The list of key points |
| String | The ID of the key point |
| String | The name of the key point |
| String | The description of the key point |
Summary fields:
Field | Type | Description |
| String | The overall paragraph summary of the video |
| String | The complete analysis content in Markdown |
| Array | The list of mind map branches. Each item contains |
|
| The list of video tags |
Data models and mappings
Data mapping
The server-side JSON of the AI Education solution maps directly to a data transfer object (DTO) through AiAnalysisResponse, and AiContentAssembler then assembles the DTO into business models. The following table describes how server-side fields map to client DTOs and business models:
Server-side JSON field | Client DTO | Business model | Description |
|
|
| The chapter ID |
|
|
| In milliseconds |
|
|
| In milliseconds |
|
|
| The chapter title |
|
|
| The thumbnail |
|
| — | The chapter summary. Retained in the DTO |
|
|
| The list of key points. |
|
|
| The global summary of the video |
|
|
| The complete analysis content in Markdown |
|
|
| Retains the complete |
Aggregated model
The data is finally aggregated into AiAnalysisResponse, which contains the following fields:
Field | Type | Description |
|
| The ID of the media asset |
|
| The list of AI analysis results |
|
| The result item of the |
|
| The result item of the |
Additional information about the DTO models:
SummaryContentcontains three properties:paragraphSummary(NSString, the paragraph summary),markdownContent(NSString, the complete analysis in Markdown), andmindMapSummary(NSArray<MindMapItem *>, the list of mind map branches).MindMapItemmodel:title(NSString, the title of the mind map node) andtopics(NSArray<NSString *>, the list of subtopics).Which result items
AiAnalysisResponsecarries also determines the layout of the chapter content panel. For details, see Client models and panel rendering.
Client models and panel rendering
The client data architecture of the AI Education solution separates data assembly from UI rendering.
Data flow:
Server JSON → AiAnalysisResponse (DTO) → AiContentAssembler → AiContentViewModel → ChapterContentView (UI)Client models:
Class | Responsibility | Key properties |
| Data assembly: converts the DTO into a view model |
|
| The UI view model and the only data entry point for the panel |
|
| The chapter display model for |
|
| The summary display model for |
|
Design principles:
AiAnalysisResponseremains a pure DTO that maps directly to the server-side JSON.AiContentAssemblerhandles all data assembly, including formatting, extraction, and conversion.ChapterContentViewis initialized throughinitWithViewModel:and only renders data without processing it.AiContentAssemblerpreformats the rendering format of key points as- **{Point}**followed by a full-width colon (U+FF1A) and{Description}.Tab combination rules: the layout of the chapter content panel depends on the data that actually exists in
AiAnalysisResponse, and each tab maps to one result item.AiContentViewModelexposes the availability of the two result items ashasChapterDataandhasSummaryData, which correspond tochapterResultandsummaryResult. The following table describes the panel layout for each combination of available data:
Available data | Panel layout | Rendered content |
Only | Two tabs: the chapter tab and the AI analysis tab | The chapter tab renders |
Only | One AI analysis view without a tab bar | The view renders |
Both | Two tabs: the chapter tab and the AI analysis tab | The chapter tab renders |
Integration FAQ
Issue | Solution |
Failed to get the playback credential | Check whether the App Server URL is correct, whether the network is connected, and whether the |
The AI content is empty | Make sure that AI analysis is enabled for the video. If no AI data is available, the client falls back to normal playback mode without the AI panel |
How do I use my own video ID | Modify |
The panel behaves incorrectly when the screen orientation changes | The panel uses |
How do I disable an AI capability | Do not return the corresponding |
SDK version compatibility | Check the Player SDK version against the version requirement in Prerequisites |
Markdown rendering is abnormal | Make sure that the Podfile imports the Down dependency version listed in Prerequisites |
The chapter button does not appear | Make sure that the |
Network timeout | Both the connection timeout and the read timeout of |