startVodPlay method

Future<bool> startVodPlay(
  1. String url
)

Starting from version 10.7, the method startPlay has been changed to startVodPlay for playing videos via a URL. To play videos successfully, it is necessary to set the license by using the method SuperPlayerPlugin#setGlobalLicense. Failure to set the license will result in video playback failure (a black screen). Live streaming, short video, and video playback licenses can all be used. If you do not have any of the above licenses, you can apply for a free trial license to play videos normallyQuickly apply for a free trial version Licence (https://cloud.tencent.com/act/event/License).Official licenses can be purchased (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license).

通过url开始播放视频 10.7版本开始,startPlay变更为startVodPlay,需要通过 {@link SuperPlayerPlugin#setGlobalLicense} 设置 Licence 后方可成功播放, 否则将播放失败(黑屏),全局仅设置一次即可。直播 Licence、短视频 Licence 和视频播放 Licence 均可使用,若您暂未获取上述 Licence , 可快速免费申请测试版 Licence 以正常播放,正式版 License 需购买 (https://cloud.tencent.com/document/product/881/74588#.E8.B4.AD.E4.B9.B0.E5.B9.B6.E6.96.B0.E5.BB.BA.E6.AD.A3.E5.BC.8F.E7.89.88-license)。

@param url : 视频播放地址 video playback address return 是否播放成功 if play successfully

Implementation

Future<bool> startVodPlay(String url) async {
  if (_isNeedDisposed) return false;
  await _initPlayer.future;
  _changeState(TXPlayerState.buffering);
  printVersionInfo();
  BoolMsg boolMsg = await _vodPlayerApi.startVodPlay(StringPlayerMsg()
    ..value = url
    ..playerId = _playerId);
  return boolMsg.value ?? false;
}