DrKLO/Telegram · critical · MediaDrmCallbackException

No license URL

Error message

No license URL

What it means

HttpMediaDrmCallback.executeKeyRequest throws MediaDrmCallbackException (wrapping IllegalStateException('No license URL')) when, after consulting the request's license server URL and falling back to a default license URL, the result is still empty. The DRM callback cannot issue an HTTP key request without a destination, so it fails fast rather than making a request to Uri.EMPTY.

Source

Thrown at TMessagesProj/src/main/java/com/google/android/exoplayer2/drm/HttpMediaDrmCallback.java:137

  public byte[] executeProvisionRequest(UUID uuid, ProvisionRequest request)
      throws MediaDrmCallbackException {
    String url =
        request.getDefaultUrl() + "&signedRequest=" + Util.fromUtf8Bytes(request.getData());
    return executePost(
        dataSourceFactory,
        url,
        /* httpBody= */ null,
        /* requestProperties= */ Collections.emptyMap());
  }

  @Override
  public byte[] executeKeyRequest(UUID uuid, KeyRequest request) throws MediaDrmCallbackException {
    String url = request.getLicenseServerUrl();
    if (forceDefaultLicenseUrl || TextUtils.isEmpty(url)) {
      url = defaultLicenseUrl;
    }
    if (TextUtils.isEmpty(url)) {
      throw new MediaDrmCallbackException(
          new DataSpec.Builder().setUri(Uri.EMPTY).build(),
          Uri.EMPTY,
          /* responseHeaders= */ ImmutableMap.of(),
          /* bytesLoaded= */ 0,
          /* cause= */ new IllegalStateException("No license URL"));
    }
    Map<String, String> requestProperties = new HashMap<>();
    // Add standard request properties for supported schemes.
    String contentType =
        C.PLAYREADY_UUID.equals(uuid)
            ? "text/xml"
            : (C.CLEARKEY_UUID.equals(uuid) ? "application/json" : "application/octet-stream");
    requestProperties.put("Content-Type", contentType);
    if (C.PLAYREADY_UUID.equals(uuid)) {
      requestProperties.put(
          "SOAPAction", "http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense");
    }
    // Add additional request properties.

View on GitHub (pinned to 45ab8f4308)

Solutions

  1. Provide a default license URL to the HttpMediaDrmCallback constructor so the fallback is non-empty.
  2. Ensure the manifest/media embeds a valid license URL (or set it on the DRM InitData).
  3. Set forceDefaultLicenseUrl=true only when a valid default license URL has been configured.

Example fix

// before
callback = new HttpMediaDrmCallback(""); // no default

// after
HttpMediaDrmCallback callback =
    new HttpMediaDrmCallback("https://license.example.com/acquire", httpDataSourceFactory);
Defensive patterns

Strategy: validation

Validate before calling

// ensure a usable license URL exists before key request
String url = forceDefault ? defaultLicenseUrl : request.getLicenseServerUrl();
if (TextUtils.isEmpty(url)) url = defaultLicenseUrl;
if (TextUtils.isEmpty(url)) throw new IllegalStateException("configure a license URL");

Try / catch

try { callback.executeKeyRequest(uuid, request); }
catch (MediaDrmCallbackException e) { /* surface to user; prompt for license config */ }

Prevention

When it happens

Trigger: KeyRequest.getLicenseServerUrl() returns empty AND forceDefaultLicenseUrl is false (or the default URL is also empty), so no usable license server remains.

Common situations: DASH/HLS/SmoothStreaming manifest or MediaDrm config missing a license URL; the server-side key request does not embed a license URL and the app did not set a default via the HttpMediaDrmCallback constructor; forceDefaultLicenseUrl left false while defaultLicenseUrl is empty.

Related errors


AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14). Data as JSON: /api/errors/ed83d62917ba8679. Report an issue: GitHub.