registerUrl method

Future<String> registerUrl(
  1. String url, {
  2. Map<String, String>? headers,
})

Registers a URL with the proxy server and returns a local URL to access it

Implementation

Future<String> registerUrl(String url, {Map<String, String>? headers}) async {
  if (!_isRunning) {
    await start();
  }

  // Create unique ID for this video URL
  String videoId = base64Encode(url.codeUnits);
  _proxyMap[videoId] = _ProxyResource(url, headers ?? {});

  // Log to help with debugging
  log('Registered proxy URL for: $url');

  // Always use HTTP for localhost - HTTPS won't work without proper certificates
  return 'http://localhost:$_port/$videoId';
}