getProxyUrl method

String getProxyUrl(
  1. String raw, [
  2. Map<String, String>? extraQueries
])

Gets a proxy url for raw which will be handled by the cache server.

extraQueries will be appended to the generated url, note that query key starts and ends with __ is preserved to carry metadata and will not be appended to the actual video url.

Implementation

String getProxyUrl(String raw, [Map<String, String>? extraQueries]) {
  String? extraQueriesStr;
  if (extraQueries?.isNotEmpty == true) {
    String queryString = extraQueries!.keys.map((key) => '$key=${Uri.encodeComponent(extraQueries[key]!)}').join('&');
    extraQueriesStr = '&$queryString';
  }
  return 'http${securityContext == null ? "" : "s"}://${address!.host}:$port/?__url__=${Uri.encodeComponent(raw)}${extraQueriesStr ?? ""}';
}