@Override
 public void onEvent(MediaDrm mediaDrm, byte[] sessionId, int event, int extra, byte[] data) {
   switch (event) {
     case MediaDrm.EVENT_PROVISION_REQUIRED:
       Log.d(TAG, "MediaDrm.EVENT_PROVISION_REQUIRED.");
       MediaDrm.ProvisionRequest request = mMediaDrm.getProvisionRequest();
       PostRequestTask postTask = new PostRequestTask(request.getData());
       postTask.execute(request.getDefaultUrl());
       break;
     case MediaDrm.EVENT_KEY_REQUIRED:
       generateKeyRequest(data, mMimeType);
       break;
     case MediaDrm.EVENT_KEY_EXPIRED:
       onKeyError();
       break;
     case MediaDrm.EVENT_VENDOR_DEFINED:
       assert (false);
       break;
     default:
       Log.e(TAG, "Invalid DRM event " + (int) event);
       return;
   }
 }
 @Override
 public byte[] executeProvisionRequest(UUID uuid, MediaDrm.ProvisionRequest request)
     throws IOException {
   String url = request.getDefaultUrl() + "&signedRequest=" + new String(request.getData());
   return Util.executePost(url, null, null);
 }