AliPlayerWidgetData.fromUrl constructor

AliPlayerWidgetData.fromUrl({
  1. required String videoUrl,
  2. SceneType sceneType = SceneType.vod,
  3. String coverUrl = "",
  4. String videoTitle = "",
  5. String thumbnailUrl = "",
  6. bool autoPlay = true,
  7. int startTime = 0,
  8. int seekMode = FlutterAvpdef.ACCURATE,
  9. bool allowedScreenSleep = false,
  10. bool isHardWareDecode = true,
})

使用URL创建播放器数据的便捷构造函数

Convenience constructor to create player data using a URL

Implementation

factory AliPlayerWidgetData.fromUrl({
  required String videoUrl,
  SceneType sceneType = SceneType.vod,
  String coverUrl = "",
  String videoTitle = "",
  String thumbnailUrl = "",
  bool autoPlay = true,
  int startTime = 0,
  int seekMode = FlutterAvpdef.ACCURATE,
  bool allowedScreenSleep = false,
  bool isHardWareDecode = true,
}) {
  return AliPlayerWidgetData(
    videoSource: VideoSourceFactory.createUrlSource(videoUrl),
    sceneType: sceneType,
    coverUrl: coverUrl,
    videoTitle: videoTitle,
    thumbnailUrl: thumbnailUrl,
    autoPlay: autoPlay,
    startTime: startTime,
    seekMode: seekMode,
    allowedScreenSleep: allowedScreenSleep,
    isHardWareDecode: isHardWareDecode,
  );
}