Core capabilities

Updated at:

This topic describes the core capabilities of AliPlayerKit, including product positioning, core architecture, component responsibilities, core APIs, and explains its six core systems.

Product positioning

Design goals

AliPlayerKit is designed to provide developers with an out-of-the-box and highly customizable player UI component layer:

Design goal

Description

Low-code integration

Provides a complete playback experience with minimal code.

Multi-scenario coverage

Supports VOD, live, short video, and other playback scenarios.

Reusable architecture

Uses a slot and strategy architecture to avoid rebuilding player capabilities across different business units.

Unified foundation

Serves as the unified foundation for all player and scenario-based solutions.

Cross-platform alignment

Shares the same architectural design as the Android version for consistent API semantics.

Architectural layers

In the overall architecture, AliPlayerKit sits above the player kernel. It uses a unified UI component system and abstracts playback scenarios to deliver shared capabilities across different playback services:

Layer

Positioning

Module location

Responsibilities

Component layer

Player UI components

PlayerKit/

Provide out-of-the-box, configurable player UI components that cover basic playback and common interactions.

Scene layer

Scenario-based solutions

PlayerKitScenes/

Provide standardized integration examples for typical scenarios such as short dramas, long-form videos, and live streaming. This helps you build a complete playback experience with minimal code.

Core architecture

AliPlayerKit uses a "3 + 1" core architecture to build the player framework:

  • Three runtime interfaces: They follow the MVC architecture to separate UI rendering, playback control, and data configuration.

    • AliPlayerView: The player UI container (a UIView subclass). It manages slot layout and the rendering layer (View).

    • AliPlayerController: The playback controller. It manages playback state, notification dispatching, and strategy scheduling (Controller).

    • AliPlayerModel: The data model. It encapsulates configurations such as the video source, scene type, and autoplay settings (Model).

  • One global interface: Provides framework initialization and global capability management, serving as the unified entry point for the player framework.

    • AliPlayerKit: Initializes the framework and provides fundamental capabilities such as global configuration, log management, and preloading.

Component responsibilities

Component

Type

Responsibilities

Lifecycle

AliPlayerKit

Global entry point

Global initialization, configuration management, log/preload management, and version information.

Application-level

AliPlayerView

View

UI container, slot host, fullscreen transitions, and back-button callbacks.

Page-level

AliPlayerController

Controller

Playback control, state management, notification dispatching, and strategy scheduling.

Page-level

AliPlayerModel

Model

Encapsulation of playback configurations (video source, scene type, autoplay, etc.).

Request-level

Core APIs

You must call the following core APIs for each player instance:

API

Description

[[AliPlayerController alloc] init]

Create a controller (using the default player lifecycle strategy).

[[AliPlayerController alloc] initWithLifecycleStrategy:]

Create a controller (specifying a player lifecycle strategy).

[[AliPlayerModel alloc] initWithVideoSource:]

Build a data model.

[controller configure:model]

Configure playback data.

[playerView attach:controller]

Bind the controller to the view.

[controller onResume]/ [controller onPause]

Resume/pause the lifecycle.

[playerView detach]

Unbind the view.

[controller destroy]

Destroy the controller and release resources.

Note

For detailed API descriptions, including the full method list and parameter definitions for each component, see the API Reference.

Call sequence

The core API call sequence follows the full player lifecycle: creation, binding, playback, and release.

Note

For complete integration steps, see the Quick start guide.

Core capabilities

Slot system

The slot system splits the player UI into independent components, where each slot handles a specific function, such as the top control bar, progress bar, or cover image. You can combine them freely: use the default UI for quick integration, replace components as needed, or build a fully custom UI. UI components are fully decoupled from the player core, so customization does not require source code changes, and upgrades do not risk code conflicts. You can also reuse the same slot components across different playback scenarios to avoid redundant development. For details, see Slot system.

Strategy system

The strategy system encapsulates business logic into independent strategy components. Each strategy implements a specific function, such as first-frame metrics, stall detection, or data usage protection. You can extend functionality at the strategy layer without modifying the framework core. Each strategy has a single, isolated responsibility, supports reuse across player instances, and can be enabled or disabled on demand. Framework upgrades and business customizations do not interfere with each other. For details, see Strategy system.

