toFlutterSourceDescription function

SourceDescription? toFlutterSourceDescription(
  1. SourceDescription? sourceDescription
)

Implementation

PlatformInterface.SourceDescription? toFlutterSourceDescription(SourceDescription? sourceDescription) {
  if (sourceDescription == null) {
    return null;
  }

  List<PlatformInterface.TypedSource> typedSources = [];
  for (var typedSource in sourceDescription.sources) {
    PlatformInterface.FairPlayDRMConfiguration? fairPlayDRMConfiguration;
    FairplayContentProtectionConfiguration? fairplay = typedSource.contentProtection?.fairplay;
    if (fairplay != null) {
      fairPlayDRMConfiguration = PlatformInterface.FairPlayDRMConfiguration(licenseAcquisitionURL: fairplay.licenseAcquisitionURL, certificateURL: fairplay.certificateURL);
    }

    PlatformInterface.WidevineDRMConfiguration? widevineDRMConfiguration;
    WidevineContentProtectionConfiguration? widevine = typedSource.contentProtection?.widevine;
    if (widevine != null) {
      widevineDRMConfiguration = PlatformInterface.WidevineDRMConfiguration(licenseAcquisitionURL: widevine.licenseAcquisitionURL);
    }

    typedSources.add(PlatformInterface.TypedSource(src: typedSource.src, drm: PlatformInterface.DRMConfiguration(fairplay: fairPlayDRMConfiguration, widevine: widevineDRMConfiguration)));
  }

  return PlatformInterface.SourceDescription(sources: typedSources);
}