getSubtitleTrackInfo method
This interface is only supported by the premium version of the player (Player_Premium), and you need to purchase the premium version of the player mobile license. Returns the subtitle track information list
此接口仅播放器高级版本(Player_Premium)支持,需要购买播放器移动端高级版 License 返回字幕轨道信息列表
Implementation
Future<List<TXTrackInfo>> getSubtitleTrackInfo() async {
if (_isNeedDisposed) return [];
await _initPlayer.future;
ListMsg listMsg = await _vodPlayerApi.getSubtitleTrackInfo(PlayerMsg(playerId: _playerId));
if (null != listMsg.value) {
List<dynamic>? transInfoData = listMsg.value!;
List<TXTrackInfo> trackInfoList = [];
for (Map<dynamic, dynamic> map in transInfoData) {
TXTrackInfo trackInfo = TXTrackInfo(map["name"], map["trackIndex"], map["trackType"]);
trackInfo.isSelected = map["isSelected"] ?? false;
trackInfo.isExclusive = map["isExclusive"] ?? true;
trackInfo.isInternal = map["isInternal"] ?? true;
trackInfoList.add(trackInfo);
}
return trackInfoList;
}
return [];
}