fromMap static method

EmbedInfo fromMap(
  1. Map<Object?, Object?> embedInfo
)

Implementation

static EmbedInfo fromMap(Map<Object?, Object?> embedInfo) {
  final bool offline =
      embedInfo["offline"] != null ? embedInfo["offline"] as bool : false;
  final String? otp = embedInfo["otp"] as String?;
  final String? playbackInfo = embedInfo["playbackInfo"] as String?;
  final String? token = embedInfo["token"] as String?;
  final String? mediaId = embedInfo["mediaId"] as String?;
  final String? mediaUrl = embedInfo["mediaUrl"] as String?;
  final String? licenseUrl = embedInfo["licenseUrl"] as String?;

  final Map<Object?, Object?> embedInfoOptionsMap =
      embedInfo["embedInfoOptions"] as Map<Object?, Object?>;

  final String? preferredCaptionsLanguage =
      embedInfoOptionsMap["preferredCaptionsLanguage"] as String?;
  final Duration? startTimeMs = embedInfoOptionsMap["startTimeMs"] != null
      ? Duration(milliseconds: embedInfoOptionsMap["startTimeMs"] as int)
      : null;
  final Duration? endTimeMs = embedInfoOptionsMap["endTimeMs"] != null
      ? Duration(milliseconds: embedInfoOptionsMap["endTimeMs"] as int)
      : null;
  final Duration? resumeTimeMs = embedInfoOptionsMap["resumeTimeMs"] != null
      ? Duration(milliseconds: embedInfoOptionsMap["resumeTimeMs"] as int)
      : null;
  final int? maxVideoBitrateKbps =
      embedInfoOptionsMap["maxVideoBitrateKbps"] != null
          ? embedInfoOptionsMap["maxVideoBitrateKbps"] as int?
          : null;
  final bool disableAnalytics =
      embedInfoOptionsMap["disableAnalytics"] != null
          ? embedInfoOptionsMap["disableAnalytics"] as bool
          : false;
  final bool allowAdbDebugging =
      embedInfoOptionsMap["allowAdbDebugging"] != null
          ? embedInfoOptionsMap["allowAdbDebugging"] as bool
          : false;
  final bool autoplay = embedInfoOptionsMap["autoplay"] != null
      ? embedInfoOptionsMap["autoplay"] as bool
      : false;
  final bool forceLowestBitrate =
      embedInfoOptionsMap["forceLowestBitrate"] != null
          ? embedInfoOptionsMap["forceLowestBitrate"] as bool
          : false;
  final bool forceHighestSupportedBitrate =
      embedInfoOptionsMap["forceHighestSupportedBitrate"] != null
          ? embedInfoOptionsMap["forceHighestSupportedBitrate"] as bool
          : false;
  final String? customPlayerId = embedInfoOptionsMap["customPlayerId"] != null
      ? embedInfoOptionsMap["customPlayerId"] as String?
      : null;
  final List<Object?> techOverride =
      embedInfoOptionsMap["techOverride"] as List<Object?>;
  final Map<Object?, Object?>? configMap =
      embedInfoOptionsMap["configMap"] != null
          ? embedInfoOptionsMap["configMap"] as Map<Object?, Object?>?
          : null;

  EmbedInfoOptions embedInfoOptions = EmbedInfoOptions(
      preferredCaptionsLanguage: preferredCaptionsLanguage,
      startPosition: startTimeMs,
      endPosition: endTimeMs,
      resumePosition: resumeTimeMs,
      maxVideoBitrateKbps: maxVideoBitrateKbps,
      disableAnalytics: disableAnalytics,
      allowAdbDebugging: allowAdbDebugging,
      autoplay: autoplay,
      forceLowestBitrate: forceLowestBitrate,
      forceHighestSupportedBitrate: forceHighestSupportedBitrate,
      customPlayerId: customPlayerId,
      techOverride: techOverride,
      configMap: configMap);

  return EmbedInfo(
      offline: offline,
      otp: otp,
      playbackInfo: playbackInfo,
      token: token,
      mediaId: mediaId,
      embedInfoOptions: embedInfoOptions,
      mediaUrl: mediaUrl,
      licenseUrl: licenseUrl);
}