generatePlayUrl method

Future<String> generatePlayUrl({
  1. required Datum content,
  2. required PackageModel packageModel,
  3. required PlayState playState,
})

Implementation

Future<String> generatePlayUrl(
    {required Datum content,
    required PackageModel packageModel,
    required PlayState playState}) async {
  bool isDrm = false;
  if (packageModel.drmscheme![0].toString() != "NONE") {
    isDrm = true;
  }
  if (playState.buttonState == PlayButtonState.clearLead) {
    isDrm = false;
  }
  var params = await generateWebParams(content, packageModel,
      isDrm: isDrm, playState: playState);
  String encodedString = jsonEncode(params);
  encodedString = encodedString.replaceAll("&", "and");
  if (kDebugMode) {
    print("Web params $encodedString");
  }

  String playerUrl = "${Uri.base.origin}/player.html?data=$encodedString";
  return playerUrl;
}