RenderManifest.fromJson constructor

RenderManifest.fromJson(
  1. Map<String, Object?> json
)

Reads a manifest from its toJson form.

Throws a FluvieRenderException when json['schemaVersion'] is not schemaVersion.

Implementation

factory RenderManifest.fromJson(Map<String, Object?> json) {
  final version = json['schemaVersion'];
  if (version != schemaVersion) {
    throw FluvieRenderException(
      'Unsupported render-manifest schemaVersion "$version" (this fluvie '
      'reads version $schemaVersion). The capture and encode sides must run '
      'matching fluvie versions.',
    );
  }
  return RenderManifest(
    width: json['width']! as int,
    height: json['height']! as int,
    fps: json['fps']! as int,
    frameCount: json['frameCount']! as int,
    framesFileName: json['framesFileName']! as String,
    outputFileName: json['outputFileName']! as String,
    renderDigest: json['renderDigest']! as String,
    ffmpegArgs: (json['ffmpegArgs']! as List<Object?>).cast<String>(),
    posterArgs: (json['posterArgs'] as List<Object?>?)?.cast<String>(),
    posterFileName: json['posterFileName'] as String?,
  );
}