AliyunPlayer v7.11.0
Aliyun Player API Reference Manual for iOS Platforms
Loading...
Searching...
No Matches
AliVttSubtitleView Class Reference

VTT字幕视图主类 More...

#include "AliVttSubtitleView.h"

Inheritance diagram for AliVttSubtitleView:
<AliVttSubtitleViewProtocol>

Instance Methods

(void) - destroy
 销毁字幕视图,清理所有资源
 
(nullable AliWebVttHeader *) - getVttHeader:
 获取指定轨道的VTT头部信息
 
(void) - hide:trackIndex:subtitleID:
 隐藏字幕
 
(instancetype) - init
 初始化字幕视图
 
(void) - setRenderImplFactory:
 设置自定义渲染实现工厂
 
(void) - setVttHeader:trackIndex:Header:
 设置VTT头部信息
 
(void) - show:trackIndex:subtitleID:subtitle:
 显示字幕
 
- Instance Methods inherited from <AliVttSubtitleViewProtocol>
(void) - clearAll
 清理所有字幕
 
(void) - setView:
 设置显示视图
 

Class Methods

(void) + setConstClass:
 设置全局常量类
 

Properties

BOOL isEnableSubtitleRender
 是否启用字幕渲染 Whether subtitle rendering is enabled
 
AliVttRenderImplFactoryBlock renderFactory
 客户自定义渲染实现工厂 Client custom rendering implementation factory
 
NSMutableDictionary< NSNumber *, AliVttRender * > * renderMap
 轨道索引到渲染器的映射表 Mapping table from track index to renderer
 

Detailed Description

VTT字幕视图主类

字幕系统的入口类,管理多轨道字幕的渲染。 实现AliVttSubtitleViewProtocol协议,与播放器集成。

// 基本使用示例
AliVttSubtitleView *subtitleView = [[AliVttSubtitleView alloc] init];
[player setExternalSubtitleView:subtitleView];
// 自定义渲染实现
[subtitleView setRenderImplFactory:^AliVttRenderImpl*() {
return [[CustomVttRenderImpl alloc] init];
}];
// 自定义常量配置
[AliVttSubtitleView setConstClass:[MySubtitleConst class]];
VTT字幕渲染实现类
Definition AliVttSubtitleView.h:403
VTT字幕视图主类
Definition AliVttSubtitleView.h:899
instancetype init()
初始化字幕视图

Method Documentation

◆ destroy

- (void) destroy

销毁字幕视图,清理所有资源

◆ getVttHeader:

- (nullable AliWebVttHeader *) getVttHeader: (int) trackIndex

获取指定轨道的VTT头部信息

Parameters
trackIndex轨道索引
Returns
WebVttHeader对象,如果未找到或未初始化则返回nil
Note
该方法返回解析后的WebVTT头部信息,包含样式和区域定义

◆ hide:trackIndex:subtitleID:

- (void) hide: (AliPlayer *) player
trackIndex: (int) trackIndex
subtitleID: (long) subtitleID 

隐藏字幕

Parameters
player播放器对象
trackIndex轨道索引
subtitleID字幕ID

◆ init

- (instancetype) init

初始化字幕视图

Returns
初始化的字幕视图实例

◆ setConstClass:

+ (void) setConstClass: (Class) constClass

设置全局常量类

Parameters
constClass常量类的Class对象
Note
静态方法,影响所有实例的默认配置

◆ setRenderImplFactory:

- (void) setRenderImplFactory: (AliVttRenderImplFactoryBlock) factory

设置自定义渲染实现工厂

Parameters
factory渲染实现工厂块
Note
允许客户端提供自定义的渲染逻辑

◆ setVttHeader:trackIndex:Header:

- (void) setVttHeader: (AliPlayer *) player
trackIndex: (int) trackIndex
Header: (NSString *) header 

设置VTT头部信息

Parameters
player播放器对象
trackIndex轨道索引
headerVTT头部字符串

◆ show:trackIndex:subtitleID:subtitle:

- (void) show: (AliPlayer *) player
trackIndex: (int) trackIndex
subtitleID: (long) subtitleID
subtitle: (NSString *) subtitle 

显示字幕

Parameters
player播放器对象
trackIndex轨道索引
subtitleID字幕ID
subtitle字幕内容

Property Documentation

◆ isEnableSubtitleRender

- (BOOL) isEnableSubtitleRender
readwriteatomicassign

是否启用字幕渲染 Whether subtitle rendering is enabled

◆ renderFactory

- (AliVttRenderImplFactoryBlock) renderFactory
readwritenonatomiccopy

客户自定义渲染实现工厂 Client custom rendering implementation factory

◆ renderMap

- (NSMutableDictionary<NSNumber *, AliVttRender *>*) renderMap
readwritenonatomicstrong

轨道索引到渲染器的映射表 Mapping table from track index to renderer


The documentation for this class was generated from the following file: