buildVideoPlayerController static method

VideoPlayerController? buildVideoPlayerController(
  1. dynamic value
)

根据 value 不同的值 转换不同的 VideoPlayerController

Implementation

static VideoPlayerController? buildVideoPlayerController(dynamic value) {
  if (value != null) {
    if (value is String && value.startsWith('http')) {
      return VideoPlayerController.network(value);
    } else if (value is File) {
      return VideoPlayerController.file(value);
    } else if (value is String) {
      return VideoPlayerController.asset(value);
    }
  }
  return null;
}