toSourceDescription function

SourceDescription toSourceDescription(
  1. SourceDescription flutterSourceDescription
)

Implementation

SourceDescription toSourceDescription(PlatformInterface.SourceDescription flutterSourceDescription) {
  List<TypedSource> flutterTypedSources = [];

  for (var flutterTypedSource in flutterSourceDescription.sources) {
    if (flutterTypedSource == null) {
      continue;
    }

    FairplayContentProtectionConfiguration? flutterFairplayDrmConfiguration;
    PlatformInterface.FairPlayDRMConfiguration? faiplay = flutterTypedSource.drm?.fairplay;
    if (faiplay != null) {
      flutterFairplayDrmConfiguration = FairplayContentProtectionConfiguration(licenseAcquisitionURL: faiplay.licenseAcquisitionURL, certificateURL: faiplay.certificateURL);
    }

    WidevineContentProtectionConfiguration? flutterWidevineDrmConfiguration;
    PlatformInterface.WidevineDRMConfiguration? widevine = flutterTypedSource.drm?.widevine;
    if (widevine != null) {
      flutterWidevineDrmConfiguration = WidevineContentProtectionConfiguration(licenseAcquisitionURL: widevine.licenseAcquisitionURL);
    }

    flutterTypedSources.add(TypedSource(src: flutterTypedSource.src, contentProtection: ContentProtection(fairplay: flutterFairplayDrmConfiguration, widevine: flutterWidevineDrmConfiguration)));
  }

  return SourceDescription(sources: flutterTypedSources);
}