customAnimatedThumbnail method
Customizing animated GIF thumbnails on the fly
Documentation: https://developers.cloudflare.com/stream/viewing-videos/displaying-thumbnails/#use-case-3-generating-animated-thumbnails
Implementation
String customAnimatedThumbnail({
/// 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,
/// Start time from the video
///
/// Default value: 5s
///
/// e.g: 1m, 5s
String? duration,
/// Frames per second for the GIF
///
/// Min value: 1
/// Max value: 15
/// Default value: 8
int? fps,
}) =>
Uri.parse(customAccountSubdomainUrl ?? videoDeliveryUrl).replace(
path: '/$id/thumbnails/thumbnail.gif',
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,
if (duration != null) Params.duration: duration.toString(),
if (fps != null) Params.fps: fps.toString(),
},
).toString();