AliPlayerWidgetData constructor
AliPlayerWidgetData({
- SceneType sceneType = SceneType.vod,
- required VideoSource? videoSource,
- AndroidViewType androidViewType = AndroidViewType.defaultValue,
- String coverUrl = "",
- String videoTitle = "",
- String thumbnailUrl = "",
- String externalSubtitleUrl = "",
- bool autoPlay = true,
- String traceId = "",
- int startTime = 0,
- int seekMode = FlutterAvpdef.ACCURATE,
- bool allowedScreenSleep = false,
- bool isHardWareDecode = true,
- SubtitleConfig subtitleConfig = const SubtitleConfig(),
- SubtitleBuilder? subtitleBuilder,
- OnPlayerConfigCallback? onPlayerConfig,
构造函数,用于创建 AliPlayerWidgetData 实例。
Constructor to create an instance of AliPlayerWidgetData.
参数:
sceneType:视频场景类型,默认为点播(VOD)。androidViewType:Android 播放器视图类型,默认为 AndroidViewType.defaultValue。coverUrl:视频封面图片地址,默认为空字符串。videoTitle:视频标题,默认为空字符串。thumbnailUrl:视频缩略图地址,默认为空字符串。autoPlay:是否自动播放,默认为 true。traceId:用于跟踪视频播放的 ID,默认为空字符串。startTime:视频起始播放时间(秒),必须为非负数,默认为 0。seekMode:视频跳转模式,默认为精确跳转。allowedScreenSleep:是否允许屏幕休眠,默认为 false。isHardWareDecode:是否开启硬解码,默认为true。subtitleConfig:字幕配置,默认为默认配置。subtitleBuilder:字幕构建器,可以为空。onPlayerConfig:播放器自定义配置回调,在 prepare() 前调用,可以为空。
Parameters:
sceneType: The type of video scene, defaulting to Video On Demand (VOD).- videoSource: Video source object defining the playback source (required).
androidViewType: Android player view type, defaults to AndroidViewType.defaultValue.coverUrl: The URL of the cover image for the video, defaulting to an empty string.videoTitle: The title of the video, defaulting to an empty string.thumbnailUrl: The URL of the thumbnail image for the video, defaulting to an empty string.externalSubtitleUrl: The URL of the external subtitle for the video, defaulting to an empty string.autoPlay: Whether to autoplay the video, defaulting to true.traceId: The ID used to track video playback, defaulting to an empty string.startTime: The start time of video playback in seconds, must be non-negative, defaulting to 0.seekMode: The seek mode for video playback, defaulting to accurate seeking.allowedScreenSleep: Whether to allow screen sleep, default is false.isHardWareDecode: Whether to enable hardwareDecoder , default is true.subtitleConfig: Subtitle configuration, default is default configuration.subtitleBuilder: Subtitle builder, can be null.onPlayerConfig: Player custom configuration callback, called before prepare(), can be null.
Implementation
AliPlayerWidgetData({
this.sceneType = SceneType.vod,
required this.videoSource,
this.androidViewType = AndroidViewType.defaultValue,
this.coverUrl = "",
this.videoTitle = "",
this.thumbnailUrl = "",
this.externalSubtitleUrl = "",
this.autoPlay = true,
this.traceId = "",
this.startTime = 0,
this.seekMode = FlutterAvpdef.ACCURATE,
this.allowedScreenSleep = false,
this.isHardWareDecode = true,
this.subtitleConfig = const SubtitleConfig(),
this.subtitleBuilder,
this.onPlayerConfig,
}) : assert(startTime >= 0, "Start time must be non-negative");