private void a(AVPlayer aVPlayer, Dimensions dimensions) {
   int density = (int) (-99999.0f * this.a.getDensity());
   if (aVPlayer.isInlineVideo()) {
     LayoutParams layoutParams = new FrameLayout.LayoutParams(dimensions.width, dimensions.height);
     FrameLayout.LayoutParams layoutParams2 =
         (FrameLayout.LayoutParams) aVPlayer.getLayoutParams();
     if (dimensions.x == density && dimensions.y == density) {
       layoutParams.leftMargin = layoutParams2.leftMargin;
       layoutParams.topMargin = layoutParams2.topMargin;
     } else {
       layoutParams.leftMargin = dimensions.x;
       layoutParams.topMargin = dimensions.y;
     }
     layoutParams.gravity = 3;
     aVPlayer.setLayoutParams(layoutParams);
   }
 }
 public void onComplete(AVPlayer aVPlayer) {
   try {
     ViewGroup viewGroup;
     if (this.a.isFullScreen()) {
       viewGroup = (ViewGroup) aVPlayer.getBackGroundLayout().getParent();
       if (viewGroup != null) {
         viewGroup.removeView(aVPlayer.getBackGroundLayout());
       }
     } else {
       viewGroup = (ViewGroup) aVPlayer.getParent();
       if (viewGroup != null) {
         viewGroup.removeView(aVPlayer);
       }
     }
   } catch (Exception e) {
     Log.debug(Constants.RENDERING_LOG_TAG, "Problem removing the audio relativelayout", e);
   }
 }
 public void hidePlayers() {
   Log.debug(Constants.RENDERING_LOG_TAG, "MRAIDAudioVideoController: hiding all players");
   if (!(this.videoPlayer == null || this.videoPlayer.getState() == playerState.RELEASED)) {
     this.videoPlayerList.put(this.videoPlayer.getPropertyID(), this.videoPlayer);
     this.videoPlayer.hide();
   }
   Iterator it = this.audioPlayerList.entrySet().iterator();
   while (it.hasNext()) {
     Entry entry = (Entry) it.next();
     AVPlayer aVPlayer = (AVPlayer) entry.getValue();
     switch (d.a[aVPlayer.getState().ordinal()]) {
       case GoogleScorer.CLIENT_PLUS:
         aVPlayer.pause();
         break;
       case GoogleScorer.CLIENT_APPSTATE:
         aVPlayer.releasePlayer(false);
         this.audioPlayerList.remove(entry.getKey());
         break;
       default:
         break;
     }
   }
 }
 public void onComplete(AVPlayer aVPlayer) {
   MRAIDAudioVideoController.this.setBusy(false);
   try {
     ViewGroup backGroundLayout = aVPlayer.getBackGroundLayout();
     if (backGroundLayout != null) {
       ((ViewGroup) backGroundLayout.getParent()).removeView(aVPlayer.getBackGroundLayout());
     }
     aVPlayer.setBackGroundLayout(null);
   } catch (Exception e) {
     Log.debug(
         Constants.RENDERING_LOG_TAG,
         "Problem removing the video framelayout or relativelayout depending on video startstyle",
         e);
   }
   synchronized (this) {
     if (MRAIDAudioVideoController.this.videoPlayer != null
         && aVPlayer
             .getPropertyID()
             .equalsIgnoreCase(MRAIDAudioVideoController.this.videoPlayer.getPropertyID())) {
       MRAIDAudioVideoController.this.videoPlayer = null;
     }
   }
 }
 private boolean b(String str, String str2, Activity activity) {
   if ((str2.length() == 0 || URLUtil.isValidUrl(str2))
       && (str2.length() != 0 || this.videoPlayerList.containsKey(str))) {
     if (this.videoPlayer != null) {
       this.videoPlayer.hide();
       this.videoPlayerList.put(this.videoPlayer.getPropertyID(), this.videoPlayer);
     }
     AVPlayer a = a(str);
     if (a == null) {
       this.videoPlayer = new AVPlayer(activity, this.a);
     } else {
       this.videoPlayer = a;
     }
     if (str2.length() == 0) {
       this.videoPlayer.setPlayData(a.getProperties(), a.getMediaURL());
       this.videoPlayer.setPlayDimensions(a.getPlayDimensions());
     }
     this.videoPlayerList.remove(str);
     return true;
   } else {
     this.a.raiseError("Request must specify a valid URL", "playVideo");
     return false;
   }
 }