Scene type (SceneType) is an abstraction in AliPlayerKit for playback scenarios. You can specify a scene to automatically adapt the UI behavior, gesture controls, and slot visibility.
You do not need to set a SceneType for standard video-on-demand (VOD) scenarios. The default is SceneTypeVOD, which provides full playback capabilities. You only need to explicitly specify a SceneType for non-VOD scenarios, such as live streaming or restricted playback.
Introduction
What is SceneType?
SceneType is an enumeration that specifies the current business scenario for the player. When you set the SceneType, AliPlayerKit automatically:
Adjusts slot visibility, such as hiding the thumbnail in a live streaming scenario.
Filters gestures, such as disabling progress seeking and playback speed adjustment in live or restricted scenarios, or disabling vertical gestures in video list scenarios.
Adapts to feature limitations, such as ensuring users watch content completely and in order in a restricted scenario.
By simply setting an enumeration value, the framework automatically handles these adaptations. This greatly reduces the effort required to customize the player for different business scenarios.
Core value
Value | Description |
Zero-configuration adaptation | After setting a scene, the UI and interactive behaviors adjust automatically. No need to configure each slot and gesture individually. |
Consistency guarantee | All player instances in the same scenario maintain a consistent UI and interactive behavior. |
Reduced customization cost | Replace dozens of lines of slot visibility and gesture filtering code with a single line of code. |
Scalability | Perform further fine-tuning using SlotConfig and GestureControlSlotConfig. |
Features
Scenario overview
AliPlayerKit has five built-in scene types that cover most playback requirements:
Scenario | Enumeration value | Description | Applicable business | Differences from VOD |
VOD |
| Default scenario. Supports all control capabilities. | Standard VOD, courses, Media Library | — |
Live |
| Real-time stream with no fixed duration. Timeline operations are automatically disabled. | Live streaming, sports events, E-commerce live streaming | Disables progress seeking and playback speed adjustment. Hides the thumbnail. |
Video List |
| Disables vertical gestures to avoid conflicts with list scrolling. | Feeds, short video lists | Disables vertical gestures for volume and brightness. |
Restricted Playback |
| Prevents skipping to ensure users watch the entire video. | Exam monitoring, training courses | Disables progress seeking and playback speed adjustment. Hides the thumbnail. |
Minimal |
| Clean interface. All controls must be implemented separately. | Background playback, fully custom UI | Hides all control components and gestures. |
Enumeration definition
// SceneType.h
typedef NS_ENUM(NSInteger, SceneType) {
/** VOD scenario (default) */
SceneTypeVOD = 0,
/** Live streaming scenario */
SceneTypeLive = 1,
/** Video list or short video stream scenario */
SceneTypeVideoList = 2,
/** Restricted playback scenario */
SceneTypeRestricted = 3,
/** Minimal playback page scenario */
SceneTypeMinimal = 4,
};Scenario capability matrix
Slot visibility
The slot system automatically controls component visibility based on the scene type. The following matrix shows the default rules from DefaultSlotFactory.defaultConfigs:
Slot | VOD | Live | VideoList | Restricted | Minimal |
PlayerSurface | ✓ | ✓ | ✓ | ✓ | ✓ |
GestureControl | ✓ | ✓ | ✓ | ✓ | ✗ |
LandscapeHint | ✓ | ✓ | ✓ | ✓ | ✗ |
Cover | ✓ | ✗ | ✓ | ✗ | ✗ |
CenterDisplay | ✓ | ✓ | ✓ | ✓ | ✗ |
PlayState | ✓ | ✓ | ✓ | ✓ | ✓ |
LogPanel | ✓ | ✓ | ✓ | ✓ | ✗ |
TopBar | ✓ | ✓ | ✓ | ✓ | ✗ |
BottomBar | ✓ | ✓ | ✓ | ✓ | ✗ |
SettingMenu | ✓ | ✓ | ✓ | ✓ | ✗ |
OptionPanel | ✓ | ✓ | ✓ | ✓ | ✗ |
Visibility rule descriptions:
PlayerSurfaceandPlayState: Visible in all scenarios (noexcludedScenesconfiguration).Cover: Not visible in theLive,Restricted, orMinimalscenarios.Other slots (
GestureControl,LandscapeHint,CenterDisplay,LogPanel,TopBar,BottomBar,SettingMenu,OptionPanel): Not visible only in theMinimalscenario.
Gesture behavior differences
The GestureControlSlot internally filters gestures in each handling method based on the currentSceneType:
Gesture | VOD | Live | VideoList | Restricted | Minimal |
Click (Show/Hide control bar) | ✓ | ✓ | ✓ | ✓ | ✗ |
Double-click (Play/Pause) | ✓ | ✓ | ✓ | ✓ | ✗ |
Long press (Fast-forward playback) | ✓ | ✗ | ✓ | ✗ | ✗ |
Horizontal drag (Seek progress) | ✓ | ✗ | ✓ | ✗ | ✗ |
Left vertical drag (Brightness) | ✓ | ✓ | ✗ | ✓ | ✗ |
Right vertical drag (Volume) | ✓ | ✓ | ✗ | ✓ | ✗ |
Filter logic descriptions:
Minimal: All gesture handling methods (
handleSingleTap:,handleDoubleTap:,handleLongPress:, andhandlePan:)returnimmediately at the entry point.Live / Restricted: Long press and horizontal drag are disabled. This is checked in
handleLongPress:andtryStartDragWithCurrentPoint:.VideoList: Vertical drag is disabled. The
tryStartDragWithCurrentPoint:methodreturns immediately when it detectsSceneTypeVideoList.
Usage
Basic usage
You can specify the scene type using the AliPlayerModel.sceneType property. The default is SceneTypeVOD, which you do not need to set explicitly.
VOD scenario (default, no setup required):
VideoSource *source = [VideoSource urlSourceWithUrl:@"https://example.com/video.mp4"];
AliPlayerModel *model = [[AliPlayerModel alloc] initWithVideoSource:source];
// model.sceneType defaults to SceneTypeVOD, no setup required
[controller configure:model];Live streaming scenario:
VideoSource *source = [VideoSource urlSourceWithUrl:@"https://live.example.com/stream.m3u8"];
AliPlayerModel *model = [[AliPlayerModel alloc] initWithVideoSource:source];
model.sceneType = SceneTypeLive;
model.videoTitle = @"Live Channel";
[controller configure:model];Video list scenario:
VideoSource *source = [VideoSource urlSourceWithUrl:@"https://live.example.com/stream.m3u8"];
AliPlayerModel *model = [[AliPlayerModel alloc] initWithVideoSource:source];
model.sceneType = SceneTypeLive;
model.videoTitle = @"live channel";
[controller configure:model];Detailed description of each scenario
VOD - VOD scenario (default)
Scenarios: Standard video playback, online courses, Media Library browsing, and more.
Capabilities:
Supports all 11 default slots
Supports all 6 gestures
Supports progress seeking, playback speed adjustment, and resolution switching
Supports full screen switching
// No need to explicitly specify SceneType, the default is VOD
AliPlayerModel *model = [[AliPlayerModel alloc] initWithVideoSource:source];
model.coverUrl = @"https://example.com/cover.jpg";
model.videoTitle = @"Great Video";
model.autoPlay = YES;
[controller configure:model];Live - Live streaming scenario
Scenarios: Real-time live streaming, live sports events, E-commerce live streaming, and more.
Key differences from VOD:
Disabled: Progress seeking (horizontal gesture) and playback speed adjustment (long press gesture) because live streams do not have a fixed duration.
Hidden: Thumbnail slot because live streams do not need a thumbnail.
Retained: Click/double-click gestures, volume/brightness adjustment.
AliPlayerModel *model = [[AliPlayerModel alloc] initWithVideoSource:liveSource];
model.sceneType = SceneTypeLive;
model.videoTitle = @"Popular Live Stream";
model.autoPlay = YES;
[controller configure:model];VideoList - Video list scenario
Scenarios: Embedded videos in feeds, short video lists, scrollable video collections, and more.
Key differences from VOD:
Disabled: Vertical drag gestures to avoid conflicts with the list's
UIScrollViewscrolling.Retained: All other features, such as progress seeking, playback speed adjustment, and click/double-click/long press gestures.
AliPlayerModel *model = [[AliPlayerModel alloc] initWithVideoSource:source];
model.sceneType = SceneTypeVideoList;
model.autoPlay = YES;
[controller configure:model];Restricted - Restricted playback scenario
Scenarios: Online exam monitoring videos, training and certification courses, copyright protection scenarios, and more.
Key differences from VOD:
Disabled: Progress seeking (horizontal gesture) and playback speed adjustment (long press gesture) to ensure users watch the content completely and in order.
Hidden: Thumbnail slot.
Retained: Click/double-click gestures, volume/brightness adjustment.
AliPlayerModel *model = [[AliPlayerModel alloc] initWithVideoSource:source];
model.sceneType = SceneTypeRestricted;
model.videoTitle = @"Security Training Course";
model.autoPlay = YES;
// Usually used with screenshot prevention
model.disableScreenshot = YES;
[controller configure:model];Minimal - Minimal mode
Scenarios: Background playback, fully custom UI, preview thumbnail playback, and more.
Key differences from VOD:
Hidden: Almost all UI control slots. Only
PlayerSurfaceandPlayStateare retained.Disabled: All gestures. The
GestureControlslot is not visible in the Minimal scenario, and its internal gesture handling methods allreturnimmediately.Use cases: Scenarios that require a fully custom playback control UI.
AliPlayerModel *model = [[AliPlayerModel alloc] initWithVideoSource:source];
model.sceneType = SceneTypeMinimal;
[controller configure:model];
// All controls must be implemented using the controller's API
// For example: [controller play]; [controller pause]; [controller seekTo:position];Custom development
Fine-tuning slot visibility
If the preset slot visibility for a scenario does not meet your requirements, you can fine-tune it using SlotConfig:
// Example: Hide the TopBar in the Live scenario
SlotConfig *topBarConfig = [SlotConfig configWithSlotType:SlotTypeTopBar
excludedScenes:[NSSet setWithObjects:
@(SceneTypeMinimal),
@(SceneTypeLive), nil]];
// Register with SlotManager (overwrites the default SlotConfig for this slot type)
[playerView.slotManager registerSlotConfig:topBarConfig];You can also hide an entire slot directly using hideSlot:. This method does not depend on the scenario:
// Unconditionally hide the TopBar (requires calling rebuildSlots to take effect)
[playerView.slotManager hideSlot:SlotTypeTopBar];registerSlotConfig: provides scene-level visibility control, while hideSlot: provides slot-level visibility control. They work independently. A slot is built only if it passes both checks.
Fine-tuning gesture behavior
Gesture control supports two methods for fine-tuning:
Method 1: Disable specific gestures using the SlotManager element bitmask API. This is the recommended method. You must configure it before the attach call.
// Disable long press for fast-forward in the VOD scenario
[playerView.slotManager hideElements:GestureElementLongPress
forSlot:SlotTypeGestureControl];Method 2: Control gestures directly using GestureControlSlotConfig. You must retrieve the slot instance after the attach call:
// Get the gesture control slot instance
GestureControlSlot *gestureSlot = (GestureControlSlot *)[playerView.slotManager slotViewForType:SlotTypeGestureControl];
// Modify the configuration (takes effect immediately)
GestureControlSlotConfig *config = [GestureControlSlotConfig defaultConfig];
config.longPressEnabled = NO;
config.horizontalDragEnabled = NO;
gestureSlot.config = config;The two methods work independently. The element bitmask is applied when the slot is built (during the setupContentView phase). GestureControlSlotConfig takes effect dynamically at runtime.
Registering custom slots in the Minimal scenario
In the Minimal scenario, most default slots are excluded by the scene configuration. To restore a slot, you can override its SlotConfig:
AliPlayerModel *model = [[AliPlayerModel alloc] initWithVideoSource:source];
model.sceneType = SceneTypeMinimal;
// Override the scene configuration for BottomBar to remove the Minimal exclusion rule
[playerView.slotManager registerSlotConfig:
[SlotConfig configWithSlotType:SlotTypeBottomBar]]; // No excludedScenes = visible in all scenarios
[controller configure:model];Dynamic visibility conditions
You can use the SlotConfig visibilityCondition callback to implement dynamic control at runtime:
SlotConfig *coverConfig = [SlotConfig configWithSlotType:SlotTypeCover
excludedScenes:nil
visibilityCondition:^BOOL{
// Show the cover slot only if a cover URL exists
return model.coverUrl != nil;
}];
[playerView.slotManager registerSlotConfig:coverConfig];The isVisibleInScene: method first checks excludedScenes. If a match is found, the slot is not visible. The method then checks visibilityCondition. If this callback returns NO, the slot is not visible. A slot is visible only if it passes both checks.
Scene selection guide
Decision flow
Do you need a player control UI?
├── No → SceneTypeMinimal
└── Yes → Is it a live stream?
├── Yes → SceneTypeLive
└── No → Is the player embedded in a scrollable list?
├── Yes → SceneTypeVideoList
└── No → Do you need to prevent users from skipping?
├── Yes → SceneTypeRestricted
└── No → SceneTypeVOD (default)Scene selection summary table
Business requirement | Recommended scenario | Key reasons |
Standard video playback |
| Default scenario, full feature support |
Live stream / Real-time sports event |
| Automatically disables progress operations that are not applicable |
Video embedded in UIScrollView |
| Automatically avoids vertical gesture conflicts |
Training / Exam / Copyright protection |
| Automatically disables skipping and playback speed adjustment |
Fully custom UI |
| Clean canvas with zero built-in UI interference |
Background / Picture-in-Picture (PiP) playback |
| No UI control components needed |
API quick reference
SceneType enumeration
Enumeration value | Integer value | Description |
| 0 | VOD scenario (default) |
| 1 | Live streaming scenario |
| 2 | Video list/short video stream scenario |
| 3 | Restricted playback scenario |
| 4 | Minimal playback page scenario |
SlotConfig
Method / Property | Description |
| Creates a configuration with no excluded scenes (visible in all scenarios) |
| Creates a configuration with specified excluded scenes |
| Creates a configuration with excluded scenes and a dynamic condition |
| Slot type ( |
| Set of excluded scenes, |
| Dynamic visibility condition block ( |
| Checks if the slot is visible in a specified scenario |
GestureControlSlotConfig
Property | Type | Default value | Description |
|
|
| Enables or disables the click gesture |
|
|
| Enables or disables the double-click gesture |
|
|
| Enables or disables the long press gesture |
|
|
| Enables or disables the horizontal drag gesture |
|
|
| Enables or disables the left vertical drag gesture |
|
|
| Enables or disables the right vertical drag gesture |
| Class method | — | Creates a default configuration with all gestures enabled |
SlotManager scenario-related APIs
Method | Description |
| Registers a scene visibility configuration for a slot type (overwrites the default configuration) |
| Removes the scene configuration for a specified slot type (becomes visible by default after removal) |
| Gets the scene visibility configuration for a specified slot type |
| Hides a specified slot (slot-level, independent of scene configuration) |
| Shows a previously hidden slot |
| Hides elements within a slot or disables gestures using a bitmask |
| Shows elements within a slot or enables gestures using a bitmask |
| Gets the view instance of a mounted slot |
| Rebuilds all slots (must be called after a scene configuration change) |
Related files
File | Description |
| SceneType enumeration definition |
| Entry point for setting the scene type ( |
| Slot visibility configuration |
| Default slot provider and scene visibility rules |
| Unified management entry point for the slot system |
| Gesture element bitmask definitions |
| Gesture control slot and |
| Slot base class ( |
For more information, see the API Reference.
Best practices
Notes
Item | Description |
Determine at creation | Specify SceneType when creating |
Prioritize the list scenario | Always use |
Minimal requires manual control | After selecting Minimal, the developer must implement all playback controls using the |
Composable fine-tuning | If the preset behavior does not fully meet your needs, you can perform further fine-tuning using |
Live and Restricted have similar behavior | Their gesture filtering rules are the same (disabling progress seeking and playback speed adjustment). The differences are only in thumbnail visibility (hidden in both) and business semantics. |
FAQ
What is the difference between VOD and VideoList?
The main difference is the vertical gesture. SceneTypeVideoList disables vertical gestures for volume and brightness to avoid conflicts with the scroll gesture of the list container. Other features are the same as in VOD.
How do I implement custom controls in the Minimal scenario?
You can control playback behavior directly using the AliPlayerController API. You can also register custom slots to override the UI:
AliPlayerModel *model = [[AliPlayerModel alloc] initWithVideoSource:source];
model.sceneType = SceneTypeMinimal;
[controller configure:model];
// Control directly through the controller API
[controller play];
[controller pause];
[controller seekTo:30000]; // Seek to 30 secondsHow do I restore progress seeking in a Live scenario?
If your live streaming scenario supports timeshifting, you can restore the disabled gesture using the element control API of SlotManager:
// Restore the horizontal drag gesture (progress seeking)
[playerView.slotManager showElements:GestureElementHorizontalDrag
forSlot:SlotTypeGestureControl];This method only restores element-level visibility. The scene filtering logic inside GestureControlSlot is hard-coded and cannot be bypassed using showElements:. To fully customize gesture behavior, you can use GestureControlSlotConfig or replace the GestureControlSlot.