Notification system

The notification system uses a Notification Dispatcher + Delegate pattern to decouple components. UI components subscribe to relevant notifications through a Delegate protocol without holding a controller reference. The controller multicasts state changes through the dispatcher without knowing which components are listening. Notifications are isolated at the instance level, so events from different player instances do not interfere with each other. For details, see Notification system.

Player lifecycle strategies

Player lifecycle strategies manage instance creation, reuse, recycling, and destruction. The framework includes four built-in strategies for specific scenarios: Default for general use, Singleton for single-player interfaces, ReusePool for list-based playback, and IdScopedPool for preloading. You can choose a strategy to balance performance and resource usage. For example, using ReusePool for a short video list can significantly improve scrolling smoothness and time to first frame. For details, see Player lifecycle strategies.

Log system

The log system provides a unified log center, LogHub. It supports six output levels (Verbose/Debug/Info/Warn/Error/None) and filtering, ensuring that key runtime events are traceable from end to end. You can also use the LogObserver protocol to write logs to a file or report them to a server. For details, see Log system.

Multiple video source support

AliPlayerKit supports multiple video source types. We recommend using the VidAuth source. For details, see Multiple video source support.

Source type

Creation method

Use cases

VidAuth source

[VideoSource vidAuthSourceWithVid:playAuth:]

The recommended method for Alibaba Cloud VOD.

VidSts source

[VideoSource vidStsSourceWithVid:accessKeyId:accessKeySecret:securityToken:region:]

Uses Alibaba Cloud Security Token Service (STS) temporary credentials.

URL source

[VideoSource urlSourceWithUrl:]

For live streaming or simple scenarios.

Custom configurations

Custom configurations provide a two-level mechanism that lets you inject custom SDK settings at key moments. You can fine-tune parameters globally or per instance without modifying the framework source code. For details, see Custom configurations.

Level

Registration method

Trigger time

Typical use cases

Global

[AliPlayerKit setOnGlobalInitBlock:]

After setup completes (only once).

setOption, global log level.

Instance

model.onPlayerConfigBlock

In configure:, before prepare.

setConfig (buffer/Referer), setOption.

Localization system

The localization system supports multi-language switching for all UI text within the SDK and includes built-in support for Simplified Chinese (zh-Hans) and English (en). For details, see Multi-language support.

Capability

API

Description

Manually switch languages

[AliPlayerKit setLanguageCode:]

Specify a language code to override the system language.

Follow system language

[AliPlayerKit resetLocaleToSystemLanguage]

Restore the setting to follow the system's preferred language.

Custom translations

[AliPlayerKit setLocaleProvider:]

Inject a LocaleProvider, which has the highest priority.

Fullscreen transition and capture prevention

Fullscreen transition: The FullscreenTransition protocol abstracts the behavior of entering and exiting fullscreen mode. The default implementation, DefaultFullscreenTransition, uses a standalone window rotation approach. You can inject a custom implementation through playerView.fullscreenTransition to adapt to specific business scenarios.

Screen capture prevention: Enable this feature by setting AliPlayerModel.disableScreenshot = YES. When enabled, the video rendering view is embedded in a secure container. If a user attempts a screenshot or screen recording, the video frame automatically turns black, while UI controls remain unaffected.

Preload system

The preload system exposes the player SDK's global preloading capabilities through the PlayerPreloader protocol. It supports adding, canceling, pausing, and resuming preload tasks. A built-in DefaultPlayerPreloader implementation is included, and you can also inject a custom implementation by using [AliPlayerKit setPreloader:].

Scene types

The SceneType enumeration defines playback scenarios and affects slot visibility configurations and UI behavior. For details, see Scene types.

Enum value

Scene

Description

SceneTypeVOD

VOD

Default scenario with a full control bar.

SceneTypeLive

Live

Hides VOD-specific elements such as the progress bar.

SceneTypeVideoList

Video list/Short video stream

Simplified UI.

SceneTypeRestricted

Restricted playback

Minimal interactions.

SceneTypeMinimal

Minimalist playback page

Minimal UI elements.