buildVideoPlayer method
Builds VideoPlayer.
Implementation
Widget buildVideoPlayer(
BuildMetadata meta,
String url, {
bool autoplay,
bool controls,
double height,
bool loop,
String posterUrl,
double width,
}) {
final dimensOk = height != null && height > 0 && width != null && width > 0;
final posterImgSrc = posterUrl != null ? ImageSource(posterUrl) : null;
return VideoPlayer(
url,
aspectRatio: dimensOk ? width / height : 16 / 9,
autoResize: !dimensOk,
autoplay: autoplay,
controls: controls,
loop: loop,
poster: posterImgSrc != null
? buildImage(
meta,
imageProvider(posterImgSrc),
ImageMetadata(sources: [posterImgSrc]),
)
: null,
);
}