addSubtitleSource method

Future<void> addSubtitleSource(
  1. String url,
  2. String name, {
  3. String? mimeType,
})

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. Add external subtitles @param url subtitle address @param name The name of the subtitle. If you add multiple subtitles, please set the subtitle name to a different name to distinguish it from other added subtitles, otherwise it may lead to incorrect subtitle selection. @param mimeType subtitle type, only supports VVT and SRT formats VOD_PLAY_MIMETYPE_TEXT_SRT VOD_PLAY_MIMETYPE_TEXT_VTT Later, you can get the corresponding name through the name in the result returned by getSubtitleTrackInfo

此接口仅播放器高级版本(Player_Premium)支持,需要购买播放器移动端高级版 License 添加外挂字幕 @param url 字幕地址 @param name 字幕的名字。如果添加多个字幕,字幕名称请设置为不同的名字,用于区分与其他添加的字幕,否则可能会导致字幕选择错误。 @param mimeType 字幕类型,仅支持VVT和SRT格式 VOD_PLAY_MIMETYPE_TEXT_SRT VOD_PLAY_MIMETYPE_TEXT_VTT 后面可以通过getSubtitleTrackInfo返回结果中的 name 获取对应的名字

Implementation

Future<void> addSubtitleSource(String url, String name, {String? mimeType}) async {
  if (_isNeedDisposed) return;
  await _initPlayer.future;
  await _vodPlayerApi.addSubtitleSource(SubTitlePlayerMsg(url: url, name: name, mimeType: mimeType)..playerId = _playerId);
}