customThumbnail method
Customizing static JPG thumbnails on the fly
Documentation: https://developers.cloudflare.com/stream/viewing-videos/displaying-thumbnails/#use-case-1-generating-a-thumbnail-on-the-fly
Implementation
String customThumbnail({
/// Start time from the video
///
/// Default value: 0s
///
/// e.g: 8m, 5m2s
String? time,
/// Width of the thumbnail
///
/// Default value: 640
int? width,
/// Height of the thumbnail
///
/// Default value: 640
int? height,
/// Clarifies what to do when requested width and height doesn't match the
/// original upload, which should be one of [ThumbnailFit] enum values
///
/// Default value: crop
///
/// e.g: scale
ThumbnailFit? fit,
}) =>
Uri.parse(customAccountSubdomainUrl ?? videoDeliveryUrl).replace(
path: '/$id/thumbnails/thumbnail.jpg',
queryParameters: {
if (time != null) Params.time: time.toString(),
if (width != null) Params.width: width.toString(),
if (height != null) Params.height: height.toString(),
if (fit != null) Params.fit: fit.name,
},
).toString();