getAudioTrackInfo method

Future<List<TXTrackInfo>> getAudioTrackInfo()

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 audio track information list

此接口仅播放器高级版本(Player_Premium)支持,需要购买播放器移动端高级版 License 返回音频轨道信息列表

Implementation

Future<List<TXTrackInfo>> getAudioTrackInfo() async {
  if (_isNeedDisposed) return [];
  await _initPlayer.future;
  ListMsg listMsg = await _vodPlayerApi.getAudioTrackInfo(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 [];
}