currentTrack method

Future<AVPTrackInfo?> currentTrack(
  1. TrackType trackIdx
)

获取当前播放track

TrackType trackInfo 的类型

Implementation

Future<AVPTrackInfo?> currentTrack(TrackType trackIdx) async {
  try {
    dynamic result = await FlutterAliPlayerFactory.methodChannel.invokeMethod(
        "getCurrentTrack", wrapWithPlayerId(arg: trackIdx.index));
    if (null != result && result is Map) {
      Map<dynamic, dynamic> resultMap = result;
      return AVPTrackInfo.fromJson(resultMap);
    }
    return null;
  } on PlatformException catch (e) {
    // throw Exception("数据获取异常 ${e.message}");
    return null;
  }
}