TTVideoEngineVideoModelSource.init constructor

TTVideoEngineVideoModelSource.init({
  1. required String vid,
  2. TTVideoEngineResolutionType? resolution,
  3. List<PlayInfoListItem>? playInfoList,
  4. double? duration,
  5. String? jsonModel,
})

Create TTVideoEngineVideoModelSource instance, data is passed to native layer in JSON format

vid - Video id, required resolution - Default video resolution, required playInfoList - Video play info list, required duration - Video duration in seconds, optional jsonModel - Video json model, usually from GetPlayInfo API, use the Result of GetPlayInfo API response, optional

Returns TTVideoEngineVideoModelSource instance that can be serialized to JSON and passed to native layer through unified interface

Implementation

factory TTVideoEngineVideoModelSource.init({
  required String vid,
  TTVideoEngineResolutionType? resolution,
  List<PlayInfoListItem>? playInfoList,
  double? duration,
  String? jsonModel,
}) {
  if (vid.isEmpty) {
    throw Exception('vid must be valid');
  }

  return TTVideoEngineVideoModelSource(
    vid: vid,
    duration: duration,
    resolution: resolution,
    playInfoList: playInfoList,
    jsonModel: jsonModel,
  );
}