get method

Gets the actual closed caption track which is identified by the specified metadata.

Implementation

Future<ClosedCaptionTrack> get(ClosedCaptionTrackInfo trackInfo) async {
  final response =
      await re.ClosedCaptionClient.get(_httpClient, trackInfo.url);

  final captions = [
    for (final e in response.closedCaptions)
      if (!e.text.isNullOrWhiteSpace)
        ClosedCaption(
          e.text,
          e.offset,
          e.duration,
          e.parts.map((f) => ClosedCaptionPart(f.text, f.offset)),
        ),
  ];

  return ClosedCaptionTrack(captions);
}