bytes static method
- Uint8List bytes, {
- String? checksum,
- VideoPlayerOptions? videoPlayerOptions,
Creates a VideoPlayerController from the provided bytes
.
Implementation
static FutureOr<VideoPlayerController> bytes(
Uint8List bytes, {
String? checksum,
VideoPlayerOptions? videoPlayerOptions,
}) async {
final String hash = checksum ?? sha256.convert(bytes).toString();
final File file = File(
'${(await PlatformUtils.temporaryDirectory).path}/$hash',
);
if (!file.existsSync() || file.lengthSync() != bytes.length) {
file.writeAsBytesSync(bytes);
}
return VideoPlayerController.file(
file,
videoPlayerOptions: videoPlayerOptions,
);
}