2

I am trying to play Widevine encrypted content on an Android TV application using Exoplayer. I have my video URL which is served from a CDN and acquired with a ticket. I have my widevine license URL, a ticket and a auth token for the license server.

I am creating a drmSessionManager, putting the necessary headers needed by the license server as follows:

UUID drmSchemeUuid = C.WIDEVINE_UUID;
mediaDrm = FrameworkMediaDrm.newInstance(drmSchemeUuid);
static final String USER_AGENT = "user-agent";
    HttpMediaDrmCallback drmCallback = new HttpMediaDrmCallback("my-license-server", new DefaultHttpDataSourceFactory(USER_AGENT));
keyRequestProperties.put("ticket-header", ticket);
keyRequestProperties.put("token-header", token);
drmCallback.setKeyRequestProperty("ticket-header", ticket);
drmCallback.setKeyRequestProperty("token-header", token);

new DefaultDrmSessionManager(drmSchemeUuid, mediaDrm, drmCallback, keyRequestProperties)

After this Exoplayer handles most of the stuff, the following breakpoints are hit.

response = callback.executeKeyRequest(uuid, (KeyRequest) request);
in class DefaultDrmSession
return executePost(dataSourceFactory, url, request.getData(), requestProperties) in HttpMediaDrmCallback

I can observe that everything is fine till this point, the URL is correct, the headers are set fine.

in the following piece of code, I can observe that the dataSpec is fine, trying to POST a request to the license server with the correct data, but when making the connection the response code returns 405.

in class : DefaultHttpDataSource

in method : public long open(DataSpec dataSpec)

 this.dataSpec = dataSpec;
 this.bytesRead = 0;
 this.bytesSkipped = 0;
 transferInitializing(dataSpec);
try {
      connection = makeConnection(dataSpec);
    } catch (IOException e) {
      throw new HttpDataSourceException("Unable to connect to " + dataSpec.uri.toString(), e,
          dataSpec, HttpDataSourceException.TYPE_OPEN);
    }
try {
      responseCode = connection.getResponseCode();
      responseMessage = connection.getResponseMessage();
    } catch (IOException e) {
      closeConnectionQuietly();
      throw new HttpDataSourceException("Unable to connect to " + dataSpec.uri.toString(), e,
          dataSpec, HttpDataSourceException.TYPE_OPEN);
    }

When using postman to make a request to the URL, a GET request returns the following body with a response code of 405.

{ "Message": "The requested resource does not support http method 'GET'." }

a POST request also returns response code 405 but returns an empty body.

In both cases the following header is also returned, which I suppose the request must be accepting GET and POST requests.

Access-Control-Allow-Methods →GET, POST

I have no access to the configuration of the DRM server, and my contacts which are responsible of the DRM server tells me that POST requests must be working fine since there are clients which have managed to get the content to play from the same DRM server.

I am quite confused at the moment and think maybe I am missing some sort of configuration in exoplayer since I am quite new to the concept of DRMs.

Any help would be greatly appreciated.

Breiby
  • 554
  • 5
  • 14
Evren U
  • 51
  • 1
  • 7
  • What video type is the content you are attempting to fetch? – Breiby May 09 '19 at 08:30
  • Hello Benjamin, I am trying to get a DASH video. Though I am getting it from a CDN, the URL doesnt end in mpd if that makes any difference. – Evren U May 09 '19 at 09:37
  • You might want to look into using a `DashMediaSource` instead of `DefaultHttpDataSource` then. The rest of your code looks correct. – Breiby May 09 '19 at 10:17
  • The HttpMediaDrmCallback constructor doesn't support those MediaSources(I mean the media sources for SS, HLS and DASH), I prepare the MediaSource somewhere else and pass it to the player. And it is prepared according to the video format. – Evren U May 09 '19 at 12:09
  • I misunderstood and thought you were sending a DefaultHttpDataSource to the player. Never mind then. – Breiby May 09 '19 at 12:25
  • No worries! Thanks for the help though :) – Evren U May 09 '19 at 13:57

1 Answers1

1

We figured out the solution. The ticket supplied for the DRM license server was wrong. This works as it is supposed to now and the content is getting played. Just in case anyone somehow gets the same problem or is in need of a basic Widevine content playing code, this works fine at the moment.

Best regards.

Evren U
  • 51
  • 1
  • 7