toJsSources static method
List<Map<String, dynamic> >
toJsSources(
- List<
ByteArkPlayerSource> sources, { - ByteArkPlayerItem? item,
Maps sources to the JS sources array. Throws ArgumentError
on an empty list (callers are expected to validate earlier).
When item is non-null, its title, subtitle, mediaId, and
posterImage are merged onto every emitted source as the SDK
fields title, subtitle, videoId, and poster respectively
(non-null, non-empty values only — empty strings are skipped).
See the class dartdoc for the rationale.
The output ordering puts every Widevine source before every non-Widevine source (non-DRM + FairPlay). Within each group the caller's original relative order is preserved.
Implementation
static List<Map<String, dynamic>> toJsSources(
List<ByteArkPlayerSource> sources, {
ByteArkPlayerItem? item,
}) {
if (sources.isEmpty) {
throw ArgumentError.value(
sources,
'sources',
'WebSourcesMapper requires at least one source.',
);
}
return _reorderWidevineFirst(sources)
.map((s) => _mapOne(s, item: item))
.toList(growable: false);
}