@Override
 public void onPause() {
   super.onPause();
   if (!enableBackgroundAudio) {
     releasePlayer();
   } else {
     player.setBackgrounded(true);
   }
   shutterView.setVisibility(View.VISIBLE);
 }
 @Override
 public void onAudioCapabilitiesChanged(AudioCapabilities audioCapabilities) {
   if (player == null) {
     return;
   }
   boolean backgrounded = player.getBackgrounded();
   boolean playWhenReady = player.getPlayWhenReady();
   releasePlayer();
   preparePlayer(playWhenReady);
   player.setBackgrounded(backgrounded);
 }
 @Override
 public void onResume() {
   super.onResume();
   Intent intent = getIntent();
   contentUri = intent.getData();
   contentType =
       intent.getIntExtra(
           CONTENT_TYPE_EXTRA,
           inferContentType(contentUri, intent.getStringExtra(CONTENT_EXT_EXTRA)));
   contentId = intent.getStringExtra(CONTENT_ID_EXTRA);
   configureSubtitleView();
   if (player == null) {
     preparePlayer(true);
   } else {
     player.setBackgrounded(false);
   }
 }