导航菜单

页面标题

页面副标题

Vi App v10.18.0 - ExoPlayerFragment.java 源代码

正在查看: Vi App v10.18.0 应用的 ExoPlayerFragment.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.yupptv.ott.player;

import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Looper;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.text.style.ImageSpan;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.CheckedTextView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.mediarouter.app.MediaRouteButton;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
import com.bumptech.glide.request.target.BitmapImageViewTarget;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.transition.Transition;
import com.google.ads.interactivemedia.pal.NonceManager;
import com.google.ads.interactivemedia.pal.NonceRequest;
import com.google.ads.interactivemedia.v3.api.Ad;
import com.google.ads.interactivemedia.v3.api.AdEvent;
import com.google.ads.interactivemedia.v3.api.AdPodInfo;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.DeviceInfo;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.MediaMetadata;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.RenderersFactory;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.Tracks;
import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.drm.DefaultDrmSessionManagerProvider;
import com.google.android.exoplayer2.drm.DrmSessionManagerProvider;
import com.google.android.exoplayer2.ext.ima.ImaAdsLoader;
import com.google.android.exoplayer2.ext.ima.ImaServerSideAdInsertionMediaSource;
import com.google.android.exoplayer2.ext.ima.ImaServerSideAdInsertionUriBuilder;
import com.google.android.exoplayer2.mediacodec.MediaCodecRenderer;
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil;
import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.offline.DownloadRequest;
import com.google.android.exoplayer2.source.BehindLiveWindowException;
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory;
import com.google.android.exoplayer2.source.LoadEventInfo;
import com.google.android.exoplayer2.source.MediaLoadData;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.MediaSourceEventListener;
import com.google.android.exoplayer2.source.MediaSourceFactory;
import com.google.android.exoplayer2.source.TrackGroup;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.source.ads.AdsLoader;
import com.google.android.exoplayer2.text.CueGroup;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.MappingTrackSelector;
import com.google.android.exoplayer2.trackselection.TrackSelectionParameters;
import com.google.android.exoplayer2.u2;
import com.google.android.exoplayer2.ui.PlayerControlView;
import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.ui.SubtitleView;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
import com.google.android.exoplayer2.upstream.HttpDataSource;
import com.google.android.exoplayer2.upstream.LoadErrorHandlingPolicy;
import com.google.android.exoplayer2.util.Util;
import com.google.android.exoplayer2.video.VideoSize;
import com.google.android.gms.cast.framework.CastButtonFactory;
import com.google.android.gms.cast.framework.CastContext;
import com.google.android.gms.cast.framework.CastStateListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.UnmodifiableIterator;
import com.google.gson.JsonObject;
import com.yupptv.analytics.plugin.YuppAnalytics;
import com.yupptv.analytics.plugin.utils.AdPosition;
import com.yupptv.ott.ClientConfiguration;
import com.yupptv.ott.FixedAspectRatioRelativeLayout;
import com.yupptv.ott.FusionViliteMainActivity;
import com.yupptv.ott.OTTApplication;
import com.yupptv.ott.R;
import com.yupptv.ott.SplashScreenActivity;
import com.yupptv.ott.adapters.a0;
import com.yupptv.ott.adapters.b0;
import com.yupptv.ott.adapters.q;
import com.yupptv.ott.adapters.s;
import com.yupptv.ott.adapters.t;
import com.yupptv.ott.adapters.u;
import com.yupptv.ott.adapters.w;
import com.yupptv.ott.adapters.y;
import com.yupptv.ott.adapters.z;
import com.yupptv.ott.analytics.AnalyticsUtils;
import com.yupptv.ott.analytics.AnalyticsV2;
import com.yupptv.ott.analytics.MyRecoManager;
import com.yupptv.ott.controllers.GridController;
import com.yupptv.ott.database.WithoutInternetOfflineDownloadsEntity;
import com.yupptv.ott.enums.ButtonType;
import com.yupptv.ott.enums.ConcurrentStreamStatus;
import com.yupptv.ott.enums.DialogType;
import com.yupptv.ott.enums.ListType;
import com.yupptv.ott.enums.ScreenType;
import com.yupptv.ott.forwardrewindlib.Forward;
import com.yupptv.ott.forwardrewindlib.Rewind;
import com.yupptv.ott.fragments.ActionBottomSheetDialogFragment;
import com.yupptv.ott.interfaces.AdapterCallbacks;
import com.yupptv.ott.interfaces.BottomButtonsActionListener;
import com.yupptv.ott.interfaces.CardItemCallback;
import com.yupptv.ott.interfaces.DialogListener;
import com.yupptv.ott.interfaces.FragmentHost;
import com.yupptv.ott.interfaces.OfflinePlayingCallBack;
import com.yupptv.ott.interfaces.VideoDownloadCallBack;
import com.yupptv.ott.player.ExoPlayerFragment;
import com.yupptv.ott.player.PlayerControlView;
import com.yupptv.ott.player.audiofocus.AudioEventManager;
import com.yupptv.ott.player.audiofocus.AudioEventManagerCallbackListener;
import com.yupptv.ott.player.detail.UpNextFragment;
import com.yupptv.ott.player.offlinedownload.DownloadTracker;
import com.yupptv.ott.player.offlinedownload.MediaDownloadService;
import com.yupptv.ott.player.offlinedownload.OfflineDownloadData;
import com.yupptv.ott.utils.APIUtils;
import com.yupptv.ott.utils.ChromeCastUtils;
import com.yupptv.ott.utils.CleverTap;
import com.yupptv.ott.utils.Configurations;
import com.yupptv.ott.utils.Constants;
import com.yupptv.ott.utils.CustomLog;
import com.yupptv.ott.utils.MOUTracker;
import com.yupptv.ott.utils.NavigationConstants;
import com.yupptv.ott.utils.NavigationUtils;
import com.yupptv.ott.utils.NetworkUtils;
import com.yupptv.ott.utils.OrientationUtils;
import com.yupptv.ott.utils.PaginationScrollListener;
import com.yupptv.ott.utils.Preferences;
import com.yupptv.ott.utils.RowSpacingItemDecoration;
import com.yupptv.ott.utils.UiUtils;
import com.yupptv.ott.utils.Utils;
import com.yupptv.ott.views.LineSpinFadeLoaderView;
import com.yupptv.ott.views.VerticalSeekBar;
import com.yupptv.ottsdk.OttSDK;
import com.yupptv.ottsdk.enums.TenantBuildType;
import com.yupptv.ottsdk.managers.MediaCatalog.MediaCatalogManager;
import com.yupptv.ottsdk.managers.Payment.PaymentManager;
import com.yupptv.ottsdk.managers.Preferences.PreferenceManager;
import com.yupptv.ottsdk.managers.User.UserManager;
import com.yupptv.ottsdk.model.BottomTemplateInfo;
import com.yupptv.ottsdk.model.Card;
import com.yupptv.ottsdk.model.Content;
import com.yupptv.ottsdk.model.ContentPage;
import com.yupptv.ottsdk.model.Error;
import com.yupptv.ottsdk.model.PageData;
import com.yupptv.ottsdk.model.PageEventInfo;
import com.yupptv.ottsdk.model.PageInfo;
import com.yupptv.ottsdk.model.Section;
import com.yupptv.ottsdk.model.ShareInfo;
import com.yupptv.ottsdk.model.StreamStatus;
import com.yupptv.ottsdk.model.ads.AdUrlResponse;
import com.yupptv.ottsdk.model.ads.AdUrlType;
import com.yupptv.ottsdk.model.payments.ActivePackagesResponse;
import com.yupptv.ottsdk.model.stream.Stream;
import com.yupptv.ottsdk.model.stream.StreamResponse;
import com.yupptv.ottsdk.model.user.Configs;
import com.yupptv.ottsdk.model.user.VideoQualitySetting;
import com.yupptv.ottsdk.rest.network.RestAdapter;
import com.yupptv.ottsdk.utils.OttLog;
import com.yupptv.playerinterface.YuppPlayerExoAnalyticsInterface;
import in.juspay.hyper.constants.LogSubCategory;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import okhttp3.ResponseBody;
import org.json.JSONException;
import org.json.JSONObject;

public class ExoPlayerFragment extends Fragment implements PlayerControlView.NextVideoListener, AdapterCallbacks, PlayerControlView.AutoPlayListener, Player.Listener, PlayerControlView.VisibilityListener, PlayerControlView.Listner, MediaSourceFactory, DataSource.Factory, MediaSourceEventListener {
    private static final CookieManager DEFAULT_COOKIE_MANAGER;
    private static boolean preferExtensionDecoders;
    private TextView access_TV;
    private LinearLayout access_layout;
    private AdPosition adPosition;
    private AdUrlResponse adUrlResponse;
    private List<AdUrlType> adUrlTypesList;
    private AdsLoader adsLoader;
    private ObjectAnimator animator;
    public AudioEventManager audioEventManager;
    private LinearLayout audioLayout;
    public ImageView backButton;
    public LinearLayout backLiveBottomCarousel;
    public ImageView background_image;
    private FixedAspectRatioRelativeLayout bgFixedAspectRL;
    private String bg_image;
    private BottomSheetBehavior<LinearLayout> bottomSheetBehavior;
    private TextView brightnessLevelText;
    private VerticalSeekBar brightnessSeekbar;
    public AppCompatImageView btnZoomin;
    private List<Content.Elements> buttonList;
    public RecyclerView buttonRecyclerView;
    private TextView button_season;
    private String carousalName;
    private int carousalPosition;
    public int carouselPosition;
    private LinearLayout channel_suggestions;
    private ClipDrawable clipDrawable;
    public View container;
    private ContentPage contentPageItem;
    private int contentPosition;
    private Handler contentRatingHandler;
    private CountDownTimer countDownTimer;
    private int currentAdPosition;
    public TextView currentTime;
    public Dialog dialog;
    private String dialogType;
    private ImageView dropIcon_seasons;
    public boolean enableAds;
    private LinearLayout episodesLL;
    private ListView episodesList;
    private ImageView errorWarningImg;
    private TextView error_text_view;
    private EventLogger eventLogger;
    public FragmentManager fragmentManager;
    public RelativeLayout freeErrorEpisodePopup;
    private TextView free_episode_details_TV;
    private boolean hasMoreData;
    public ImageView iV_Gradient_top;
    public AdEvent.AdEventListener imaAdEventListener;
    private ImaServerSideAdInsertionMediaSource.AdsLoader imaDaiAdsLoader;
    private ImaServerSideAdInsertionMediaSource.AdsLoader.State imaDaiAdsLoaderState;
    public ImageView imageBackIV;
    public ImageView imgBackIV;
    public ImageView img_back;
    private View inflatedView;
    public boolean isLive;
    private boolean isReplayClicked;
    private boolean is_deeplink_info;
    public Object itemObject;
    public ContentPage lastItemObject;
    private ImmutableList<Tracks.Group> lastSeenTrackGroupArray;
    public StreamResponse lastStreamResponse;
    private LinearLayoutManager linearLayoutManager;
    private LinearLayoutManager linearLayoutManager_seasons;
    public ImageView live;
    private Uri loadedAdTagUri;
    private FragmentActivity mActivity;
    public AppCompatButton mBottomButton1;
    public AppCompatButton mBottomButton2;
    public ActionBottomSheetDialogFragment mBottomSheetDialog;
    private FrameLayout mCastLayout;
    private CastStateListener mCastStateListener;
    public ImageView mCloseButton;
    private String mCode;
    public TextView mComingUpText;
    public TextView mComingUpTextTitle;
    public int mContentPosition;
    private Dialog mDialog;
    private FragmentHost mFragmentHost;
    public FrameLayout mFrameLayout;
    private GridController mGridAdapter;
    private int mMaxVolume;
    public ImageView mMaximiseButton;
    private MediaRouteButton mMediaRouteButton;
    public View mMiniControlsContainer;
    public ImageView mNextVideoCloseIcon;
    public TextView mNextVideoDescription;
    public TextView mNextVideoGoLive;
    public ImageView mNextVideoImage;
    public RelativeLayout mNextVideoLayout;
    public ImageView mNextVideoPlayIcon;
    public LinearLayout mNextVideoReplay;
    private OrientationUtils mOrientationUtils;
    public YuppAnalytics mOttAnalytics;
    private String mPath;
    public ImageView mPauseButton;
    public ImageView mPlayButton;
    private Bundle mPlayerBundle;
    public PlayerControlView mPlayerControlView;
    private ImageView mPlayerHeaderBackIcon;
    private ImageView mPlayerHeaderIcon;
    public RelativeLayout mPlayerHeaderLayout;
    private TextView mPlayerHeaderMarker;
    private TextView mPlayerHeaderSubTitle;
    private TextView mPlayerHeaderTitle;
    private ImageView mPlayerRecommendationsIcon;
    public ImageView mPlayerRecommendationsRightArrow;
    public ImageView mReplayButton;
    public TextView mReplayGoLive;
    private ArrayList mStreamList;
    public TextView mSubTitleView;
    public TextView mTitleView;
    public VideoListener mVideoListener;
    public YuppPlayerExoAnalyticsInterface mYuppPlayerExoAnalyticsInterface;
    public TextView maturityRatingDesc;
    public RelativeLayout maturityRatingLayout;
    public TextView maturityRatingTitle;
    private CastContext mc;
    private DataSource.Factory mediaDataSourceFactory;
    public List<MediaItem> mediaItems;
    public LineSpinFadeLoaderView miniPlayerLoader;
    public MOUTracker mouTracker;
    private boolean needRetrySource;
    public AppCompatButton nextEpisodeButton;
    private LinearLayout nextEpisodeLayout;
    private Runnable nextEpisodeRunnable;
    public TextView nextEpisodeText;
    private OfflineDownloadData offlineData;
    public int paddingLeft;
    public PageEventInfo pageEventInfo;
    public PageInfo pageInfo;
    public String palBoxID;
    public String palSessionID;
    public String palStreamUrl;
    public RelativeLayout parent_access_layout;
    private String path;
    private int playBackState;
    private String playTargetPath;
    public PlaybackParameters playbackParameters;
    private CheckedTextView[] playbackSpeedViews;
    public ExoPlayer player;
    private ImageView playerCaptionsBtn;
    private ImageView playerChatBtn;
    private RelativeLayout playerController;
    private ImageView playerFavouriteBtn;
    public int playerHeight;
    private ImageView playerInfoBtn;
    private ImageView playerLockBtn;
    private ImageView playerMultipleAudioSubtitleTracksBtn;
    private boolean playerNeedsSource;
    private TextView playerPortraitHeaderSubTitle;
    private TextView playerPortraitHeaderTitle;
    private long playerPosition;
    private ImageView playerRecordBtn;
    private ImageView playerSettingsBtn;
    private ImageView playerShareBtn;
    private ImageView playerSpeedSettingsBtn;
    private String[] playerSpeeds;
    private String[] playerSpeedsList;
    public ImageView playerUnLock;
    public int playerWidth;
    private int playerWindow;
    public LinearLayout player_bottom_buttons_layout;
    private Forward player_forward_icon;
    public AppCompatButton player_replay;
    private Rewind player_rewind_icon;
    private Preferences preference;
    public String promotionalView;
    private int reason;
    public List<Card> recommendationCards;
    private TextView recommendationText;
    private RelativeLayout recommendation_control_backbutton;
    private RecyclerView relatedVideosRecyclerView;
    public LinearLayout relatedVideos_layout;
    private LinearLayout relatedVideos_layout_seasons;
    private RecyclerView relatedvideosrecyclerview_episodes;
    private RelativeLayout relative_seasonui;
    private RenderersFactory renderersFactory;
    private long resumePosition;
    private int resumeProgress;
    private SeasonViewAdapter seasonViewAdapter;
    private Section sectionInfo;
    private LinearLayout seekbarContainer;
    private StreamResponse.SessionInfo sessionInfo;
    private long sessionStartTime;
    private ShareInfo shareInfo;
    private boolean shouldAutoPlay;
    private boolean shouldRestorePosition;
    public PlayerView simpleExoPlayerView;
    public AppCompatButton skipIntroButton;
    public String source;
    public String sourceDetails;
    public AppCompatButton startOverBtn;
    public long startTime;
    public StreamResponse streamResponseObject;
    public String subSourceDetails;
    private AppCompatButton subscribe_btn;
    private LinearLayout subtitleLayout;
    public SubtitleView subtitleView;
    private String tabName;
    private int tab_position_clicked;
    public AppCompatButton takeTestButton;
    private CountDownTimer timer;
    private TextView titleTV;
    private String title_seasons;
    private int totalAds;
    private long totalPlaytime;
    public TextView totalTime;
    private TrackSelectionHelper trackSelectionHelper;
    private DefaultTrackSelector trackSelector;
    private LinearLayout trailer_back_layout;
    private ImageView trailer_muteButton;
    private int value;
    public AppCompatButton verify_button;
    public List<VideoQualitySetting> videoQualityList;
    private VideoQualitySetting videoQualitySetting;
    private LinearLayout videoQualitySettingsLayout;
    public VolumeChangeReceiver volumeChangeReceiver;
    public FrameLayout watchCreditsFrameLayout;
    public TextView watchCreditsTv;
    private AppCompatButton watchNowButton;
    private ImageView waterMark;
    private RelativeLayout waterMarkRelativeLayout;
    private static final String TAG = "ExoPlayerFragment";
    public static final DefaultBandwidthMeter BANDWIDTH_METER = new DefaultBandwidthMeter();
    public boolean isRelay = false;
    public boolean isDetailsPage = false;
    public boolean isTrailer = false;
    public boolean isaccessible = false;
    public boolean proPopup = false;
    public int currentSpeedIndex = 2;
    private String pagePath = "";
    private boolean playAdsError = false;
    private int count_of_retry = 0;
    private String videoQuality = "";
    public String videoQualityName = "Auto";
    private float mBrightness = -1.0f;
    private float mVolume = -1.0f;
    private String INSTREAM_AD_TYPE = "instream";
    private String DEFAULT_CLENGTH = "100";
    private List<Card> mListSeasons = new ArrayList();
    private List<String> mListSeasonNames = new ArrayList();
    public List<Integer> list_bitrates = new ArrayList();
    private int lastIndex = -1;
    private List<Card> cardsList = new ArrayList();
    public boolean VIEWSTATECOLLAPSED = true;
    public boolean watchNowButtonClicked = false;
    public boolean isvolumeChangeReceiverRegistered = false;
    public boolean clickdedOnCard = false;
    private HashMap<String, String> drmExtraHeaders = null;
    private boolean isPlayerInitiated = false;
    public boolean isChromeCastStop = false;
    public ButtonType mButtonType = ButtonType.NONE;
    private boolean NEXT_VIDEO = false;
    private final Handler mHandler = new Handler();
    public RecyclerView.RecycledViewPool recycledViewPool = new RecyclerView.RecycledViewPool();
    public boolean CCEnabled = false;
    private boolean showCC = false;
    private boolean initialOTPVerify = true;
    public String metaDataId = "";
    public String navigationFrom = "";
    public String isAutoPlay = "false";
    public String customData = "-1";
    public String isSubscribed = "-1";
    public String mUrl = "";
    public String mAesToken = "";
    public String mAesSession = "";
    public String mUrlPlayReady = "";
    private boolean isPlayerReady = false;
    public Section.SectionData mNextVideoObject = null;
    public String defaultCaptions = "";
    public int maxVideoBitrate = 0;
    public boolean isTVShow = false;
    public boolean isCloseCaptionsAvailable = false;
    public boolean isAudioTrackAvailable = false;
    public boolean isSubtitleAvailable = false;
    private boolean isInitPlay = true;
    private boolean isNextVideoFetchInProgress = false;
    private boolean shouldRemainUnPIPMode = false;
    public boolean isSkipIntoClicked = false;
    public String advertId = "";
    private String contentId = "";
    private boolean isFANAdPlaying = false;
    private String licenseUrl = "";
    private String licensePlayReadyUrl = "";
    private int previewDuration = 0;
    private int streamPosition = 0;
    private String mBackgroundImage = "";
    private String mTitle = "";
    private String mSubTitle = "";
    private long seekPosition = 0;
    private boolean playAds = true;
    public boolean isPlayingAd = false;
    public boolean isAdLoaded = false;
    private boolean isPauseByUser = false;
    private boolean isPlayerAutoPaused = false;
    private boolean isComingFromBackground = false;
    private boolean isOverlayStartOver = false;
    private boolean isVOD = false;
    private boolean navigationToPackage = false;
    public boolean isFromBackground = false;
    private boolean isPlayerError = false;
    private String parentalPassCode = "";
    private boolean isButtonClicked = false;
    private String targetPath = "";
    private Handler streamPollHandler = new Handler();
    private boolean isStartOverClicked = false;
    private String adType = "";
    private String klikkAnalyticsAssetId = "";
    private String klikkAnalyticsPartnerId = "";
    private String klikkAnalyticsUrl = "";
    private String klikkAnalyticsSessionId = "";
    private boolean isKlikVideoViewSent = false;
    private boolean isKlikVideoImpressionSent = false;
    private String trackingId = "";
    private String originSource = "";
    private String originMedium = "";
    public boolean showGoLive = false;
    public boolean showNextVideo = false;
    public boolean showNextEpisodeButton = true;
    public boolean isShowNextEpisodeButtonShowing = false;
    public String goLivePath = "";
    public String testURL = "";
    public String takeTestButtonText = "";
    private Long testStartTime = 0L;
    public boolean isdrm = false;
    public long CONTENT_RATING_VISIBLE_DURATION = 5000;
    public boolean mIsError = false;
    public boolean isFill = true;
    public String streamType = "";
    public boolean isDAIStream = false;
    public String daiAssetKey = "";
    public String palNonce = "";
    public String streamSessionId = "";
    public String macroReplacedURL = "";
    private String distroAnalyticsUrl = "";
    private boolean isDistroVideoImpressionSent = false;
    private final String DISTRO_EVENT_PLAYBACK = "vplay";
    private Handler nextEpisodeHandler = new Handler();
    public View.OnClickListener onclick = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            PageEventInfo pageEventInfo;
            ExoPlayerFragment.this.isStartOverClicked = false;
            if (ExoPlayerFragment.this.getActivity() != null) {
                FusionViliteMainActivity activity = ExoPlayerFragment.this.getActivity();
                if (activity.isClicked()) {
                    return;
                }
                View view2 = ExoPlayerFragment.this.mMiniControlsContainer;
                if (view2 == null || view2.getVisibility() != 0 || ExoPlayerFragment.this.getActivity().getPlayerCurrentState() == 1) {
                    activity.setClicked(true);
                    activity.clickHandler.postDelayed(activity.isClickedRunnable, 1000L);
                }
                int id = view.getId();
                if (id == R.id.nextlayout_goliveButton || id == R.id.playend_goliveButton) {
                    if (ExoPlayerFragment.this.contentPageItem == null || ExoPlayerFragment.this.contentPageItem.getPageEventInfo() == null || (pageEventInfo = ExoPlayerFragment.this.pageEventInfo) == null || pageEventInfo.getTargetPath() == null) {
                        return;
                    }
                    if (ExoPlayerFragment.this.getActivity() != null) {
                        ExoPlayerFragment.this.getActivity().onBackPressed();
                    }
                    if (ExoPlayerFragment.this.getActivity() == null || ExoPlayerFragment.this.getActivity().isFinishing()) {
                        return;
                    }
                    ExoPlayerFragment.this.getActivity().closePlayer();
                    NavigationUtils.performItemClickNavigation(null, ExoPlayerFragment.this.getActivity(), ExoPlayerFragment.this.pageEventInfo.getTargetPath(), "");
                    ExoPlayerFragment.this.stopPlayer();
                    return;
                }
                if (id == R.id.backButton) {
                    if (ExoPlayerFragment.this.getActivity() != null) {
                        ExoPlayerFragment.this.getActivity().onBackPressed();
                    }
                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                    exoPlayerFragment.eventCTClickEvent(exoPlayerFragment.contentPageItem, "topback");
                    return;
                }
                if (id == R.id.pause_button) {
                    ExoPlayerFragment.this.eventCTPlayerAction("pause");
                    ExoPlayer exoPlayer = ExoPlayerFragment.this.player;
                    if (exoPlayer == null || !exoPlayer.getPlayWhenReady()) {
                        return;
                    }
                    ExoPlayerFragment.this.player.setPlayWhenReady(false);
                    ExoPlayerFragment.this.mPauseButton.setVisibility(8);
                    ExoPlayerFragment.this.mPlayButton.setVisibility(0);
                    ExoPlayerFragment.this.mReplayButton.setVisibility(8);
                    return;
                }
                if (id == R.id.maximise_button) {
                    ExoPlayerFragment.this.eventCTPlayerAction("full screen");
                    if (ExoPlayerFragment.this.getActivity() != null) {
                        ExoPlayerFragment.this.getActivity().WWL_onClicked();
                        return;
                    }
                    return;
                }
                if (id == R.id.play_button) {
                    ExoPlayerFragment.this.eventCTPlayerAction("play");
                    ExoPlayer exoPlayer2 = ExoPlayerFragment.this.player;
                    if (exoPlayer2 == null || exoPlayer2.getPlayWhenReady()) {
                        return;
                    }
                    ExoPlayerFragment.this.player.setPlayWhenReady(true);
                    ExoPlayerFragment.this.mPauseButton.setVisibility(0);
                    ExoPlayerFragment.this.mPlayButton.setVisibility(8);
                    ExoPlayerFragment.this.mReplayButton.setVisibility(8);
                    return;
                }
                if (id == R.id.episodesLL) {
                    CustomLog.d(ExoPlayerFragment.TAG, "onClick_episodeLL: ");
                    ExoPlayerFragment.this.hideControls();
                    ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                    PlayerControlView playerControlView = exoPlayerFragment2.mPlayerControlView;
                    if (playerControlView instanceof PlayerControlView) {
                        playerControlView.isShowControls = true;
                    }
                    LinearLayout linearLayout = exoPlayerFragment2.relatedVideos_layout;
                    Resources resources = linearLayout.getContext().getResources();
                    int i2 = R.color.black_transparent_60;
                    linearLayout.setBackgroundColor(resources.getColor(i2));
                    ExoPlayerFragment.this.recommendation_control_backbutton.setVisibility(0);
                    ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                    if (!exoPlayerFragment3.isLive) {
                        exoPlayerFragment3.relatedVideos_layout_seasons.setBackgroundColor(ExoPlayerFragment.this.relatedVideos_layout_seasons.getContext().getResources().getColor(i2));
                        RelativeLayout relativeLayout = ExoPlayerFragment.this.parent_access_layout;
                        if (relativeLayout == null || relativeLayout.getVisibility() != 0) {
                            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) ExoPlayerFragment.this.relative_seasonui.getLayoutParams();
                            layoutParams.setMargins(0, (int) ExoPlayerFragment.this.getActivity().getResources().getDimension(R.dimen._20sdp), 0, 0);
                            ExoPlayerFragment.this.relative_seasonui.setLayoutParams(layoutParams);
                        } else {
                            RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) ExoPlayerFragment.this.relative_seasonui.getLayoutParams();
                            layoutParams2.setMargins(0, (int) ExoPlayerFragment.this.getActivity().getResources().getDimension(R.dimen._40sdp), 0, 0);
                            ExoPlayerFragment.this.relative_seasonui.setLayoutParams(layoutParams2);
                        }
                        ExoPlayerFragment.this.relative_seasonui.setVisibility(0);
                        ExoPlayerFragment.this.recommendation_control_backbutton.setVisibility(0);
                    }
                    ExoPlayerFragment.this.pausePlayer();
                    ExoPlayerFragment.this.eventCTPlayerAction("episodes");
                    ExoPlayerFragment exoPlayerFragment4 = ExoPlayerFragment.this;
                    if (exoPlayerFragment4.relatedVideos_layout != null && exoPlayerFragment4.isLive) {
                        Constants.is_playerRecommendationsIcon_clicked = false;
                        exoPlayerFragment4.lastIndex = -1;
                        if (ExoPlayerFragment.this.relatedVideos_layout.getVisibility() == 0) {
                            ExoPlayerFragment.this.relatedVideos_layout.setVisibility(8);
                            ExoPlayerFragment.this.mPlayerRecommendationsRightArrow.setVisibility(8);
                        } else {
                            ExoPlayerFragment.this.relatedVideos_layout.setVisibility(0);
                            ExoPlayerFragment.this.mPlayerRecommendationsRightArrow.setVisibility(0);
                        }
                    }
                    if (ExoPlayerFragment.this.relatedVideos_layout_seasons != null) {
                        ExoPlayerFragment exoPlayerFragment5 = ExoPlayerFragment.this;
                        if (exoPlayerFragment5.isLive) {
                            return;
                        }
                        Constants.is_playerRecommendationsIcon_clicked = false;
                        exoPlayerFragment5.lastIndex = -1;
                        if (ExoPlayerFragment.this.relatedVideos_layout_seasons.getVisibility() == 0) {
                            ExoPlayerFragment.this.relatedVideos_layout_seasons.setVisibility(8);
                            return;
                        } else {
                            ExoPlayerFragment.this.relatedVideos_layout_seasons.setVisibility(0);
                            return;
                        }
                    }
                    return;
                }
                if (id == R.id.replay_button) {
                    ExoPlayerFragment.this.eventCTPlayerAction("replay");
                    PlayerControlView playerControlView2 = ExoPlayerFragment.this.mPlayerControlView;
                    if (playerControlView2 != null) {
                        playerControlView2.trackEvents(AnalyticsUtils.EVENT_PLAYER, AnalyticsUtils.ATTRIBUTE_VALUE_REPLAY);
                    }
                    if (ExoPlayerFragment.this.mc == null || !ExoPlayerFragment.this.isAdded()) {
                        ExoPlayerFragment.this.updateNextVideoLayoutVisibility(false);
                        ExoPlayerFragment.this.cancelNextVideoTimer();
                        ExoPlayerFragment.this.replayVideo();
                    } else if (ExoPlayerFragment.this.mc.getCastState() == 4) {
                        ExoPlayerFragment.this.isReplayClicked = true;
                        ExoPlayerFragment exoPlayerFragment6 = ExoPlayerFragment.this;
                        exoPlayerFragment6.startPlay(exoPlayerFragment6.itemObject, exoPlayerFragment6.seekPosition, ButtonType.NONE);
                    } else if (ExoPlayerFragment.this.getActivity() == null || ExoPlayerFragment.this.mc.getCastState() != 2 || ExoPlayerFragment.this.getActivity().isSessionEnding) {
                        ExoPlayerFragment.this.updateNextVideoLayoutVisibility(false);
                        ExoPlayerFragment.this.cancelNextVideoTimer();
                        ExoPlayerFragment.this.replayVideo();
                    } else {
                        ExoPlayerFragment.this.getActivity().updateLocalPlayer();
                    }
                    ExoPlayerFragment.this.mPauseButton.setVisibility(0);
                    ExoPlayerFragment.this.mPlayButton.setVisibility(8);
                    ExoPlayerFragment.this.mReplayButton.setVisibility(8);
                    return;
                }
                if (id == R.id.chat_icon || id == R.id.player_back_button) {
                    ExoPlayerFragment.this.mPlayerControlView.hide();
                    ExoPlayerFragment.this.mOrientationUtils.shrinkToPotraitMode();
                    return;
                }
                if (id == R.id.takeTest_button) {
                    AnalyticsUtils.getInstance().trackAnalyticsEvent(ScreenType.PLAYER, null, null, null, ExoPlayerFragment.this.takeTestButtonText, AnalyticsUtils.ATTRIBUTE_VALUE_SOURCE_PLAYER_PAGE, null);
                    if (ExoPlayerFragment.this.getActivity() != null) {
                        FragmentActivity activity2 = ExoPlayerFragment.this.getActivity();
                        String str = NavigationConstants.NAV_TAKE_A_TEST;
                        ExoPlayerFragment exoPlayerFragment7 = ExoPlayerFragment.this;
                        NavigationUtils.onBoardWebViewNavigation(activity2, str, exoPlayerFragment7.testURL, exoPlayerFragment7.takeTestButtonText);
                        return;
                    }
                    return;
                }
                if (id == R.id.btn_last_ch) {
                    ExoPlayerFragment.this.eventCTPlayerAction("last channel");
                    ExoPlayerFragment.this.playLastChannel();
                    return;
                }
                if (id == R.id.btn_next_startover) {
                    ExoPlayerFragment.this.eventCTPlayerAction("start over");
                    ExoPlayerFragment.this.isStartOverClicked = true;
                    ExoPlayerFragment.this.showStartOverDialog();
                    if (ExoPlayerFragment.this.getActivity() != null) {
                        ExoPlayerFragment exoPlayerFragment8 = ExoPlayerFragment.this;
                        ButtonType buttonType = exoPlayerFragment8.mButtonType;
                        if (buttonType == null || buttonType != ButtonType.START_OVER) {
                            exoPlayerFragment8.getActivity().setButtonType(ButtonType.START_OVER);
                            return;
                        } else {
                            exoPlayerFragment8.getActivity().setButtonType(ButtonType.WATCH_NOW);
                            return;
                        }
                    }
                    return;
                }
                if (id == R.id.skipIntroButton) {
                    ExoPlayerFragment.this.eventCTPlayerAction("skip intro");
                    PlayerControlView playerControlView3 = ExoPlayerFragment.this.mPlayerControlView;
                    if (playerControlView3 != null) {
                        playerControlView3.seekTo(playerControlView3.introEndTime);
                        ExoPlayerFragment.this.skipIntroButton.setVisibility(8);
                        ExoPlayerFragment.this.isSkipIntoClicked = true;
                    }
                    LinearLayout linearLayout2 = ExoPlayerFragment.this.player_bottom_buttons_layout;
                    if (linearLayout2 != null) {
                        RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) linearLayout2.getLayoutParams();
                        layoutParams3.setMargins(0, 0, 0, (int) ExoPlayerFragment.this.getContext().getResources().getDimension(R.dimen._15sdp));
                        ExoPlayerFragment.this.player_bottom_buttons_layout.setLayoutParams(layoutParams3);
                        return;
                    }
                    return;
                }
                if (id == R.id.watchCreditsFrameLayout) {
                    FrameLayout frameLayout = ExoPlayerFragment.this.watchCreditsFrameLayout;
                    if (frameLayout != null && frameLayout.getVisibility() == 0) {
                        ExoPlayerFragment.this.watchCreditsFrameLayout.setVisibility(8);
                    }
                    ExoPlayerFragment.this.updateNextVideoLayoutVisibility(false);
                    return;
                }
                if (id == R.id.btnNextEpisode || id == R.id.next_video_layout || id == R.id.nextEpisodeLayout || id == R.id.nextEpisodeButton) {
                    ExoPlayerFragment.this.eventCTPlayerAction("next video");
                    PlayerControlView playerControlView4 = ExoPlayerFragment.this.mPlayerControlView;
                    if (playerControlView4 != null) {
                        playerControlView4.hide();
                    }
                    ExoPlayerFragment.this.playNextVideo();
                    return;
                }
                if (id == R.id.favourite_icon) {
                    ExoPlayerFragment.this.updateFavourites();
                    return;
                }
                if (id == R.id.videoQuality_layout || id == R.id.player_settings_icon) {
                    ExoPlayerFragment.this.eventCTPlayerAction("settings");
                    ExoPlayerFragment.this.mPlayerControlView.hide();
                    PlayerControlView playerControlView5 = ExoPlayerFragment.this.mPlayerControlView;
                    if (playerControlView5 != null) {
                        playerControlView5.trackEvents(AnalyticsUtils.EVENT_PLAYER, AnalyticsUtils.ATTRIBUTE_VALUE_SETTINGS);
                    }
                    if (ExoPlayerFragment.this.trackSelector == null || ExoPlayerFragment.this.trackSelector.getCurrentMappedTrackInfo() == null || ExoPlayerFragment.this.getActivity() == null) {
                        return;
                    }
                    TrackSelectionHelper trackSelectionHelper = ExoPlayerFragment.this.trackSelectionHelper;
                    FragmentActivity activity3 = ExoPlayerFragment.this.getActivity();
                    ExoPlayerFragment exoPlayerFragment9 = ExoPlayerFragment.this;
                    trackSelectionHelper.showSelectionCustomDialog(activity3, exoPlayerFragment9, "Video", exoPlayerFragment9.trackSelector, 0, true);
                    return;
                }
                if (id == R.id.player_record_icon) {
                    CustomLog.e("recordStatus", "+++++++++++++" + ((String) ExoPlayerFragment.this.playerRecordBtn.getTag()));
                    return;
                }
                if (id != R.id.player_info_icon) {
                    if (id == R.id.close_button) {
                        ExoPlayerFragment.this.eventCTPlayerAction("close player");
                        if (ExoPlayerFragment.this.getActivity() != null) {
                            ExoPlayerFragment exoPlayerFragment10 = ExoPlayerFragment.this;
                            exoPlayerFragment10.currentSpeedIndex = 2;
                            exoPlayerFragment10.getActivity().mWatchWhileLayout.slideHorizontal(true);
                            ExoPlayerFragment.this.getActivity().updateUI(0);
                            return;
                        }
                        return;
                    }
                    return;
                }
                ExoPlayerFragment.this.mPlayerControlView.hide();
                Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(ExoPlayerFragment.this.getContext().getApplicationContext());
                String showStreamBitRate = utilAppConfigurations != null ? utilAppConfigurations.getShowStreamBitRate() : "false";
                HashMap hashMap = new HashMap();
                hashMap.put(Constants.DIALOG_TITLE, ExoPlayerFragment.this.mTitle);
                hashMap.put(Constants.DIALOG_SUBTITLE, ExoPlayerFragment.this.mSubTitle);
                hashMap.put(Constants.DIALOG_MSG, ExoPlayerFragment.this.description);
                hashMap.put(Constants.DIALOG_KEY_IMAGE_URL_PATH, ExoPlayerFragment.this.imageUrl);
                hashMap.put("navigation_player_info", "true");
                if (ExoPlayerFragment.this.getActivity() != null && showStreamBitRate.equalsIgnoreCase("true") && ExoPlayerFragment.this.eventLogger != null && ExoPlayerFragment.this.eventLogger.bitrate > 0) {
                    hashMap.put("streamBitRateValue", String.format(ExoPlayerFragment.this.getActivity().getResources().getString(R.string.show_bitrate), "" + ExoPlayerFragment.this.eventLogger.bitrate));
                }
                if (ExoPlayerFragment.this.getActivity() != null) {
                    ExoPlayerFragment exoPlayerFragment11 = ExoPlayerFragment.this;
                    exoPlayerFragment11.mBottomSheetDialog = NavigationUtils.showInfoDialog("player info icon", exoPlayerFragment11.getActivity(), DialogType.DIALOG_PLAYER_BOTTOM_RENDERING, hashMap, ExoPlayerFragment.this.contentPageItem, new BottomButtonsActionListener() {
                        @Override
                        public void onButtonClicked(AppCompatButton appCompatButton, Object obj, ButtonType buttonType2) {
                        }

                        @Override
                        public void onDismiss() {
                        }
                    });
                }
            }
        }
    };
    public VerticalSeekBar volumeSeekbar = null;
    public TextView volumeLevelText = null;
    public boolean mForeground = false;
    public boolean navigatoToDetailsPage = false;
    private int streamStatus = 1;
    private Runnable streamPollRunnable = new Runnable() {
        @Override
        public void run() {
            if (ExoPlayerFragment.this.streamStatus != 1) {
                ExoPlayerFragment.this.sendStreamPlayerStatus(ConcurrentStreamStatus.POLL);
            } else {
                ExoPlayerFragment.this.sendStreamPlayerStatus(ConcurrentStreamStatus.START);
                ExoPlayerFragment.this.streamStatus = 2;
            }
        }
    };
    private Handler epgCheckHandler = new Handler();
    private Runnable epgCheckRunnable = new Runnable() {
        @Override
        public void run() {
            ExoPlayerFragment.this.checkRequestEPG();
            if (ExoPlayerFragment.this.epgCheckHandler != null) {
                ExoPlayerFragment.this.updatePosition();
                ExoPlayerFragment.this.epgCheckHandler.removeCallbacks(ExoPlayerFragment.this.epgCheckRunnable);
                ExoPlayerFragment.this.epgCheckHandler.postDelayed(ExoPlayerFragment.this.epgCheckRunnable, 1000L);
            }
        }
    };
    private long programEndTime = 0;
    private long programStartTime = 0;
    private DialogListener dialogListener = new DialogListener() {
        @Override
        public void itemClicked(boolean z, int i2, int i3) {
        }

        @Override
        public void itemClicked(boolean z, int i2, HashMap hashMap) {
            if (!z) {
                ExoPlayerFragment.this.parentalPassCode = "";
                if (ExoPlayerFragment.this.getActivity() == null) {
                    ExoPlayerFragment.this.launchActivity();
                    return;
                } else {
                    ExoPlayerFragment.this.CO_doCollapse();
                    ExoPlayerFragment.this.getActivity().goBackFromPlayer();
                    return;
                }
            }
            if (i2 == 1) {
                NavigationUtils.loadScreenActivityForResult(ExoPlayerFragment.this.getActivity(), ScreenType.FORGOT_PIN, NavigationConstants.NAV_FROM_PLAYER, "", 9, false, false);
                return;
            }
            ExoPlayerFragment.this.parentalPassCode = String.valueOf(i2);
            ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
            exoPlayerFragment.startPlay(exoPlayerFragment.itemObject, exoPlayerFragment.seekPosition, ExoPlayerFragment.this.mButtonType);
        }
    };
    public MediaCatalogManager.MediaCatalogCallback<StreamResponse> mediaCatalogCallback = new MediaCatalogManager.MediaCatalogCallback<StreamResponse>() {
        @Override
        public void onFailure(Error error) {
        }

        @Override
        public void onSuccess(StreamResponse streamResponse) {
        }
    };
    public MediaCatalogManager.MediaCatalogCallback<Section.SectionData> mMediaCatalogCallback = new MediaCatalogManager.MediaCatalogCallback<Section.SectionData>() {
        @Override
        public void onFailure(Error error) {
            if (ExoPlayerFragment.this.getActivity() == null || ExoPlayerFragment.this.getActivity().isFinishing()) {
                return;
            }
            ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
            exoPlayerFragment.mNextVideoObject = null;
            exoPlayerFragment.showNextVideo = false;
            NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "/service/api/v1/next/videos", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
        }

        @Override
        public void onSuccess(Section.SectionData sectionData) {
            if (ExoPlayerFragment.this.getActivity() == null || ExoPlayerFragment.this.getActivity().isFinishing()) {
                return;
            }
            if (sectionData == null || sectionData.getCards() == null || sectionData.getCards().size() <= 0) {
                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                exoPlayerFragment.mNextVideoObject = null;
                exoPlayerFragment.showNextVideo = false;
            } else {
                ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                exoPlayerFragment2.showNextVideo = true;
                exoPlayerFragment2.mNextVideoObject = sectionData;
                RequestManager with = Glide.with(exoPlayerFragment2.getActivity().getApplicationContext());
                t.a(ExoPlayerFragment.this.mNextVideoObject.getCards().get(0), ExoPlayerFragment.this.getActivity().getApplicationContext(), with).error(R.drawable.default_banner).into(ExoPlayerFragment.this.mNextVideoImage);
                Section.SectionData sectionData2 = ExoPlayerFragment.this.mNextVideoObject;
                if (sectionData2 == null || sectionData2.getCards() == null || ExoPlayerFragment.this.mNextVideoObject.getCards().get(0) == null || ExoPlayerFragment.this.mNextVideoObject.getCards().get(0).getDisplay() == null || ExoPlayerFragment.this.mNextVideoObject.getCards().get(0).getDisplay().getTitle() == null || q.a(ExoPlayerFragment.this.mNextVideoObject.getCards().get(0)) <= 0) {
                    Section.SectionData sectionData3 = ExoPlayerFragment.this.mNextVideoObject;
                    if (sectionData3 != null && sectionData3.getCards() != null && ExoPlayerFragment.this.mNextVideoObject.getCards().get(0) != null && ExoPlayerFragment.this.mNextVideoObject.getCards().get(0).getDisplay() != null && ExoPlayerFragment.this.mNextVideoObject.getCards().get(0).getDisplay().getSubtitle1() != null && ExoPlayerFragment.this.mNextVideoObject.getCards().get(0).getDisplay().getSubtitle1().trim().length() > 0) {
                        ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                        a.a(exoPlayerFragment3.mNextVideoObject.getCards().get(0), exoPlayerFragment3.mComingUpText);
                    }
                } else {
                    ExoPlayerFragment exoPlayerFragment4 = ExoPlayerFragment.this;
                    z.a(exoPlayerFragment4.mNextVideoObject.getCards().get(0), exoPlayerFragment4.mComingUpText);
                }
                PageInfo pageInfo = ExoPlayerFragment.this.contentPageItem.getPageInfo();
                if (pageInfo == null || pageInfo.getAttributes() == null || pageInfo.getAttributes().getRecommendationText() == null) {
                    ExoPlayerFragment exoPlayerFragment5 = ExoPlayerFragment.this;
                    exoPlayerFragment5.mComingUpTextTitle.setText(exoPlayerFragment5.getActivity().getResources().getString(R.string.ccl_mini_upnext));
                } else {
                    ExoPlayerFragment.this.mComingUpTextTitle.setText(pageInfo.getAttributes().getRecommendationText());
                }
            }
            ExoPlayerFragment exoPlayerFragment6 = ExoPlayerFragment.this;
            if (exoPlayerFragment6.mNextVideoObject == null || exoPlayerFragment6.isLive) {
                exoPlayerFragment6.nextEpisodeLayout.setVisibility(8);
                return;
            }
            PageInfo pageInfo2 = exoPlayerFragment6.contentPageItem.getPageInfo();
            if (pageInfo2 != null && pageInfo2.getAttributes() != null && pageInfo2.getAttributes().getShowNextButton() != null) {
                pageInfo2.getAttributes().getShowNextButton();
            }
            if (pageInfo2.getAttributes().getNextButtonTitle() == null || pageInfo2.getAttributes().getNextButtonTitle().trim().length() <= 0) {
                return;
            }
            ExoPlayerFragment.this.nextEpisodeLayout.setVisibility(0);
            ExoPlayerFragment exoPlayerFragment7 = ExoPlayerFragment.this;
            exoPlayerFragment7.nextEpisodeText.setText(exoPlayerFragment7.contentPageItem.getPageInfo().getAttributes().getNextButtonTitle());
        }
    };
    public Handler miniControlsHandler = new Handler();
    private final Runnable miniControlsHideRunnable = new Runnable() {
        @Override
        public void run() {
            ExoPlayerFragment.this.hideMiniControls();
        }
    };
    public String shareText = "";
    private String description = "";
    private String imageUrl = "";
    private int mDuration = 0;
    public String mContentId = "";
    public String contentType = "";
    public String contentGenre = "";
    public String contentModel = "na";
    public String contentLanguage = "na";
    public String contentName = "";
    public String contentTag = "";
    public String contentPartnerName = "";
    public String tvShowName = "";

    public class AnonymousClass26 implements Runnable {
        public final View val$container;

        public AnonymousClass26(View view) {
            this.val$container = view;
        }

        public void lambda$run$0(View view) {
            ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
            Object obj = exoPlayerFragment.itemObject;
            if (obj instanceof ContentPage) {
                exoPlayerFragment.eventCTClickEvent((ContentPage) obj, "topback");
            }
            if (ExoPlayerFragment.this.getActivity() != null) {
                ExoPlayerFragment.this.getActivity().onBackPressed();
            }
        }

        public void lambda$run$1(View view) {
            if (ExoPlayerFragment.this.getActivity() != null) {
                if (ExoPlayerFragment.this.getActivity().getResources().getConfiguration().orientation != 1) {
                    ExoPlayerFragment.this.mOrientationUtils.shrinkToPotraitMode();
                } else {
                    ExoPlayerFragment.this.getActivity().onBackPressed();
                }
            }
        }

        public void lambda$run$2(android.view.View r21) {
            throw new UnsupportedOperationException("Method not decompiled: com.yupptv.ott.player.ExoPlayerFragment.AnonymousClass26.lambda$run$2(android.view.View):void");
        }

        @Override
        public void run() {
            ExoPlayerFragment.this.mFrameLayout = (FrameLayout) this.val$container.findViewById(R.id.player_view);
            if (ExoPlayerFragment.this.mFrameLayout.getChildCount() > 0) {
                ExoPlayerFragment.this.mFrameLayout.removeAllViews();
            }
            ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
            exoPlayerFragment.simpleExoPlayerView = LayoutInflater.from(exoPlayerFragment.getActivity()).inflate(R.layout.exo_surface, (ViewGroup) this.val$container, false);
            ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
            exoPlayerFragment2.miniPlayerLoader = (LineSpinFadeLoaderView) exoPlayerFragment2.simpleExoPlayerView.findViewById(R.id.mini_player_loader);
            ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
            exoPlayerFragment3.errorWarningImg = (ImageView) exoPlayerFragment3.simpleExoPlayerView.findViewById(R.id.error_warning_img);
            ExoPlayerFragment.this.bgFixedAspectRL = (FixedAspectRatioRelativeLayout) this.val$container.findViewById(R.id.bgFixedAspectRL);
            ExoPlayerFragment.this.background_image = (ImageView) this.val$container.findViewById(R.id.background_image);
            ExoPlayerFragment.this.imgBackIV = (ImageView) this.val$container.findViewById(R.id.imgBackIV);
            ExoPlayerFragment.this.watchNowButton = this.val$container.findViewById(R.id.watchNowButton);
            ExoPlayerFragment.this.buttonRecyclerView = this.val$container.findViewById(R.id.button_rv);
            ExoPlayerFragment.this.imageBackIV = (ImageView) this.val$container.findViewById(R.id.imageBackIV);
            ExoPlayerFragment.this.imageBackIV.setVisibility(8);
            ExoPlayerFragment.this.imgBackIV.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    ExoPlayerFragment.AnonymousClass26.this.lambda$run$0(view);
                }
            });
            ExoPlayerFragment.this.imageBackIV.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    ExoPlayerFragment.AnonymousClass26.this.lambda$run$1(view);
                }
            });
            ExoPlayerFragment.this.watchNowButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    ExoPlayerFragment.AnonymousClass26.this.lambda$run$2(view);
                }
            });
            ExoPlayerFragment.this.simpleExoPlayerView.requestFocus();
            ExoPlayerFragment.this.simpleExoPlayerView.setResizeMode(0);
            ExoPlayerFragment.this.simpleExoPlayerView.setUseController(false);
            ExoPlayerFragment.this.simpleExoPlayerView.setKeepScreenOn(true);
            ExoPlayerFragment exoPlayerFragment4 = ExoPlayerFragment.this;
            exoPlayerFragment4.mFrameLayout.addView(exoPlayerFragment4.simpleExoPlayerView);
        }
    }

    public class AnonymousClass3 implements View.OnClickListener {
        public final LayoutInflater val$inflater;

        public AnonymousClass3(LayoutInflater layoutInflater) {
            this.val$inflater = layoutInflater;
        }

        @Override
        public void onClick(View view) {
            ExoPlayerFragment.this.relative_seasonui.setBackgroundResource(0);
            ExoPlayerFragment.this.relative_seasonui.setBackgroundResource(R.drawable.background_spinner_bg);
            ImageView imageView = ExoPlayerFragment.this.dropIcon_seasons;
            int i2 = R.drawable.up_arrow;
            imageView.setTag(Integer.valueOf(i2));
            ExoPlayerFragment.this.dropIcon_seasons.setImageResource(i2);
            if (ExoPlayerFragment.this.mListSeasons != null) {
                final PopupWindow popupWindow = new PopupWindow(ExoPlayerFragment.this.dropIcon_seasons.getContext());
                ExoPlayerFragment.this.inflatedView = this.val$inflater.inflate(R.layout.episodes_list_layout, (ViewGroup) null);
                for (int i3 = 0; i3 < Constants.seasons_list.size(); i3++) {
                    if (!ExoPlayerFragment.this.mListSeasonNames.contains(Constants.seasons_list.get(i3))) {
                        ExoPlayerFragment.this.mListSeasonNames.add(Constants.seasons_list.get(i3));
                    }
                }
                ArrayAdapter arrayAdapter = new ArrayAdapter(ExoPlayerFragment.this.dropIcon_seasons.getContext(), R.layout.season_list, R.id.textView, ExoPlayerFragment.this.mListSeasonNames);
                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                exoPlayerFragment.episodesList = (ListView) exoPlayerFragment.inflatedView.findViewById(R.id.list);
                ExoPlayerFragment.this.episodesList.setAdapter((ListAdapter) arrayAdapter);
                popupWindow.setFocusable(true);
                int width = ExoPlayerFragment.this.relative_seasonui.getWidth();
                CustomLog.d(ExoPlayerFragment.TAG, "onClick_sagggggg: " + width);
                popupWindow.setWidth(width);
                popupWindow.setBackgroundDrawable(ContextCompat.getDrawable(ExoPlayerFragment.this.dropIcon_seasons.getContext(), R.drawable.episodes_list_drawable));
                popupWindow.setHeight(-2);
                popupWindow.setContentView(ExoPlayerFragment.this.inflatedView);
                popupWindow.showAsDropDown(view, 0, 0);
                popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
                    @Override
                    public void onDismiss() {
                        if (ExoPlayerFragment.this.getActivity() instanceof FusionViliteMainActivity) {
                            ExoPlayerFragment.this.getActivity().hideSystemUI();
                        }
                        ImageView imageView2 = ExoPlayerFragment.this.dropIcon_seasons;
                        int i4 = R.drawable.down_arrow;
                        imageView2.setTag(Integer.valueOf(i4));
                        ExoPlayerFragment.this.dropIcon_seasons.setImageResource(i4);
                        ExoPlayerFragment.this.relative_seasonui.setBackgroundResource(R.drawable.onclick_bg_spinner);
                    }
                });
                ExoPlayerFragment.this.episodesList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> adapterView, View view2, final int i4, long j) {
                        List<Section> list;
                        if (UpNextFragment.sectionsInfo.get(i4).getSectionData().getCards() == null || UpNextFragment.sectionsInfo.get(i4).getSectionData().getCards().size() <= 0) {
                            if (TextUtils.isEmpty(UpNextFragment.playerPageData.getPageInfo().getPath()) || (list = UpNextFragment.sectionsInfo) == null || list.get(i4) == null || UpNextFragment.sectionsInfo.get(i4).getSectionInfo() == null || TextUtils.isEmpty(UpNextFragment.sectionsInfo.get(i4).getSectionInfo().getCode())) {
                                return;
                            }
                            OttSDK.getInstance().getMediaManager().getPageSectionContent(UpNextFragment.playerPageData.getPageInfo().getPath(), UpNextFragment.sectionsInfo.get(i4).getSectionInfo().getCode(), 0, 15, null, null, new MediaCatalogManager.MediaCatalogCallback<List<Section.SectionData>>() {
                                @Override
                                public void onFailure(Error error) {
                                    if (ExoPlayerFragment.this.getActivity() == null) {
                                        return;
                                    }
                                    NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "/service/api/v1/section/data", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
                                }

                                @Override
                                public void onSuccess(List<Section.SectionData> list2) {
                                    if (ExoPlayerFragment.this.getActivity() == null) {
                                        return;
                                    }
                                    popupWindow.dismiss();
                                    ExoPlayerFragment.this.button_season.setText(Constants.seasons_list.get(i4).toString());
                                    if (list2 == null || list2.size() < 1) {
                                        return;
                                    }
                                    ExoPlayerFragment.this.lastIndex = list2.get(0).getLastIndex().intValue();
                                    ExoPlayerFragment.this.hasMoreData = list2.get(0).getHasMoreData().booleanValue();
                                    if (list2.get(0).getCards().isEmpty() || list2.get(0).getCards().size() == 0) {
                                        ExoPlayerFragment.this.relatedVideos_layout.setVisibility(8);
                                    }
                                    ExoPlayerFragment.this.recommendationCards = list2.get(0).getCards();
                                    if (list2.get(0).getCards() != null) {
                                        UpNextFragment.sectionsInfo.get(i4).getSectionData().setCards(list2.get(0).getCards());
                                    }
                                    boolean z = (UpNextFragment.sectionsInfo.get(0).getSectionInfo().getParams() == null || TextUtils.isEmpty(UpNextFragment.sectionsInfo.get(0).getSectionInfo().getParams().getShowCardTitle()) || !UpNextFragment.sectionsInfo.get(0).getSectionInfo().getParams().getShowCardTitle().equalsIgnoreCase("true")) ? false : true;
                                    ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                                    exoPlayerFragment2.linearLayoutManager_seasons = new LinearLayoutManager(exoPlayerFragment2.mActivity, 0, false);
                                    ExoPlayerFragment.this.relatedvideosrecyclerview_episodes.setLayoutManager(ExoPlayerFragment.this.linearLayoutManager_seasons);
                                    ExoPlayerFragment.this.relatedvideosrecyclerview_episodes.setVisibility(0);
                                    ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                                    exoPlayerFragment3.seasonViewAdapter = exoPlayerFragment3.new SeasonViewAdapter(exoPlayerFragment3.mActivity, ExoPlayerFragment.this.recommendationCards, z, 0);
                                    ExoPlayerFragment.this.relatedvideosrecyclerview_episodes.setAdapter(ExoPlayerFragment.this.seasonViewAdapter);
                                }
                            });
                            return;
                        }
                        ExoPlayerFragment.this.recommendationCards = UpNextFragment.sectionsInfo.get(i4).getSectionData().getCards();
                        ExoPlayerFragment.this.mGridAdapter.setFilterDuplicates(false);
                        ExoPlayerFragment.this.eventCTPlayerAction("season guide");
                        popupWindow.dismiss();
                        ExoPlayerFragment.this.button_season.setText(Constants.seasons_list.get(i4).toString());
                        boolean z = (UpNextFragment.sectionsInfo.get(i4).getSectionInfo().getParams() == null || TextUtils.isEmpty(UpNextFragment.sectionsInfo.get(i4).getSectionInfo().getParams().getShowCardTitle()) || !UpNextFragment.sectionsInfo.get(i4).getSectionInfo().getParams().getShowCardTitle().equalsIgnoreCase("true")) ? false : true;
                        ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                        exoPlayerFragment2.linearLayoutManager_seasons = new LinearLayoutManager(exoPlayerFragment2.mActivity, 0, false);
                        ExoPlayerFragment.this.relatedvideosrecyclerview_episodes.setLayoutManager(ExoPlayerFragment.this.linearLayoutManager_seasons);
                        ExoPlayerFragment.this.relatedvideosrecyclerview_episodes.setVisibility(0);
                        ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                        exoPlayerFragment3.seasonViewAdapter = exoPlayerFragment3.new SeasonViewAdapter(exoPlayerFragment3.mActivity, ExoPlayerFragment.this.recommendationCards, z, i4);
                        ExoPlayerFragment.this.relatedvideosrecyclerview_episodes.setAdapter(ExoPlayerFragment.this.seasonViewAdapter);
                    }
                });
            }
        }
    }

    public static class AnonymousClass79 {
        public static final int[] $SwitchMap$com$google$ads$interactivemedia$v3$api$AdEvent$AdEventType;

        static {
            int[] iArr = new int[AdEvent.AdEventType.values().length];
            $SwitchMap$com$google$ads$interactivemedia$v3$api$AdEvent$AdEventType = iArr;
            try {
                iArr[AdEvent.AdEventType.LOADED.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                $SwitchMap$com$google$ads$interactivemedia$v3$api$AdEvent$AdEventType[AdEvent.AdEventType.STARTED.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                $SwitchMap$com$google$ads$interactivemedia$v3$api$AdEvent$AdEventType[AdEvent.AdEventType.PAUSED.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                $SwitchMap$com$google$ads$interactivemedia$v3$api$AdEvent$AdEventType[AdEvent.AdEventType.RESUMED.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                $SwitchMap$com$google$ads$interactivemedia$v3$api$AdEvent$AdEventType[AdEvent.AdEventType.COMPLETED.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                $SwitchMap$com$google$ads$interactivemedia$v3$api$AdEvent$AdEventType[AdEvent.AdEventType.SKIPPED.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                $SwitchMap$com$google$ads$interactivemedia$v3$api$AdEvent$AdEventType[AdEvent.AdEventType.TAPPED.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                $SwitchMap$com$google$ads$interactivemedia$v3$api$AdEvent$AdEventType[AdEvent.AdEventType.ALL_ADS_COMPLETED.ordinal()] = 8;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                $SwitchMap$com$google$ads$interactivemedia$v3$api$AdEvent$AdEventType[AdEvent.AdEventType.AD_BREAK_FETCH_ERROR.ordinal()] = 9;
            } catch (NoSuchFieldError unused9) {
            }
        }
    }

    public class ButtonViewHolder extends RecyclerView.ViewHolder {
        private TextView detailButton;
        private LinearLayout detail_button_layout;
        private ProgressBar details_resume_btn_progress;
        private ImageView iv_play;

        public ButtonViewHolder(Context context, View view, FusionViliteMainActivity.ItemClickListener itemClickListener, List list) {
            super(view);
            this.detail_button_layout = (LinearLayout) view.findViewById(R.id.detail_button_layout);
            this.detailButton = (TextView) view.findViewById(R.id.detail_button);
            this.details_resume_btn_progress = (ProgressBar) view.findViewById(R.id.details_resume_btn_progress);
            this.iv_play = (ImageView) view.findViewById(R.id.iv_play);
        }
    }

    public class ButtonsViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
        public Context context;
        public List mList;
        private FusionViliteMainActivity.ItemClickListener onItemClickListener;

        public ButtonsViewAdapter(Context context, List list) {
            this.context = context;
            this.mList = list;
        }

        public int getItemCount() {
            return this.mList.size();
        }

        public int getItemViewType(int i2) {
            if (this.mList.get(i2) instanceof Content.Elements) {
                return 0;
            }
            return super.getItemViewType(i2);
        }

        public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, final int i2) {
            if (viewHolder instanceof ButtonViewHolder) {
                ButtonViewHolder buttonViewHolder = (ButtonViewHolder) viewHolder;
                final Content.Elements elements = (Content.Elements) this.mList.get(i2);
                if (elements == null || elements.getData() == null) {
                    return;
                }
                buttonViewHolder.detailButton.setText(elements.getData());
                if (elements.getData().toLowerCase().contains("watch") || com.yupptv.ott.fragments.b.a(elements, "resume") || com.yupptv.ott.fragments.b.a(elements, "start over") || com.yupptv.ott.fragments.b.a(elements, "trailer")) {
                    buttonViewHolder.iv_play.setVisibility(0);
                } else {
                    buttonViewHolder.iv_play.setVisibility(8);
                }
                if (com.yupptv.ott.fragments.b.a(elements, "resume")) {
                    buttonViewHolder.details_resume_btn_progress.setVisibility(8);
                    if (ExoPlayerFragment.this.resumeProgress != 0) {
                        buttonViewHolder.details_resume_btn_progress.setProgress(ExoPlayerFragment.this.resumeProgress);
                    }
                }
                buttonViewHolder.detailButton.setTextColor(ContextCompat.getColor(this.context, R.color.button_text_color));
                View.OnClickListener onClickListener = new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        String path;
                        if (ExoPlayerFragment.this.isButtonClicked) {
                            return;
                        }
                        ExoPlayerFragment.this.isButtonClicked = true;
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                ExoPlayerFragment.this.isButtonClicked = false;
                            }
                        }, 1000L);
                        Content.Elements elements2 = (Content.Elements) ButtonsViewAdapter.this.mList.get(i2);
                        if (elements2 == null || elements2.getData() == null) {
                            return;
                        }
                        if (!TextUtils.isEmpty(elements2.getElementType()) && elements2.getElementType().equalsIgnoreCase("button")) {
                            if (com.yupptv.ott.fragments.b.a(elements2, "watch now") || com.yupptv.ott.fragments.b.a(elements2, "resume") || com.yupptv.ott.fragments.b.a(elements, "start over")) {
                                Object obj = ExoPlayerFragment.this.itemObject;
                                if (obj != null && (obj instanceof ContentPage) && com.yupptv.ott.fragments.b.a(elements2, "watch now")) {
                                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                                    exoPlayerFragment.eventCTClickEvent((ContentPage) exoPlayerFragment.itemObject, "watchnow");
                                } else {
                                    Object obj2 = ExoPlayerFragment.this.itemObject;
                                    if (obj2 != null && (obj2 instanceof ContentPage) && com.yupptv.ott.fragments.b.a(elements2, "resume")) {
                                        ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                                        exoPlayerFragment2.eventCTClickEvent((ContentPage) exoPlayerFragment2.itemObject, "resume");
                                    } else {
                                        Object obj3 = ExoPlayerFragment.this.itemObject;
                                        if (obj3 != null && (obj3 instanceof ContentPage) && com.yupptv.ott.fragments.b.a(elements2, "start over")) {
                                            ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                                            exoPlayerFragment3.eventCTClickEvent((ContentPage) exoPlayerFragment3.itemObject, "start over");
                                        }
                                    }
                                }
                                if (elements2.getProperties() != null && !TextUtils.isEmpty(elements2.getProperties().getTemplate()) && !TextUtils.isEmpty(elements2.getProperties().getIsDeeplinking()) && elements2.getProperties().getIsDeeplinking().equalsIgnoreCase("true") && elements2.getProperties().getTemplate().equalsIgnoreCase("deeplink_info")) {
                                    ExoPlayerFragment.this.is_deeplink_info = true;
                                }
                            }
                            String template = (elements2.getProperties() == null || elements2.getProperties().getTemplate() == null) ? "" : elements2.getProperties().getTemplate();
                            if (((Content.Elements) ButtonsViewAdapter.this.mList.get(i2)).getElementSubtype().equalsIgnoreCase("signin")) {
                                ((FusionViliteMainActivity) ButtonsViewAdapter.this.context).launchSigninPage(false, -1);
                                ExoPlayerFragment.this.eventCTPlayerAction("sign in");
                                return;
                            }
                            if (((Content.Elements) ButtonsViewAdapter.this.mList.get(i2)).getElementSubtype() != null && ((Content.Elements) ButtonsViewAdapter.this.mList.get(i2)).getElementSubtype().equalsIgnoreCase("signup")) {
                                ExoPlayerFragment.this.eventCTPlayerAction("sign up");
                                return;
                            }
                            if (elements2.getElementSubtype() == null || !elements2.getElementSubtype().equalsIgnoreCase("upgrade")) {
                                if (elements2.getElementSubtype() == null || !elements2.getElementSubtype().equalsIgnoreCase("logoutfromCOCP")) {
                                    if (elements2.getElementSubtype() == null || !elements2.getElementSubtype().equalsIgnoreCase("rechargeSuspended")) {
                                        if ((elements2.getElementSubtype() == null || !elements2.getElementSubtype().equalsIgnoreCase("lsdk_upgrade_overlay")) && !template.equalsIgnoreCase("lsdk_upgrade_overlay")) {
                                            if ((elements2.getElementSubtype() != null && elements2.getElementSubtype().equalsIgnoreCase("lsdk_pro")) || template.equalsIgnoreCase("lsdk_pro")) {
                                                Object obj4 = ExoPlayerFragment.this.itemObject;
                                                path = obj4 instanceof ContentPage ? ((ContentPage) obj4).getPageInfo().getPath() : "";
                                                if (Utils.isVimtvAppInstalledOrNot(ButtonsViewAdapter.this.context, "com.vodafone.vodafoneplay")) {
                                                    template = template.concat("_installed");
                                                    String showvimtvappinstalledpopup = OttSDK.getInstance().getApplicationManager().getAppConfigurations().getShowvimtvappinstalledpopup();
                                                    if (!TextUtils.isEmpty(showvimtvappinstalledpopup) && showvimtvappinstalledpopup.equalsIgnoreCase("false")) {
                                                        String vimtvdeeplinkbaseurl = OttSDK.getInstance().getApplicationManager().getAppConfigurations().getVimtvdeeplinkbaseurl();
                                                        if (!TextUtils.isEmpty(vimtvdeeplinkbaseurl)) {
                                                            ButtonsViewAdapter.this.context.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(vimtvdeeplinkbaseurl + path)));
                                                            return;
                                                        }
                                                    }
                                                }
                                                ExoPlayerFragment exoPlayerFragment4 = ExoPlayerFragment.this;
                                                exoPlayerFragment4.getNoProAndProUserSheetDialog(exoPlayerFragment4.itemObject, "content watch now", template, path, DialogType.PRO_USER_POPUP_DIALOG);
                                                return;
                                            }
                                            if (elements2.getElementSubtype() != null && elements2.getElementSubtype().equalsIgnoreCase("subscribe")) {
                                                if (elements2.getProperties() == null || elements2.getProperties().getTemplate() == null) {
                                                    String path2 = ExoPlayerFragment.this.contentPageItem.getPageInfo().getPath();
                                                    FusionViliteMainActivity fusionViliteMainActivity = (FusionViliteMainActivity) ButtonsViewAdapter.this.context;
                                                    fusionViliteMainActivity.selectHomeOnPopFromWebView = true;
                                                    fusionViliteMainActivity.launchWebviewPlansPage(path2, null, "content watch now");
                                                    return;
                                                }
                                                Object obj5 = ExoPlayerFragment.this.itemObject;
                                                path = obj5 instanceof ContentPage ? ((ContentPage) obj5).getPageInfo().getPath() : "";
                                                ExoPlayerFragment exoPlayerFragment5 = ExoPlayerFragment.this;
                                                exoPlayerFragment5.getSubscribeSheetDialog(exoPlayerFragment5.itemObject, "content watch now", elements, path);
                                                ExoPlayerFragment.this.eventCTPlayerAction("subscribe");
                                                return;
                                            }
                                            if (!TextUtils.isEmpty(elements2.getElementSubtype()) && elements2.getElementSubtype().equalsIgnoreCase("rent")) {
                                                ExoPlayerFragment.this.eventCTPlayerAction("rent");
                                                return;
                                            }
                                        } else if (elements2.getProperties() != null && elements2.getProperties().getTemplate() != null) {
                                            Object obj6 = ExoPlayerFragment.this.itemObject;
                                            path = obj6 instanceof ContentPage ? ((ContentPage) obj6).getPageInfo().getPath() : "";
                                            ExoPlayerFragment exoPlayerFragment6 = ExoPlayerFragment.this;
                                            exoPlayerFragment6.getNoProAndProUserSheetDialog(exoPlayerFragment6.itemObject, "content watch now", template, path, DialogType.NO_PRO_USER_SHEET_DIALOG);
                                            return;
                                        }
                                    } else if (elements2.getProperties() != null && elements2.getProperties().getTemplate() != null) {
                                        Object obj7 = ExoPlayerFragment.this.itemObject;
                                        path = obj7 instanceof ContentPage ? ((ContentPage) obj7).getPageInfo().getPath() : "";
                                        ExoPlayerFragment exoPlayerFragment7 = ExoPlayerFragment.this;
                                        exoPlayerFragment7.getUserSuspendedSheetDialog(exoPlayerFragment7.itemObject, "content watch now", elements, path);
                                        ExoPlayerFragment.this.eventCTPlayerAction("recharge suspended");
                                        return;
                                    }
                                } else if (elements2.getProperties() != null && elements2.getProperties().getTemplate() != null) {
                                    Object obj8 = ExoPlayerFragment.this.itemObject;
                                    path = obj8 instanceof ContentPage ? ((ContentPage) obj8).getPageInfo().getPath() : "";
                                    ExoPlayerFragment exoPlayerFragment8 = ExoPlayerFragment.this;
                                    exoPlayerFragment8.getUserCocpSheetDialog(exoPlayerFragment8.itemObject, "content watch now", elements, path);
                                    ExoPlayerFragment.this.eventCTPlayerAction("cocp_logout");
                                    return;
                                }
                            } else if (elements2.getProperties() != null && elements2.getProperties().getTemplate() != null) {
                                Object obj9 = ExoPlayerFragment.this.itemObject;
                                path = obj9 instanceof ContentPage ? ((ContentPage) obj9).getPageInfo().getPath() : "";
                                ExoPlayerFragment exoPlayerFragment9 = ExoPlayerFragment.this;
                                exoPlayerFragment9.getUpgradeSheetDialog(exoPlayerFragment9.itemObject, "content watch now", elements, path);
                                ExoPlayerFragment.this.eventCTPlayerAction("upgrade");
                                return;
                            }
                            if (elements2.getProperties() != null && elements2.getProperties().getIsDeeplinking() != null && elements2.getProperties().getIsDeeplinking().trim().length() > 0 && elements2.getProperties().getIsDeeplinking().trim().equalsIgnoreCase("true")) {
                                if (elements2.getTarget() == null || elements2.getTarget().trim().length() <= 0) {
                                    return;
                                }
                                if (!ExoPlayerFragment.this.is_deeplink_info) {
                                    NavigationUtils.fetchDeepLinkInfo(elements2, ExoPlayerFragment.this.mActivity, elements2.getTarget());
                                    return;
                                }
                                ExoPlayerFragment.this.is_deeplink_info = false;
                                String target = elements2.getTarget();
                                HashMap<String, String> hashMap = new HashMap<>();
                                hashMap.put("dialog_template_code", elements2.getProperties().getTemplate());
                                hashMap.put("dialog_key_target_path", target);
                                ExoPlayerFragment.this.callRedirectDialog(hashMap);
                                return;
                            }
                        }
                        if (com.yupptv.ott.fragments.b.a(elements2, "resume")) {
                            ExoPlayerFragment.this.eventCTPlayerAction("resume");
                            if (ExoPlayerFragment.this.getActivity() instanceof FusionViliteMainActivity) {
                                ExoPlayerFragment.this.getActivity().setButtonType(ButtonType.RESUME);
                            }
                        }
                        if (com.yupptv.ott.fragments.b.a(elements2, "trailer")) {
                            ExoPlayerFragment.this.eventCTPlayerAction("trailer");
                            if (ExoPlayerFragment.this.getActivity() instanceof FusionViliteMainActivity) {
                                ExoPlayerFragment.this.getActivity().setButtonType(ButtonType.TRAILER);
                            }
                        }
                        if (com.yupptv.ott.fragments.b.a(elements2, "start over")) {
                            ExoPlayerFragment.this.eventCTPlayerAction("start over");
                            if (ExoPlayerFragment.this.getActivity() instanceof FusionViliteMainActivity) {
                                ExoPlayerFragment.this.getActivity().setButtonType(ButtonType.START_OVER);
                            }
                        }
                        ButtonsViewAdapter buttonsViewAdapter = ButtonsViewAdapter.this;
                        ExoPlayerFragment.this.watchNowButtonClicked = true;
                        NavigationUtils.launchNavigationFragment(((Content.Elements) buttonsViewAdapter.mList.get(i2)).getTarget(), ButtonsViewAdapter.this.context);
                    }
                };
                buttonViewHolder.detail_button_layout.setOnClickListener(onClickListener);
                buttonViewHolder.detailButton.setOnClickListener(onClickListener);
            }
        }

        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i2) {
            if (i2 != 0) {
                return null;
            }
            View inflate = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.detail_button_item_new, viewGroup, false);
            ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
            return exoPlayerFragment.new ButtonViewHolder(exoPlayerFragment.getActivity(), inflate, this.onItemClickListener, this.mList);
        }
    }

    public class NonceCallbackImpl implements OnSuccessListener<NonceManager>, OnFailureListener {
        private NonceCallbackImpl() {
        }

        public void onFailure(Exception exc) {
            CustomLog.e("Distro", "Nonce generation failed: " + exc.getMessage());
            ExoPlayerFragment.this.startDistroPlayback();
            NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "NonceCallbackImpl", "NA", "NA", "NA", "", exc.getMessage());
        }

        public void onSuccess(NonceManager nonceManager) {
            ExoPlayerFragment.this.palNonce = nonceManager.getNonce();
            CustomLog.i("Distro", "Generated nonce: " + ExoPlayerFragment.this.palNonce);
            ExoPlayerFragment.this.startDistroPlayback();
        }
    }

    public class SeasonViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
        public int carouselPosition;
        public Context context;
        public List mList;
        private FusionViliteMainActivity.ItemClickListener onItemClickListener;
        public boolean showCardTitle;

        public SeasonViewAdapter(Context context, List list, boolean z, int i2) {
            this.context = context;
            this.mList = list;
            this.showCardTitle = z;
            this.carouselPosition = i2;
        }

        public void lambda$onBindViewHolder$0(Card card, int i2, View view) {
            if (card.getTarget().getPath().equalsIgnoreCase(ExoPlayerFragment.this.getActivity().currentItemtargerPath) && ExoPlayerFragment.this.relatedVideos_layout_seasons.getVisibility() == 0) {
                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                if (!exoPlayerFragment.isLive) {
                    exoPlayerFragment.relatedVideos_layout_seasons.setVisibility(8);
                    return;
                }
            }
            if (card.getTarget().getPageType().equalsIgnoreCase("details")) {
                ExoPlayerFragment.this.navigatoToDetailsPage = true;
            }
            MyRecoManager.getInstance().setSubSourceDetailsForAnalytics("recommendations");
            MyRecoManager.getInstance().setSourceForAnalytics("player recommendations");
            MyRecoManager.getInstance().setSourceDetailsForAnalytics("Recommended for you");
            MyRecoManager.getInstance().setContentPosition(i2);
            MyRecoManager.getInstance().setCarouselPosition(this.carouselPosition);
            if (card.getTarget() != null && card.getTarget().getPageAttributes() != null) {
                MyRecoManager.getInstance().setContentTitle((y.a(card) == null || w.a(card) <= 0) ? "" : y.a(card));
                com.yupptv.ott.adapters.h.a(card, com.yupptv.ott.adapters.a.a(card, MyRecoManager.getInstance())).setContentGenre(card.getTarget().getPageAttributes().getGenre());
                MyRecoManager.getInstance().setContentPartnerName(card.getTarget().getPageAttributes().getNetworkName());
                String contentType = card.getTarget().getPageAttributes().getContentType();
                boolean z = false;
                if (contentType != null && (contentType.equalsIgnoreCase(Constants.CONTENT_TYPE_LIVE) || contentType.equalsIgnoreCase(Constants.CONTENT_TYPE_LIVE_TV) || contentType.equalsIgnoreCase(Constants.CONTENT_TYPE_EPG) || contentType.equalsIgnoreCase(Constants.CONTENT_TYPE_CHANNEL))) {
                    z = true;
                }
                if (!TextUtils.isEmpty(ExoPlayerFragment.this.contentPageItem.getPageInfo().getAttributes().getIsTrailerAvailable()) && ExoPlayerFragment.this.contentPageItem.getPageInfo().getAttributes().getIsTrailerAvailable().equalsIgnoreCase("true")) {
                    MyRecoManager.getInstance().setContentType("trailer");
                } else if (z) {
                    MyRecoManager.getInstance().setContentType(Constants.CONTENT_TYPE_LIVE);
                } else {
                    com.yupptv.ott.adapters.b.a(card, MyRecoManager.getInstance());
                }
                String a = com.yupptv.ott.adapters.j.a(card);
                String a2 = com.yupptv.ott.adapters.k.a(card);
                com.yupptv.ott.adapters.i.a(a).setContentLanguage(card.getTarget().getPageAttributes().getLanguage());
                MyRecoManager.getInstance().setContentTag(a2);
                MyRecoManager.getInstance().setPROMOTIONAL_VIEW("no");
                MyRecoManager.getInstance().setTAB_NAME("player");
            }
            ExoPlayerFragment.this.mPlayerControlView.trackEvents(AnalyticsUtils.EVENT_PLAYER_RECOMMENDATIONS, AnalyticsUtils.ATTRIBUTE_VALUE_RECOMMENDATIONS, card);
            ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
            if (!exoPlayerFragment2.navigatoToDetailsPage) {
                exoPlayerFragment2.mPlayerControlView.showProgress(true);
            }
            if (ExoPlayerFragment.this.getActivity() instanceof FusionViliteMainActivity) {
                ExoPlayerFragment.this.getActivity().setPlayerScreenSource(AnalyticsUtils.ATTRIBUTE_VALUE_RECOMMENDATIONS);
                ExoPlayerFragment.this.getActivity().setButtonType(ButtonType.NONE);
                ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                exoPlayerFragment3.clickdedOnCard = true;
                exoPlayerFragment3.getActivity().goToDetail(card);
            }
            if (ExoPlayerFragment.this.getActivity() != null) {
                CleverTap.moviesEventCTItemClick("", ExoPlayerFragment.this.getActivity(), card, "thumbnail", "na", "na");
            }
            if (ExoPlayerFragment.this.relatedVideos_layout.getVisibility() == 0) {
                ExoPlayerFragment exoPlayerFragment4 = ExoPlayerFragment.this;
                if (exoPlayerFragment4.isLive) {
                    exoPlayerFragment4.relatedVideos_layout.setVisibility(8);
                }
            }
            if (ExoPlayerFragment.this.relatedVideos_layout_seasons.getVisibility() == 0) {
                ExoPlayerFragment exoPlayerFragment5 = ExoPlayerFragment.this;
                if (!exoPlayerFragment5.isLive) {
                    exoPlayerFragment5.relatedVideos_layout_seasons.setVisibility(8);
                }
            }
            ExoPlayerFragment.this.relative_seasonui.setVisibility(8);
            ExoPlayerFragment.this.recommendation_control_backbutton.setVisibility(8);
        }

        public int getItemCount() {
            return this.mList.size();
        }

        public int getItemViewType(int i2) {
            if (this.mList.get(i2) instanceof Content.Elements) {
                return 0;
            }
            return super.getItemViewType(i2);
        }

        public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, final int i2) {
            TextView textView;
            if (viewHolder instanceof SeasonViewHolder) {
                SeasonViewHolder seasonViewHolder = (SeasonViewHolder) viewHolder;
                seasonViewHolder.badgeMarker.setVisibility(4);
                seasonViewHolder.markerTag.setVisibility(4);
                seasonViewHolder.markerSeek.setVisibility(8);
                seasonViewHolder.nowplayingTextview.setVisibility(8);
                seasonViewHolder.leftOverTime.setVisibility(8);
                seasonViewHolder.live_badge.setVisibility(8);
                seasonViewHolder.free_badge.setVisibility(8);
                seasonViewHolder.iv_free_episode_badge.setVisibility(8);
                seasonViewHolder.free_episode_badge.setVisibility(8);
                seasonViewHolder.free_episode_badge_text.setVisibility(8);
                seasonViewHolder.premium_badge.setVisibility(8);
                seasonViewHolder.titleTextView.setVisibility(8);
                seasonViewHolder.subTitleTextView.setVisibility(8);
                seasonViewHolder.cardView.getLayoutParams().width = ExoPlayerFragment.this.getContext().getResources().getDimensionPixelSize(R.dimen._130sdp);
                final Card card = (Card) this.mList.get(i2);
                if (APIUtils.getmMediaManager(ExoPlayerFragment.this.getContext()) != null && card.getDisplay().getImageUrl() != null) {
                    RequestBuilder a = t.a(card, ExoPlayerFragment.this.getContext(), Glide.with(OTTApplication.getContext()));
                    int i3 = R.drawable.default_poster;
                    a.error(i3).placeholder(i3).transition(DrawableTransitionOptions.withCrossFade()).into(seasonViewHolder.posterImageView);
                    seasonViewHolder.posterImageView.setVisibility(0);
                }
                if (card != null && card.getDisplay() != null && card.getDisplay().getPartnerIcon() != null && !a0.a(card, "")) {
                    seasonViewHolder.partnerIcon.setVisibility(0);
                    u.a(card, ExoPlayerFragment.this.getContext(), Glide.with(OTTApplication.getContext())).error(R.drawable.default_poster).transition(DrawableTransitionOptions.withCrossFade()).into(seasonViewHolder.partnerIcon);
                }
                if (this.showCardTitle) {
                    if (card.getDisplay().getTitle() == null || b0.a(card)) {
                        seasonViewHolder.titleTextView.setVisibility(8);
                    } else {
                        z.a(card, seasonViewHolder.titleTextView);
                        seasonViewHolder.titleTextView.setVisibility(0);
                    }
                    if (card.getDisplay().getSubtitle1() == null || card.getDisplay().getSubtitle1().trim().isEmpty()) {
                        seasonViewHolder.subTitleTextView.setVisibility(8);
                    } else {
                        a.a(card, seasonViewHolder.subTitleTextView);
                        seasonViewHolder.subTitleTextView.setVisibility(0);
                    }
                }
                if (card.getDisplay().getMarkers() != null && !card.getDisplay().getMarkers().isEmpty()) {
                    for (int i4 = 0; i4 < com.yupptv.ott.c.a(card); i4++) {
                        ((Card.PosterDisplay.Marker) com.yupptv.ott.d.a(card, i4)).getMarkerType();
                        String value = card.getDisplay().getMarkers().get(i4).getValue();
                        if (card.getDisplay() != null && card.getDisplay().getMarkers() != null && com.yupptv.ott.d.a(card, i4) != null && !TextUtils.isEmpty(((Card.PosterDisplay.Marker) com.yupptv.ott.d.a(card, i4)).getMarkerType()) && ((Card.PosterDisplay.Marker) com.yupptv.ott.d.a(card, i4)).getMarkerType().equalsIgnoreCase("freeepisodebadge") && !TextUtils.isEmpty(value) && !TextUtils.isEmpty(((Card.PosterDisplay.Marker) com.yupptv.ott.d.a(card, i4)).getTextColor()) && !TextUtils.isEmpty(((Card.PosterDisplay.Marker) com.yupptv.ott.d.a(card, i4)).getBgColor()) && (textView = seasonViewHolder.free_episode_badge_text) != null && seasonViewHolder.free_episode_badge != null) {
                            textView.setText(value);
                            seasonViewHolder.free_episode_badge_text.setTextColor(Color.parseColor(((Card.PosterDisplay.Marker) com.yupptv.ott.d.a(card, i4)).getTextColor()));
                            Drawable drawable = ContextCompat.getDrawable(seasonViewHolder.free_episode_badge.getContext(), R.drawable.free_episode_background);
                            Objects.requireNonNull(drawable);
                            GradientDrawable gradientDrawable = (GradientDrawable) drawable.mutate();
                            gradientDrawable.setColor(Color.parseColor(((Card.PosterDisplay.Marker) com.yupptv.ott.d.a(card, i4)).getBgColor()));
                            seasonViewHolder.free_episode_badge.setBackground(gradientDrawable);
                            seasonViewHolder.free_episode_badge.setVisibility(0);
                            seasonViewHolder.free_episode_badge_text.setVisibility(0);
                        }
                        if (((Card.PosterDisplay.Marker) com.yupptv.ott.d.a(card, i4)).getValue().equalsIgnoreCase("now_playing")) {
                            seasonViewHolder.nowplayingTextview.setVisibility(0);
                        } else if (((Card.PosterDisplay.Marker) com.yupptv.ott.d.a(card, i4)).getMarkerType().equalsIgnoreCase("badge")) {
                            if (value.equalsIgnoreCase("free")) {
                                seasonViewHolder.free_badge.setVisibility(0);
                                seasonViewHolder.premium_badge.setVisibility(8);
                            } else if (value.equalsIgnoreCase("premium")) {
                                seasonViewHolder.premium_badge.setVisibility(0);
                                seasonViewHolder.free_badge.setVisibility(8);
                            }
                            if (value.equalsIgnoreCase("free_episode")) {
                                seasonViewHolder.iv_free_episode_badge.setVisibility(0);
                            }
                        } else if (((Card.PosterDisplay.Marker) com.yupptv.ott.d.a(card, i4)).getMarkerType().equalsIgnoreCase("tag")) {
                            seasonViewHolder.markerTag.setVisibility(0);
                            UiUtils.setMarker(card.getDisplay().getMarkers().get(i4), seasonViewHolder.markerTag, seasonViewHolder.cardView.getContext());
                        } else if (((Card.PosterDisplay.Marker) com.yupptv.ott.d.a(card, i4)).getMarkerType().equalsIgnoreCase("seek")) {
                            seasonViewHolder.markerSeek.setVisibility(0);
                            if (value != null) {
                                seasonViewHolder.markerSeek.setProgress((int) (Double.parseDouble(((Card.PosterDisplay.Marker) com.yupptv.ott.d.a(card, i4)).getValue()) * 100.0d));
                            }
                        }
                    }
                }
                seasonViewHolder.cardView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        ExoPlayerFragment.SeasonViewAdapter.this.lambda$onBindViewHolder$0(card, i2, view);
                    }
                });
            }
        }

        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i2) {
            return new SeasonViewHolder(ExoPlayerFragment.this.getActivity(), LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.sheet_poster, viewGroup, false), this.onItemClickListener, this.mList);
        }

        public void updateDataList(List<Card> list) {
            this.mList.clear();
            this.mList.addAll(list);
        }
    }

    public static class SeasonViewHolder extends RecyclerView.ViewHolder {
        public TextView badgeMarker;
        public View cardView;
        public CheckBox checkBox;
        public LinearLayout footerTag;
        public ImageView free_badge;
        public RelativeLayout free_episode_badge;
        public TextView free_episode_badge_text;
        public ImageView iv_free_episode_badge;
        public TextView leftOverTime;
        public ImageView live_badge;
        public TextView markerRecord;
        public ProgressBar markerSeek;
        public TextView markerTag;
        public TextView nowplayingTextview;
        public ImageView partnerIcon;
        public ImageView posterImageView;
        public ImageView premium_badge;
        public TextView subTitleTextView;
        public TextView titleTextView;

        public SeasonViewHolder(Context context, View view, FusionViliteMainActivity.ItemClickListener itemClickListener, List list) {
            super(view);
            this.cardView = ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.poster_root);
            this.posterImageView = (ImageView) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.poster_image);
            this.titleTextView = (TextView) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.title);
            this.subTitleTextView = (TextView) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.sub_title);
            this.badgeMarker = (TextView) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.marker_badge);
            this.iv_free_episode_badge = (ImageView) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.iv_free_episode_badge);
            this.markerTag = (TextView) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.marker_tag);
            this.markerRecord = (TextView) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.marker_record);
            this.markerSeek = (ProgressBar) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.marker_seek);
            this.nowplayingTextview = (TextView) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.now_playing_marker);
            this.leftOverTime = (TextView) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.leftOverTime);
            this.footerTag = (LinearLayout) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.footer_tag);
            this.checkBox = (CheckBox) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.select_radio_btn);
            this.partnerIcon = (ImageView) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.partnerIcon);
            this.live_badge = (ImageView) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.live_marker_badge);
            this.free_badge = (ImageView) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.iv_free_badge);
            this.free_episode_badge = (RelativeLayout) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.free_episode_badge);
            this.free_episode_badge_text = (TextView) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.free_episode_badge_text);
            this.premium_badge = (ImageView) ((RecyclerView.ViewHolder) this).itemView.findViewById(R.id.iv_premium_badge);
            this.titleTextView.setMaxLines(Constants.POSTER_MAX_LINES);
            ViewGroup.LayoutParams layoutParams = this.cardView.getLayoutParams();
            Resources resources = ((RecyclerView.ViewHolder) this).itemView.getResources();
            int i2 = R.dimen._130sdp;
            layoutParams.width = resources.getDimensionPixelSize(i2);
            this.titleTextView.getLayoutParams().width = ((RecyclerView.ViewHolder) this).itemView.getResources().getDimensionPixelSize(i2);
            this.titleTextView.setGravity(3);
        }
    }

    public static abstract class VideoListener {
        public void onVideoStarted() {
        }

        public void onVideoStopped() {
        }
    }

    public class VolumeChangeReceiver extends BroadcastReceiver {
        private ExoPlayerFragment exoPlayerFragment;

        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equals("android.media.VOLUME_CHANGED_ACTION")) {
                this.exoPlayerFragment.updateVolumeUI(((Integer) intent.getExtras().get("android.media.EXTRA_VOLUME_STREAM_VALUE")).intValue());
            }
        }

        private VolumeChangeReceiver(ExoPlayerFragment exoPlayerFragment) {
            this.exoPlayerFragment = exoPlayerFragment;
        }
    }

    static {
        CookieManager cookieManager = new CookieManager();
        DEFAULT_COOKIE_MANAGER = cookieManager;
        cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ORIGINAL_SERVER);
    }

    public void LaunchResumeOrStartOverDialog(Long l, final String str) {
        ButtonType buttonType;
        if (l.longValue() > 0 || ((buttonType = this.mButtonType) != null && (buttonType == ButtonType.RESUME || buttonType == ButtonType.START_OVER))) {
            this.playerPosition = l.longValue();
        }
        this.shouldRestorePosition = true;
        updateSurfaceView(true);
        this.mHandler.post(new Runnable() {
            @Override
            public void run() {
                ExoPlayerFragment.this.mPlayerBundle.putString("playerurl", ExoPlayerFragment.this.mUrl);
                if (ExoPlayerFragment.this.getActivity() != null) {
                    ExoPlayerFragment.this.shouldAutoPlay = true;
                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                    exoPlayerFragment.initializePlayer(exoPlayerFragment.mPlayerBundle);
                    if (ExoPlayerFragment.this.contentPageItem != null) {
                        ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                        exoPlayerFragment2.fetchRecommendations(exoPlayerFragment2.contentPageItem.getPageData());
                    }
                    ExoPlayerFragment.this.showReplayButton(false);
                    String str2 = str;
                    if (str2 != null) {
                        ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                        exoPlayerFragment3.mNextVideoObject = null;
                        exoPlayerFragment3.getNextVideo(str2);
                    }
                }
            }
        });
    }

    private void ShowFreeEpisodeError(String str, String str2, final String str3) {
        try {
            this.parent_access_layout.setVisibility(8);
            MediaCatalogManager[] mediaCatalogManagerArr = {APIUtils.getmMediaManager(requireContext())};
            RestAdapter.enableCache(false);
            mediaCatalogManagerArr[0].getBottomTemplateInfo(str, str2, new MediaCatalogManager.MediaCatalogCallback<BottomTemplateInfo>() {
                @Override
                public void onFailure(Error error) {
                    ExoPlayerFragment.this.showProgress(false);
                    NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "/service/api/v1/template/data", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
                }

                @Override
                public void onSuccess(BottomTemplateInfo bottomTemplateInfo) {
                    ExoPlayerFragment.this.trailer_back_layout.setVisibility(8);
                    ExoPlayerFragment.this.showProgress(false);
                    final BottomTemplateInfo.TemplateInfo data = bottomTemplateInfo.getData();
                    if (data == null || ExoPlayerFragment.this.mActivity == null) {
                        return;
                    }
                    String[] split = data.getName().split("\\$");
                    SpannableString spannableString = new SpannableString(data.getName().replace("$", ""));
                    int i2 = 0;
                    for (int i3 = 0; i3 < split.length; i3++) {
                        if (i3 % 2 == 0) {
                            spannableString.setSpan(new ForegroundColorSpan(ExoPlayerFragment.this.getResources().getColor(R.color.white)), i2, split[i3].length() + i2, 33);
                        } else {
                            spannableString.setSpan(new ForegroundColorSpan(ExoPlayerFragment.this.getResources().getColor(R.color.tab_selected_color)), i2, split[i3].length() + i2, 33);
                        }
                        i2 += split[i3].length();
                    }
                    ExoPlayerFragment.this.titleTV.setText(spannableString);
                    ExoPlayerFragment.this.free_episode_details_TV.setText(data.getDescription());
                    ExoPlayerFragment.this.subscribe_btn.setText(data.getButton());
                    ExoPlayerFragment.this.ctEventPopup("subscription overlay", "subscription overlay", "na", "popup displayed", str3);
                    ExoPlayerFragment.this.background_image.setAlpha(0.4f);
                    ExoPlayerFragment.this.img_back.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            if (ExoPlayerFragment.this.getActivity() != null) {
                                ExoPlayerFragment.this.getActivity().onBackPressed();
                            }
                            AnonymousClass2 anonymousClass2 = AnonymousClass2.this;
                            ExoPlayerFragment.this.ctEventPopup("subscription overlay", "subscription overlay", "Top Back", "popup closed", str3);
                        }
                    });
                    ExoPlayerFragment.this.subscribe_btn.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            String target_button = !TextUtils.isEmpty(data.getTarget_button()) ? data.getTarget_button() : null;
                            if (!TextUtils.isEmpty(target_button)) {
                                ExoPlayerFragment.this.mActivity.launchWebviewPlansPage(target_button, null, "subscription overlay");
                            }
                            AnonymousClass2 anonymousClass2 = AnonymousClass2.this;
                            ExoPlayerFragment.this.ctEventPopup("subscription overlay", "subscription overlay", "Subscribe Now", "button clicked", str3);
                        }
                    });
                    if (ExoPlayerFragment.this.getActivity() != null) {
                        if (ExoPlayerFragment.this.getActivity().getResources().getConfiguration().orientation != 1) {
                            ExoPlayerFragment.this.mOrientationUtils.shrinkToPotraitMode();
                        }
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                ExoPlayerFragment.this.freeErrorEpisodePopup.setVisibility(0);
                            }
                        }, 200L);
                    }
                }
            });
        } catch (Exception unused) {
        }
    }

    private AdEvent.AdEventListener buildAdEventListener() {
        return new AdEvent.AdEventListener() {
            public final void onAdEvent(AdEvent adEvent) {
                ExoPlayerFragment.this.lambda$buildAdEventListener$6(adEvent);
            }
        };
    }

    private DataSource.Factory buildDataSourceFactory(boolean z) {
        String str;
        String str2 = this.mAesSession;
        return (str2 == null || str2.trim().length() <= 0 || (str = this.mAesToken) == null || str.trim().length() <= 0) ? OTTApplication.getInstance().buildDataSourceFactory() : OTTApplication.getInstance().buildDataSourceFactory(this.mAesSession, this.mAesToken);
    }

    private HttpDataSource.Factory buildHttpDataSourceFactory(boolean z) {
        return OTTApplication.getInstance().buildHttpDataSourceFactory(z ? BANDWIDTH_METER : null);
    }

    private View buildView(LayoutInflater layoutInflater, Context context) {
        View inflate = layoutInflater.inflate(R.layout.playback_speed_selection, (ViewGroup) null);
        ViewGroup viewGroup = (ViewGroup) inflate.findViewById(R.id.root);
        this.paddingLeft = (int) context.getResources().getDimension(R.dimen.screen_content_margin);
        this.playbackSpeedViews = new CheckedTextView[this.playerSpeedsList.length];
        for (int i2 = 0; i2 < this.playerSpeedsList.length; i2++) {
            CheckedTextView checkedTextView = (CheckedTextView) layoutInflater.inflate(android.R.layout.simple_list_item_single_choice, viewGroup, false);
            int i3 = this.paddingLeft;
            checkedTextView.setPadding(i3, 0, i3, 0);
            checkedTextView.setText(this.playerSpeedsList[i2]);
            checkedTextView.setTextColor(this.mActivity.getResources().getColor(R.color.manatee));
            checkedTextView.setFocusable(true);
            checkedTextView.setTag(Integer.valueOf(i2));
            checkedTextView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    ExoPlayerFragment.this.currentSpeedIndex = ((Integer) view.getTag()).intValue();
                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                    exoPlayerFragment.setPlayBackSpeed(Float.parseFloat(exoPlayerFragment.playerSpeeds[ExoPlayerFragment.this.currentSpeedIndex]));
                    ExoPlayerFragment.this.mDialog.dismiss();
                }
            });
            this.playbackSpeedViews[i2] = checkedTextView;
            viewGroup.addView(checkedTextView);
        }
        updateViews();
        return inflate;
    }

    public void cancelNextVideoTimer() {
        CountDownTimer countDownTimer = this.timer;
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
    }

    public void changeBgColorAnimate(final LinearLayout linearLayout, boolean z) {
        ValueAnimator ofObject;
        if (getContext() != null) {
            int color = getContext().getResources().getColor(R.color.transparent);
            int color2 = getContext().getResources().getColor(R.color.black_47);
            if (z) {
                PlayerControlView playerControlView = this.mPlayerControlView;
                if (playerControlView instanceof PlayerControlView) {
                    playerControlView.isShowControls = true;
                }
                ofObject = ValueAnimator.ofObject(new ArgbEvaluator(), Integer.valueOf(color), Integer.valueOf(color2));
            } else {
                PlayerControlView playerControlView2 = this.mPlayerControlView;
                if (playerControlView2 instanceof PlayerControlView) {
                    playerControlView2.isShowControls = false;
                }
                ofObject = ValueAnimator.ofObject(new ArgbEvaluator(), Integer.valueOf(color), Integer.valueOf(color));
            }
            ofObject.setDuration(150L);
            ofObject.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator valueAnimator) {
                    linearLayout.setBackgroundColor(((Integer) valueAnimator.getAnimatedValue()).intValue());
                }
            });
            ofObject.start();
        }
    }

    private void changeButtonTextColorSequentially(final AppCompatButton appCompatButton, final List<Integer> list, final long j) {
        final String charSequence = appCompatButton.getText().toString();
        final SpannableString spannableString = new SpannableString(charSequence);
        final int[] iArr = {0};
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                if (iArr[0] > 0) {
                    SpannableString spannableString2 = spannableString;
                    ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(-16777216);
                    int i2 = iArr[0];
                    spannableString2.setSpan(foregroundColorSpan, i2 - 1, i2, 33);
                }
                SpannableString spannableString3 = spannableString;
                List list2 = list;
                ForegroundColorSpan foregroundColorSpan2 = new ForegroundColorSpan(((Integer) list2.get(iArr[0] % list2.size())).intValue());
                int i3 = iArr[0];
                spannableString3.setSpan(foregroundColorSpan2, i3, i3 + 1, 33);
                appCompatButton.setText(spannableString);
                int[] iArr2 = iArr;
                int i4 = iArr2[0] + 1;
                iArr2[0] = i4;
                if (i4 < charSequence.length()) {
                    ExoPlayerFragment.this.nextEpisodeHandler.postDelayed(this, j);
                }
            }
        };
        this.nextEpisodeRunnable = runnable;
        this.nextEpisodeHandler.removeCallbacks(runnable);
        this.nextEpisodeHandler.postDelayed(this.nextEpisodeRunnable, j * 2);
    }

    private ImaServerSideAdInsertionMediaSource.AdsLoader createAdsLoader() {
        ImaServerSideAdInsertionMediaSource.AdsLoader.Builder builder = new ImaServerSideAdInsertionMediaSource.AdsLoader.Builder(this.mActivity, this.simpleExoPlayerView);
        ImaServerSideAdInsertionMediaSource.AdsLoader.State state = this.imaDaiAdsLoaderState;
        if (state != null) {
            builder.setAdsLoaderState(state);
        }
        return builder.setAdEventListener(buildAdEventListener()).build();
    }

    private MediaItem createMediaItem(Bundle bundle, Uri uri) {
        MediaItem build;
        String string = bundle.getString("drm_license_url");
        String[] stringArray = bundle.getStringArray("drm_key_request_properties");
        UUID uuid = null;
        try {
            if (bundle.containsKey("drm_scheme_uuid")) {
                uuid = UUID.fromString(bundle.getString("drm_scheme_uuid"));
            }
        } catch (Exception unused) {
        }
        DownloadRequest downloadRequest = OTTApplication.getInstance().getDownloadTracker().getDownloadRequest(uri);
        if (downloadRequest != null) {
            HashMap hashMap = new HashMap();
            if (uuid != null && stringArray != null) {
                for (int i2 = 0; i2 < stringArray.length; i2 += 2) {
                    hashMap.put(stringArray[i2], stringArray[i2 + 1]);
                }
            }
            return new MediaItem.Builder().setMediaId(downloadRequest.id).setUri(downloadRequest.uri).setCustomCacheKey(downloadRequest.customCacheKey).setMimeType(downloadRequest.mimeType).setStreamKeys(downloadRequest.streamKeys).setDrmKeySetId(downloadRequest.keySetId).setDrmLicenseRequestHeaders(hashMap).setDrmUuid(uuid).setDrmLicenseUri(string).build();
        }
        String adaptiveMimeTypeForContentType = Util.getAdaptiveMimeTypeForContentType(Util.inferContentType(uri));
        if (uuid != null) {
            HashMap hashMap2 = new HashMap();
            if (stringArray != null) {
                for (int i3 = 0; i3 < stringArray.length; i3 += 2) {
                    hashMap2.put(stringArray[i3], stringArray[i3 + 1]);
                }
            }
            HashMap<String, String> hashMap3 = this.drmExtraHeaders;
            if (hashMap3 != null) {
                for (Map.Entry<String, String> entry : hashMap3.entrySet()) {
                    hashMap2.put(entry.getKey(), entry.getValue());
                }
            }
            MediaItem.DrmConfiguration build2 = new MediaItem.DrmConfiguration.Builder(uuid).setLicenseUri(Uri.parse(string)).setLicenseRequestHeaders(hashMap2).build();
            Uri adTagUri = getAdTagUri();
            CustomLog.d("DEBUG", "adtag " + adTagUri);
            if (adTagUri == null || TextUtils.isEmpty(adTagUri.toString())) {
                releaseAdsLoader();
                build = new MediaItem.Builder().setUri(uri).setMimeType(adaptiveMimeTypeForContentType).setDrmConfiguration(build2).build();
            } else {
                build = new MediaItem.Builder().setUri(uri).setMimeType(adaptiveMimeTypeForContentType).setAdsConfiguration(new MediaItem.AdsConfiguration.Builder(adTagUri).build()).setDrmConfiguration(build2).build();
            }
        } else {
            Uri adTagUri2 = getAdTagUri();
            if (adTagUri2 == null || TextUtils.isEmpty(adTagUri2.toString())) {
                releaseAdsLoader();
                build = new MediaItem.Builder().setUri(uri).setMimeType(adaptiveMimeTypeForContentType).build();
            } else {
                build = new MediaItem.Builder().setUri(uri).setMimeType(adaptiveMimeTypeForContentType).setAdsConfiguration(new MediaItem.AdsConfiguration.Builder(adTagUri2).build()).build();
            }
        }
        ArrayList arrayList = new ArrayList();
        StreamResponse streamResponse = this.streamResponseObject;
        if (streamResponse == null || streamResponse.getStreams() == null || this.streamResponseObject.getStreams().size() <= 0 || this.streamResponseObject.getStreams().get(0).getCloseCaptions() == null) {
            StreamResponse streamResponse2 = this.streamResponseObject;
            if (streamResponse2 != null && streamResponse2.getStreams() != null && this.streamResponseObject.getStreams().size() > 0 && this.streamResponseObject.getStreams().get(0).getUrl() != null) {
                String str = this.streamResponseObject.getStreams().get(0).getUrl().toString();
                if (str.contains(".m3u8") && !this.isLive) {
                    String replace = str.replace(".m3u8", ".vtt");
                    this.isSubtitleAvailable = true;
                    Uri parse = Uri.parse(replace);
                    if (parse != null && !TextUtils.isEmpty(parse.toString())) {
                        arrayList.add(new MediaItem.SubtitleConfiguration.Builder(parse).setMimeType("text/vtt").build());
                    }
                }
            }
        } else if (this.streamResponseObject.getStreams().get(0).getCloseCaptions().getCcList() != null) {
            this.isSubtitleAvailable = true;
            if (this.streamResponseObject.getStreams().get(0).getCloseCaptions().getDefaultLang() != null) {
                this.defaultCaptions = this.streamResponseObject.getStreams().get(0).getCloseCaptions().getDefaultLang();
            }
            for (int i4 = 0; i4 < this.streamResponseObject.getStreams().get(0).getCloseCaptions().getCcList().size(); i4++) {
                Uri parse2 = Uri.parse(APIUtils.getAbsoluteImagePath(getContext().getApplicationContext(), this.streamResponseObject.getStreams().get(0).getCloseCaptions().getCcList().get(i4).getFilePath()));
                if (parse2 != null && !TextUtils.isEmpty(parse2.toString())) {
                    arrayList.add(new MediaItem.SubtitleConfiguration.Builder(parse2).setMimeType(getCaptionsMimeType(this.streamResponseObject.getStreams().get(0).getCloseCaptions().getCcList().get(i4).getFileType())).setLanguage(this.streamResponseObject.getStreams().get(0).getCloseCaptions().getCcList().get(i4).getLanguage()).setSelectionFlags(1).build());
                }
            }
        }
        return arrayList.size() > 0 ? build.buildUpon().setSubtitleConfigurations(arrayList).build() : build;
    }

    private java.util.Map<java.lang.String, java.lang.String> createTags(java.lang.String r18, java.lang.String r19, java.lang.String r20, java.lang.String r21, java.lang.String r22, java.lang.String r23) {
        throw new UnsupportedOperationException("Method not decompiled: com.yupptv.ott.player.ExoPlayerFragment.createTags(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String):java.util.Map");
    }

    public void eventCTClickEvent(ContentPage contentPage, String str) {
        String str2;
        String str3;
        String str4;
        String str5;
        String str6 = str;
        String tracking_id = MyRecoManager.getInstance().getTRACKING_ID();
        if (TextUtils.isEmpty(tracking_id)) {
            str2 = "na";
            str3 = str2;
        } else {
            str2 = tracking_id;
            str3 = "MyReco";
        }
        String contentTitle = MyRecoManager.getInstance().getContentTitle();
        this.contentGenre = MyRecoManager.getInstance().getContentGenre();
        this.contentLanguage = MyRecoManager.getInstance().getContentLanguage();
        this.contentPartnerName = MyRecoManager.getInstance().getContentPartnerName();
        if (TextUtils.isEmpty(contentPage.getPageInfo().getAttributes().getIsTrailerAvailable()) || !contentPage.getPageInfo().getAttributes().getIsTrailerAvailable().equalsIgnoreCase("true")) {
            StreamResponse streamResponse = this.lastStreamResponse;
            if (streamResponse == null || TextUtils.isEmpty(streamResponse.getPageAttributes().getFirstEpisodeFreeFullAccessText())) {
                this.contentType = MyRecoManager.getInstance().getContentType();
            } else {
                this.contentType = "tvshow";
            }
        } else {
            this.contentType = "trailer";
        }
        String contentModel = MyRecoManager.getInstance().getContentModel();
        String contentTag = MyRecoManager.getInstance().getContentTag();
        this.contentId = MyRecoManager.getInstance().getContentId();
        this.tvShowName = MyRecoManager.getInstance().getContentTvShowName();
        this.mContentPosition = MyRecoManager.getInstance().getContentPosition();
        this.carouselPosition = MyRecoManager.getInstance().getCarouselPosition();
        this.source = MyRecoManager.getInstance().getSourceForAnalytics();
        this.sourceDetails = MyRecoManager.getInstance().getSourceDetailsForAnalytics();
        this.subSourceDetails = MyRecoManager.getInstance().getSubSourceDetailsForAnalytics();
        String promotional_view = MyRecoManager.getInstance().getPROMOTIONAL_VIEW();
        String str7 = getActivity() != null ? getActivity().bottomTabSelected : "";
        if (str6.equalsIgnoreCase("topback")) {
            str6 = "Top Back";
        } else if (!str6.equalsIgnoreCase("watchnow")) {
            if (str6.equalsIgnoreCase("Subscribe Now")) {
                this.source = "subscription overlay";
            } else if (str6.equalsIgnoreCase("watch with subscription")) {
                this.source = "watch with subscription";
            } else if (!str6.equalsIgnoreCase("resume") && !str6.equalsIgnoreCase("start over")) {
                if (str6.equalsIgnoreCase("get full access")) {
                    this.source = "player nudge";
                } else {
                    if (!str6.equalsIgnoreCase("mute_button")) {
                        str4 = "";
                        str5 = str4;
                        StreamResponse streamResponse2 = this.streamResponseObject;
                        CleverTap.moviesEventClicked(promotional_view, str4, str5, contentTitle, this.contentGenre, this.contentType, this.contentLanguage, this.contentPartnerName, this.contentId, this.source, this.sourceDetails, this.subSourceDetails, str7, (streamResponse2 != null || streamResponse2.getStreamStatus() == null) ? 0 : (int) TimeUnit.MILLISECONDS.toSeconds(this.streamResponseObject.getStreamStatus().getTotalDurationInMillis().longValue()), this.tvShowName, contentModel, contentTag, this.mContentPosition, this.carouselPosition, str2, str3);
                    }
                    ExoPlayer exoPlayer = this.player;
                    if (exoPlayer == null || exoPlayer.getVolume() != 0.0f) {
                        str6 = "unmute_button";
                    }
                    this.source = "player mute";
                }
            }
        }
        str5 = str6;
        str4 = "button";
        StreamResponse streamResponse22 = this.streamResponseObject;
        CleverTap.moviesEventClicked(promotional_view, str4, str5, contentTitle, this.contentGenre, this.contentType, this.contentLanguage, this.contentPartnerName, this.contentId, this.source, this.sourceDetails, this.subSourceDetails, str7, (streamResponse22 != null || streamResponse22.getStreamStatus() == null) ? 0 : (int) TimeUnit.MILLISECONDS.toSeconds(this.streamResponseObject.getStreamStatus().getTotalDurationInMillis().longValue()), this.tvShowName, contentModel, contentTag, this.mContentPosition, this.carouselPosition, str2, str3);
    }

    private void eventCTVideoDetailsViewed() {
        String str;
        String str2;
        String contentType;
        String tracking_id = MyRecoManager.getInstance().getTRACKING_ID();
        if (TextUtils.isEmpty(tracking_id)) {
            str = "na";
            str2 = str;
        } else {
            str2 = tracking_id;
            str = "MyReco";
        }
        String promotional_view = MyRecoManager.getInstance().getPROMOTIONAL_VIEW();
        String contentTitle = MyRecoManager.getInstance().getContentTitle();
        String contentGenre = MyRecoManager.getInstance().getContentGenre();
        String contentLanguage = MyRecoManager.getInstance().getContentLanguage();
        String contentPartnerName = MyRecoManager.getInstance().getContentPartnerName();
        if (TextUtils.isEmpty(this.contentPageItem.getPageInfo().getAttributes().getIsTrailerAvailable()) || !this.contentPageItem.getPageInfo().getAttributes().getIsTrailerAvailable().equalsIgnoreCase("true")) {
            StreamResponse streamResponse = this.lastStreamResponse;
            contentType = (streamResponse == null || TextUtils.isEmpty(streamResponse.getPageAttributes().getFirstEpisodeFreeFullAccessText())) ? MyRecoManager.getInstance().getContentType() : "tvshow";
        } else {
            contentType = "trailer";
        }
        String str3 = contentType;
        String contentModel = MyRecoManager.getInstance().getContentModel();
        String contentTag = MyRecoManager.getInstance().getContentTag();
        String contentId = MyRecoManager.getInstance().getContentId();
        String contentTvShowName = MyRecoManager.getInstance().getContentTvShowName();
        int contentPosition = MyRecoManager.getInstance().getContentPosition();
        CleverTap.moviesEventVideoDetailsViewed(promotional_view, MyRecoManager.getInstance().getSourceForAnalytics(), MyRecoManager.getInstance().getSourceDetailsForAnalytics(), MyRecoManager.getInstance().getSubSourceDetailsForAnalytics(), MyRecoManager.getInstance().getCarouselPosition(), contentPosition, contentId, contentTitle, contentLanguage, contentPartnerName, contentModel, contentTag, str3, contentGenre, contentTvShowName, 0, "", getActivity() != null ? getActivity().bottomTabSelected : "Home", str, str2);
    }

    private void eventCTVideoStarted() {
        String str;
        String str2;
        StreamResponse streamResponse;
        String tracking_id = MyRecoManager.getInstance().getTRACKING_ID();
        if (TextUtils.isEmpty(tracking_id)) {
            str = "na";
            str2 = str;
        } else {
            str2 = tracking_id;
            str = "MyReco";
        }
        String contentTitle = MyRecoManager.getInstance().getContentTitle();
        this.contentGenre = MyRecoManager.getInstance().getContentGenre();
        String contentLanguage = MyRecoManager.getInstance().getContentLanguage();
        this.contentLanguage = contentLanguage;
        if (TextUtils.isEmpty(contentLanguage) && (streamResponse = this.streamResponseObject) != null && streamResponse.getPageAttributes() != null && !TextUtils.isEmpty(this.streamResponseObject.getPageAttributes().getLanguage())) {
            this.contentLanguage = this.streamResponseObject.getPageAttributes().getLanguage();
        }
        this.contentName = MyRecoManager.getInstance().getContentTitle();
        this.contentPartnerName = MyRecoManager.getInstance().getContentPartnerName();
        if (TextUtils.isEmpty(this.contentPageItem.getPageInfo().getAttributes().getIsTrailerAvailable()) || !this.contentPageItem.getPageInfo().getAttributes().getIsTrailerAvailable().equalsIgnoreCase("true")) {
            StreamResponse streamResponse2 = this.lastStreamResponse;
            if (streamResponse2 == null || TextUtils.isEmpty(streamResponse2.getPageAttributes().getFirstEpisodeFreeFullAccessText())) {
                this.contentType = MyRecoManager.getInstance().getContentType();
            } else {
                this.contentType = "tvshow";
            }
        } else {
            this.contentType = "trailer";
        }
        this.contentModel = MyRecoManager.getInstance().getContentModel();
        this.contentTag = MyRecoManager.getInstance().getContentTag();
        this.contentId = MyRecoManager.getInstance().getContentId();
        this.tvShowName = MyRecoManager.getInstance().getContentTvShowName();
        this.mContentPosition = MyRecoManager.getInstance().getContentPosition();
        this.carouselPosition = MyRecoManager.getInstance().getCarouselPosition();
        this.source = MyRecoManager.getInstance().getSourceForAnalytics();
        this.sourceDetails = MyRecoManager.getInstance().getSourceDetailsForAnalytics();
        this.subSourceDetails = MyRecoManager.getInstance().getSubSourceDetailsForAnalytics();
        String str3 = getActivity() != null ? getActivity().bottomTabSelected : "Home";
        StreamResponse streamResponse3 = this.streamResponseObject;
        int seconds = (streamResponse3 == null || streamResponse3.getStreamStatus() == null) ? 0 : (int) TimeUnit.MILLISECONDS.toSeconds(this.streamResponseObject.getStreamStatus().getTotalDurationInMillis().longValue());
        ContentPage contentPage = this.contentPageItem;
        boolean z = (contentPage == null || TextUtils.isEmpty(contentPage.getPageInfo().getAttributes().getIsTrailerAvailable()) || !this.contentPageItem.getPageInfo().getAttributes().getIsTrailerAvailable().equalsIgnoreCase("true")) ? false : true;
        StreamResponse streamResponse4 = this.lastStreamResponse;
        boolean z2 = (streamResponse4 == null || TextUtils.isEmpty(streamResponse4.getPageAttributes().getFirstEpisodeFreeFullAccessText())) ? false : true;
        if (this.mouTracker == null) {
            MOUTracker mOUTracker = new MOUTracker(this);
            this.mouTracker = mOUTracker;
            mOUTracker.start();
        }
        String targetPath = MyRecoManager.getInstance().getTargetPath();
        String coverposterImageUrl = MyRecoManager.getInstance().getCoverposterImageUrl();
        String promotional_view = MyRecoManager.getInstance().getPROMOTIONAL_VIEW();
        this.promotionalView = promotional_view;
        CleverTap.moviesEventVideoStarted(z2, z, promotional_view, targetPath, coverposterImageUrl, this.source, this.sourceDetails, this.subSourceDetails, this.carouselPosition, this.mContentPosition, this.contentId, contentTitle, this.contentLanguage, this.contentPartnerName, this.contentModel, this.contentTag, this.contentType, this.contentGenre, false, false, this.tvShowName, seconds, str3, str, str2, OTTApplication.SUBTITLE_STATE, this.defaultCaptions, false, "na", true);
    }

    private void eventCTVideoStopped() {
        String str;
        String str2;
        String str3;
        String str4;
        String tracking_id = MyRecoManager.getInstance().getTRACKING_ID();
        if (TextUtils.isEmpty(tracking_id)) {
            str = "na";
            str2 = str;
        } else {
            str2 = tracking_id;
            str = "MyReco";
        }
        String str5 = getActivity() != null ? getActivity().bottomTabSelected : "Home";
        StreamResponse streamResponse = this.streamResponseObject;
        int seconds = (streamResponse == null || streamResponse.getStreamStatus() == null) ? 0 : (int) TimeUnit.MILLISECONDS.toSeconds(this.streamResponseObject.getStreamStatus().getTotalDurationInMillis().longValue());
        ContentPage contentPage = this.contentPageItem;
        boolean z = (contentPage == null || TextUtils.isEmpty(contentPage.getPageInfo().getAttributes().getIsTrailerAvailable()) || !this.contentPageItem.getPageInfo().getAttributes().getIsTrailerAvailable().equalsIgnoreCase("true")) ? false : true;
        if (this.mouTracker != null) {
            PlayerControlView playerControlView = this.mPlayerControlView;
            if (playerControlView != null) {
                str3 = playerControlView.getCurrentTime();
                str4 = this.mPlayerControlView.getTotalTime();
            } else {
                str3 = "";
                str4 = str3;
            }
            this.mouTracker.stoppedAt(false, z, this.promotionalView, getActivity(), MyRecoManager.getInstance().getTargetPath(), MyRecoManager.getInstance().getCoverposterImageUrl(), this.source, this.sourceDetails, this.subSourceDetails, this.carouselPosition, this.mContentPosition, this.contentId, this.contentName, this.contentLanguage, this.contentPartnerName, this.contentModel, this.contentTag, this.contentType, this.contentGenre, false, false, this.tvShowName, seconds, str5, str, str2, OTTApplication.SUBTITLE_STATE, this.defaultCaptions, false, "na", str3, str4);
            this.mouTracker = null;
        }
    }

    private void generateNonceForAdRequest(String str, String str2, String str3, int i2, int i3) {
        this.palStreamUrl = str;
        this.palSessionID = str2;
        this.palBoxID = str3;
        this.playerWidth = i2;
        this.playerHeight = i3;
        CustomLog.i("Distro", "generateNonceForAdRequest: ");
        NonceRequest.Builder descriptionURL = NonceRequest.builder().descriptionURL(str);
        Boolean bool = Boolean.TRUE;
        NonceRequest build = descriptionURL.iconsSupported(bool).playerType("Exoplayer").playerVersion("1.0.0").sessionId(str2).videoPlayerHeight(Integer.valueOf(i2)).videoPlayerWidth(Integer.valueOf(i3)).willAdAutoPlay(bool).willAdPlayMuted(bool).build();
        NonceCallbackImpl nonceCallbackImpl = new NonceCallbackImpl();
        if (getActivity().nonceLoader != null) {
            getActivity().nonceLoader.loadNonceManager(build).addOnSuccessListener(nonceCallbackImpl).addOnFailureListener(nonceCallbackImpl);
        } else {
            startDistroPlayback();
        }
    }

    private static String generateRandomStringByUUID() {
        return UUID.randomUUID().toString();
    }

    private Uri getAdTagUri() {
        String torcaiAdVideoUrl;
        if (!this.playAds || this.adUrlResponse == null || (torcaiAdVideoUrl = getTorcaiAdVideoUrl()) == null) {
            return null;
        }
        Uri parse = Uri.parse(torcaiAdVideoUrl);
        if (!parse.equals(this.loadedAdTagUri)) {
            releaseAdsLoader();
            this.loadedAdTagUri = parse;
        }
        String vmapVideoAdUrl = getVmapVideoAdUrl();
        if (vmapVideoAdUrl != null) {
            vmapVideoAdUrl.trim().length();
        }
        return Uri.parse(getUpdatedAdTag(torcaiAdVideoUrl));
    }

    public AdsLoader getAdsLoader(MediaItem.AdsConfiguration adsConfiguration) {
        if (this.imaAdEventListener == null) {
            this.imaAdEventListener = new AdEvent.AdEventListener() {
                public void onAdEvent(AdEvent adEvent) {
                    AdPodInfo adPodInfo;
                    AdEvent.AdEventType type = adEvent.getType();
                    Ad ad = adEvent.getAd();
                    switch (AnonymousClass79.$SwitchMap$com$google$ads$interactivemedia$v3$api$AdEvent$AdEventType[type.ordinal()]) {
                        case 1:
                            CustomLog.d("DEBUG " + ExoPlayerFragment.TAG, "Ad Loaded index: " + ExoPlayerFragment.this.adType);
                            CustomLog.e("AdEvent ::", "LOADED : ");
                            ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                            exoPlayerFragment.isAdLoaded = true;
                            PlayerControlView playerControlView = exoPlayerFragment.mPlayerControlView;
                            if (playerControlView != null) {
                                playerControlView.hideAdControls();
                                ExoPlayerFragment.this.mPlayerControlView.hide();
                                break;
                            }
                            break;
                        case 2:
                            CustomLog.d("DEBUG " + ExoPlayerFragment.TAG, "Ad Started");
                            ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                            exoPlayerFragment2.isPlayingAd = true;
                            PlayerControlView playerControlView2 = exoPlayerFragment2.mPlayerControlView;
                            if (playerControlView2 != null) {
                                if (playerControlView2.ageRatingTime > 0) {
                                    playerControlView2.ageRatingTime = exoPlayerFragment2.CONTENT_RATING_VISIBLE_DURATION;
                                }
                                exoPlayerFragment2.setContentRatingVisibility(8);
                                PlayerControlView playerControlView3 = ExoPlayerFragment.this.mPlayerControlView;
                                playerControlView3.isAdHided = true;
                                playerControlView3.showAdControls();
                            }
                            if (ExoPlayerFragment.this.mOttAnalytics != null) {
                                if (ad != null && (adPodInfo = ad.getAdPodInfo()) != null) {
                                    int podIndex = adPodInfo.getPodIndex();
                                    ExoPlayerFragment.this.adType = podIndex == -1 ? "postroll" : podIndex == 0 ? "preroll" : "midroll";
                                    ExoPlayerFragment.this.adPosition = podIndex == -1 ? AdPosition.POSTROLL : podIndex == 0 ? AdPosition.PREROLL : AdPosition.MIDROLL;
                                    ExoPlayerFragment.this.totalAds = adPodInfo.getTotalAds();
                                    ExoPlayerFragment.this.currentAdPosition = adPodInfo.getAdPosition();
                                    CustomLog.e("AdEvent ::", "STARTED : " + ExoPlayerFragment.this.adType);
                                }
                                ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                                YuppAnalytics yuppAnalytics = exoPlayerFragment3.mOttAnalytics;
                                if (yuppAnalytics != null) {
                                    yuppAnalytics.handleAdStart(exoPlayerFragment3.adPosition);
                                    break;
                                }
                            }
                            break;
                        case 3:
                            CustomLog.d("DEBUG " + ExoPlayerFragment.TAG, "Ad Paused");
                            CustomLog.e("AdEvent ::", "PAUSED : " + ExoPlayerFragment.this.adType);
                            ExoPlayerFragment.this.isComingFromBackground = false;
                            break;
                        case 4:
                            CustomLog.d("DEBUG " + ExoPlayerFragment.TAG, "Ad Resumed");
                            CustomLog.e("AdEvent ::", "RESUMED : " + ExoPlayerFragment.this.adType);
                            ExoPlayerFragment exoPlayerFragment4 = ExoPlayerFragment.this;
                            if (exoPlayerFragment4.mOttAnalytics != null && exoPlayerFragment4.isComingFromBackground) {
                                ExoPlayerFragment exoPlayerFragment5 = ExoPlayerFragment.this;
                                exoPlayerFragment5.mOttAnalytics.handleAdStart(exoPlayerFragment5.adPosition);
                                break;
                            }
                            break;
                        case 5:
                            CustomLog.d("DEBUG " + ExoPlayerFragment.TAG, "Ad Ended");
                            CustomLog.e("AdEvent ::", "COMPLETED : " + ExoPlayerFragment.this.adType);
                            ExoPlayerFragment exoPlayerFragment6 = ExoPlayerFragment.this;
                            exoPlayerFragment6.isPlayingAd = false;
                            exoPlayerFragment6.isAdLoaded = false;
                            PlayerControlView playerControlView4 = exoPlayerFragment6.mPlayerControlView;
                            if (playerControlView4 != null && playerControlView4.ageRatingTime > 0 && exoPlayerFragment6.currentAdPosition != -1 && ExoPlayerFragment.this.totalAds != -1 && ExoPlayerFragment.this.currentAdPosition == ExoPlayerFragment.this.totalAds) {
                                ExoPlayerFragment exoPlayerFragment7 = ExoPlayerFragment.this;
                                exoPlayerFragment7.mPlayerControlView.ageRatingTime = 0L;
                                exoPlayerFragment7.startShowingContentRating();
                            }
                            PlayerControlView playerControlView5 = ExoPlayerFragment.this.mPlayerControlView;
                            if (playerControlView5 != null) {
                                playerControlView5.hideAdControls();
                            }
                            ExoPlayerFragment exoPlayerFragment8 = ExoPlayerFragment.this;
                            YuppAnalytics yuppAnalytics2 = exoPlayerFragment8.mOttAnalytics;
                            if (yuppAnalytics2 != null) {
                                yuppAnalytics2.handleAdEnd(exoPlayerFragment8.adType);
                                break;
                            }
                            break;
                        case 6:
                            CustomLog.d("DEBUG " + ExoPlayerFragment.TAG, "Ad Skipped");
                            CustomLog.e("AdEvent ::", "SKIPPED : " + ExoPlayerFragment.this.adType);
                            ExoPlayerFragment exoPlayerFragment9 = ExoPlayerFragment.this;
                            exoPlayerFragment9.isPlayingAd = false;
                            exoPlayerFragment9.isAdLoaded = false;
                            YuppAnalytics yuppAnalytics3 = exoPlayerFragment9.mOttAnalytics;
                            if (yuppAnalytics3 != null) {
                                yuppAnalytics3.handleAdSkipped(exoPlayerFragment9.adType);
                                break;
                            }
                            break;
                        case 7:
                            CustomLog.d("DEBUG " + ExoPlayerFragment.TAG, "Ad TAPPED");
                            CustomLog.e("AdEvent ::", "TAPPED : " + ExoPlayerFragment.this.adType);
                            ExoPlayerFragment exoPlayerFragment10 = ExoPlayerFragment.this;
                            if (exoPlayerFragment10.mPlayerControlView != null && exoPlayerFragment10.getActivity().getPlayerCurrentState() != 2) {
                                ExoPlayerFragment.this.mPlayerControlView.toggleAdControls();
                                break;
                            } else {
                                ExoPlayerFragment.this.getActivity().WWL_onClicked();
                                break;
                            }
                            break;
                        case 8:
                            CustomLog.d("DEBUG " + ExoPlayerFragment.TAG, "All Ads completed");
                            ExoPlayerFragment exoPlayerFragment11 = ExoPlayerFragment.this;
                            exoPlayerFragment11.isPlayingAd = false;
                            exoPlayerFragment11.isAdLoaded = false;
                            CustomLog.e("AdEvent ::", "ALL_ADS_COMPLETED : " + ExoPlayerFragment.this.adType);
                            break;
                        case 9:
                            CustomLog.d("DEBUG " + ExoPlayerFragment.TAG, "Ad Error");
                            CustomLog.e("AdEvent ::", "AD_BREAK_FETCH_ERROR : " + ExoPlayerFragment.this.adType);
                            ExoPlayerFragment exoPlayerFragment12 = ExoPlayerFragment.this;
                            exoPlayerFragment12.isPlayingAd = false;
                            exoPlayerFragment12.isAdLoaded = false;
                            YuppAnalytics yuppAnalytics4 = exoPlayerFragment12.mOttAnalytics;
                            if (yuppAnalytics4 != null) {
                                yuppAnalytics4.handleAdEnd(exoPlayerFragment12.adType);
                                break;
                            }
                            break;
                    }
                }
            };
        }
        if (this.adsLoader == null) {
            this.adsLoader = new ImaAdsLoader.Builder(getContext()).setAdEventListener(this.imaAdEventListener).setFocusSkipButtonWhenAvailable(true).build();
        }
        this.adsLoader.setPlayer(this.player);
        return this.adsLoader;
    }

    private String getCaptionsMimeType(String str) {
        str.getClass();
        switch (str) {
            case "webvtt":
            case "vtt":
                return "text/vtt";
            case "x-ssa":
                return "text/x-ssa";
            default:
                return "application/x-subrip";
        }
    }

    private int getDuration() {
        ExoPlayer exoPlayer;
        if (isInPlaybackState() && this.mDuration <= 0 && (exoPlayer = this.player) != null) {
            this.mDuration = (int) exoPlayer.getDuration();
        }
        int i2 = this.mDuration;
        if (i2 > 0) {
            return i2;
        }
        return -1;
    }

    private ImageView getImageView(int i2) {
        return (ImageView) this.mActivity.findViewById(R.id.app_video_volume_icon);
    }

    private Uri getMacroReplacedUri(String str, int i2, int i3, String str2) {
        if (str.contains("__CACHE_BUSTER__")) {
            str = str.replace("__CACHE_BUSTER__", "" + System.currentTimeMillis());
        }
        if (str.contains("__APP_NAME__")) {
            str = str.replace("__APP_NAME__", URLEncoder.encode("vi app"));
        }
        if (str.contains("__APP_BUNDLE__")) {
            str = str.replace("__APP_BUNDLE__", "com.vilite");
        }
        if (str.contains("__USER_AGENT__")) {
            str = str.replace("__USER_AGENT__", URLEncoder.encode(System.getProperty("http.agent")));
        }
        if (str.contains("__STORE_URL__")) {
            str = str.replace("__STORE_URL__", URLEncoder.encode(getStoreUrl()));
        }
        if (str.contains("__APP_VERSION__")) {
            str = str.replace("__APP_VERSION__", "3.1.5");
        }
        if (str.contains("__WIDTH__")) {
            str = str.replace("__WIDTH__", "" + i2);
        }
        if (str.contains("__HEIGHT__")) {
            str = str.replace("__HEIGHT__", "" + i3);
        }
        if (str.contains("__DEVICE_ID__")) {
            str = str.replace("__DEVICE_ID__", str2);
        }
        if (str.contains("__DEVICE__")) {
            str = str.replace("__DEVICE__", "Android");
        }
        if (str.contains("__DEVICE_MAKE__")) {
            str = str.replace("__DEVICE_MAKE__", "Android");
        }
        if (str.contains("__PAGEURL_ESC__")) {
            str = str.replace("__PAGEURL_ESC__", "");
        }
        if (str.contains("__DEVICE_CONNECTION_TYPE__")) {
            str = str.replace("__DEVICE_CONNECTION_TYPE__", URLEncoder.encode(UiUtils.getNetworkClass(this.mActivity)));
        }
        if (str.contains("__CONNECTION_TYPE__")) {
            str = str.replace("__CONNECTION_TYPE__", URLEncoder.encode(UiUtils.getNetworkClass(this.mActivity)));
        }
        String stringPreference = Preferences.instance(getActivity()).getStringPreference("pref_key_advertising_id");
        if (str.contains("__DEVICE_ID_TYPE__")) {
            str = str.replace("__DEVICE_ID_TYPE__", stringPreference);
        }
        if (str.contains("__AID_TYPE__")) {
            str = str.replace("__AID_TYPE__", stringPreference);
        }
        if (str.contains("__LIMIT_AD_TRACKING__")) {
            str = str.replace("__LIMIT_AD_TRACKING__", stringPreference.isEmpty() ? "0" : "1");
        }
        if (str.contains("__ADVERTISING_ID__")) {
            str = str.replace("__ADVERTISING_ID__", stringPreference);
        }
        this.streamSessionId = generateRandomStringByUUID();
        if (str.contains("__PLAYBACK_ID__")) {
            str = str.replace("__PLAYBACK_ID__", this.streamSessionId);
        }
        if (str.contains("__PALN__")) {
            str = str.replace("__PALN__", this.palNonce);
        }
        if (str.contains("__DEVICE_CATEGORY__")) {
            str = str.replace("__DEVICE_CATEGORY__", Constants.DISTRO_DEVICE_CATEGORY);
        }
        CustomLog.i("Distro", "Macros replaced: " + str);
        this.macroReplacedURL = str;
        return Uri.parse(str);
    }

    public void getNextVideo(String str) {
        StreamResponse streamResponse;
        APIUtils.getOTTSdkInstance(getActivity().getApplicationContext());
        if (OttSDK.getInstance() == null || (streamResponse = this.streamResponseObject) == null) {
            return;
        }
        if (streamResponse.getAnalyticsInfo() == null || this.streamResponseObject.getAnalyticsInfo().getContentType() == null || this.streamResponseObject.getAnalyticsInfo().getDataType() == null || !this.streamResponseObject.getAnalyticsInfo().getContentType().equalsIgnoreCase("vod") || !this.streamResponseObject.getAnalyticsInfo().getDataType().equalsIgnoreCase("epg")) {
            OttSDK.getInstance().getMediaManager().getNextVideo(str, 1, this.mMediaCatalogCallback);
        } else {
            OttSDK.getInstance().getMediaManager().getNextEPGVideo(str, 1, -1, this.mMediaCatalogCallback);
        }
    }

    private void getPageInfo() {
        if (getActivity() != null) {
            OttSDK.getInstance().getMediaManager().getPageContent(getActivity().currentItemtargerPath, new MediaCatalogManager.MediaCatalogCallback<ContentPage>() {
                @Override
                public void onFailure(Error error) {
                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                    exoPlayerFragment.startPlay(exoPlayerFragment.itemObject, 0L, ButtonType.NONE);
                    NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "/service/api/v1/page/content", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
                }

                @Override
                public void onSuccess(ContentPage contentPage) {
                    ExoPlayerFragment.this.startPlay(contentPage, 0L, ButtonType.NONE);
                }
            });
        }
    }

    private String getPdnName(PreferenceManager preferenceManager) {
        preferenceManager.getTenantCode();
        return UiUtils.getTenantBuildType(this.mActivity) == TenantBuildType.VIMTV_LIVE ? "vodafone-idea" : "test-vodafone-idea";
    }

    private String getStoreUrl() {
        return (getActivity() == null || getActivity().getPackageName() == null) ? "" : "https://play.google.com/store/apps/details?id=com.vilite";
    }

    private void getStreamInfo() {
        if (getActivity() == null) {
            return;
        }
        OttSDK.getInstance().getMediaManager().getPageContent(getActivity().currentItemtargerPath, new MediaCatalogManager.MediaCatalogCallback<ContentPage>() {
            @Override
            public void onFailure(Error error) {
                NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "/service/api/v1/page/content", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
            }

            @Override
            public void onSuccess(ContentPage contentPage) {
                ExoPlayerFragment.this.imageUrl = "";
                ExoPlayerFragment.this.updateItem(contentPage);
                ExoPlayerFragment.this.getActivity().updateChatFragment(contentPage);
                ExoPlayerFragment.this.pageInfo = contentPage.getPageInfo();
                ExoPlayerFragment.this.contentPageItem = contentPage;
                PageInfo.Attributes attributes = contentPage.getPageInfo().getAttributes();
                if (attributes != null) {
                    String endTime = attributes.getEndTime();
                    if (endTime != null && !endTime.equalsIgnoreCase("")) {
                        ExoPlayerFragment.this.setProgramEndTime(Long.parseLong(endTime));
                    }
                    String startTime = attributes.getStartTime();
                    if (startTime == null || startTime.equalsIgnoreCase("")) {
                        return;
                    }
                    ExoPlayerFragment.this.setProgramStartTime(Long.parseLong(startTime));
                }
            }
        });
    }

    private String getTorcaiAdVideoUrl() {
        List<AdUrlType> adUrlTypes = this.adUrlResponse.getAdUrlTypes();
        this.adUrlTypesList = adUrlTypes;
        String str = "";
        if (adUrlTypes != null && adUrlTypes.size() > 0) {
            for (int i2 = 0; i2 < this.adUrlTypesList.size(); i2++) {
                if (this.adUrlTypesList.get(i2).getPosition() != null && this.adUrlTypesList.get(i2).getPosition().getAdType() != null && this.adUrlTypesList.get(i2).getPosition().getAdType().equalsIgnoreCase(this.INSTREAM_AD_TYPE)) {
                    str = this.adUrlTypesList.get(i2).getUrl();
                }
                if (this.adUrlTypesList.get(i2).getUrlType() != null && this.adUrlTypesList.get(i2).getUrlType().equalsIgnoreCase("preurl")) {
                    str = this.adUrlTypesList.get(i2).getUrl();
                }
            }
        }
        return str;
    }

    private String getUpdatedAdTag(String str) {
        String str2;
        String str3;
        if (str == null || str.trim().length() <= 0) {
            return str;
        }
        PreferenceManager preferenceManager = OttSDK.getInstance().getPreferenceManager();
        StreamResponse streamResponse = this.streamResponseObject;
        if (streamResponse != null) {
            str2 = streamResponse.getStreamStatus().getTotalDurationInMillis().toString();
            str3 = this.streamResponseObject.getStreamStatus().getSeekPositionInMillis().toString();
            if (str2.equalsIgnoreCase("-1")) {
                str2 = this.DEFAULT_CLENGTH;
            }
        } else {
            str2 = "";
            str3 = str2;
        }
        if (str.contains("userAgent=[INSERT_MACRO]")) {
            str = str.replace("[INSERT_MACRO]", System.getProperty("http.agent"));
        }
        if (str.contains("appBundle=[INSERT_MACRO]")) {
            str = str.replace("[INSERT_MACRO]", "com.vilite");
        }
        if (str.contains("playerSize=[HARDCODED]")) {
            str = str.replace("[HARDCODED]", "640x480");
        }
        if (str.contains("appName=[INSERT_MACRO]")) {
            str = str.replace("[INSERT_MACRO]", getResources().getString(R.string.AppName));
        }
        if (str.contains("appStoreUrl=[INSERT_MACRO]")) {
            str = str.replace("[INSERT_MACRO]", getStoreUrl());
        }
        if (str.contains("appVersion=[HARDCODED_OR_INSERT_MACRO]")) {
            str = str.replace("[HARDCODED_OR_INSERT_MACRO]", "3.1.5");
        }
        if (str.contains("deviceIfa=[INSERT_MACRO]")) {
            str = str.replace("[INSERT_MACRO]", Preferences.instance(getActivity()).getStringPreference("pref_key_advertising_id"));
        }
        if (str.contains("clength=[CLENGTH]")) {
            str = str.replace("[CLENGTH]", str2);
        }
        if (str.contains("viewstart=[STARTTIME]")) {
            str = str.replace("[STARTTIME]", str3);
        }
        try {
            if (str.contains("ip=[INSERT_MACRO]")) {
                str = str.replace("[INSERT_MACRO]", "" + preferenceManager.getIpInfo().getTrueIP());
            }
        } catch (Exception unused) {
        }
        if (str.contains("{{CACHEBUSTER}}")) {
            str = str.replace("{{CACHEBUSTER}}", "" + System.currentTimeMillis());
        }
        if (str.contains("{{APP_NAME}}")) {
            str = str.replace("{{APP_NAME}}", getResources().getString(R.string.AppName));
        }
        if (str.contains("{{APP_STORE_URL}}")) {
            str = str.replace("{{APP_STORE_URL}}", getStoreUrl());
        }
        if (str.contains("{{DEVICE_ID}}")) {
            str = str.replace("{{DEVICE_ID}}", Preferences.instance(getActivity()).getStringPreference("pref_key_advertising_id"));
        }
        try {
            if (str.contains("{{IP}}")) {
                str = str.replace("{{IP}}", "" + preferenceManager.getIpInfo().getTrueIP());
            }
        } catch (Exception unused2) {
        }
        if (str.contains("correlator=")) {
            str = str.replace("correlator=", "correlator=" + System.currentTimeMillis());
        }
        str.contains("{{DEVICE_ID}}");
        if (str.contains("url=[referrer_url]")) {
            str = str.replace("[referrer_url]", "com.vilite");
        }
        try {
            String str4 = " http://www.sonyliv.com/details/" + this.metaDataId + "/" + this.mTitle.replace(" ", "-") + "/";
            if (str.contains("description_url=[description_url]")) {
                str = str.replace("[description_url]", URLEncoder.encode(str4, "UTF-8"));
            }
            if (str.contains("description_url=[placeholder]")) {
                str = str.replace("[placeholder]", URLEncoder.encode(str4, "UTF-8"));
            }
            if (str.contains("vid=[content_id]")) {
                str = str.replace("[content_id]", this.metaDataId);
            }
            CustomLog.d("DEBUG", "updateAdTAg11 : " + str);
            CustomLog.d("DEBUG", "updateAdTAg : " + str);
            return str;
        } catch (UnsupportedEncodingException e2) {
            throw new RuntimeException(e2);
        }
    }

    private View getView(int i2) {
        return this.mActivity.findViewById(i2);
    }

    private String getVmapVideoAdUrl() {
        List<AdUrlType> adUrlTypes = this.adUrlResponse.getAdUrlTypes();
        this.adUrlTypesList = adUrlTypes;
        if (adUrlTypes != null && adUrlTypes.size() > 0) {
            for (int i2 = 0; i2 < this.adUrlTypesList.size(); i2++) {
                if (this.adUrlTypesList.get(i2).getUrlType().equalsIgnoreCase("vmapurl")) {
                    if (this.adUrlTypesList.get(i2).getUrl() == null || this.adUrlTypesList.get(i2).getUrl().trim().length() <= 0) {
                        return null;
                    }
                    return getUpdatedAdTag(this.adUrlTypesList.get(i2).getUrl());
                }
            }
        }
        return null;
    }

    private void handleDistroPixelAnalytics(String str) {
        FragmentActivity fragmentActivity = this.mActivity;
        if (fragmentActivity == null) {
            return;
        }
        Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(fragmentActivity.getApplicationContext());
        this.distroAnalyticsUrl = "";
        if (utilAppConfigurations != null) {
            if (!TextUtils.isEmpty(utilAppConfigurations.getDistroPixelUrl())) {
                this.distroAnalyticsUrl = utilAppConfigurations.getDistroPixelUrl();
            }
            if (TextUtils.isEmpty(this.distroAnalyticsUrl)) {
                return;
            }
            if (this.distroAnalyticsUrl.contains("<partner_name>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<partner_name>", Constants.DISTRO_PARTNER_NAME);
            }
            if (this.distroAnalyticsUrl.contains("<event_name>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<event_name>", str);
            }
            if (this.distroAnalyticsUrl.contains("<random>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<random>", "" + System.currentTimeMillis());
            }
            if (this.distroAnalyticsUrl.contains("<advertising_id>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<advertising_id>", Preferences.instance(this.mActivity).getStringPreference("pref_key_advertising_id"));
            }
            if (this.distroAnalyticsUrl.contains("<playback_id>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<playback_id>", this.streamSessionId);
            }
            if (this.distroAnalyticsUrl.contains("<encoded_video_url>")) {
                if (this.isDAIStream) {
                    this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<encoded_video_url>", URLEncoder.encode(this.daiAssetKey));
                } else {
                    this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<encoded_video_url>", URLEncoder.encode(this.macroReplacedURL));
                }
            }
            try {
                JSONObject jSONObject = new JSONObject(this.customData);
                String string = jSONObject.has("cpContentProviderId") ? jSONObject.getString("cpContentProviderId") : "";
                String string2 = jSONObject.has("cpShowId") ? jSONObject.getString("cpShowId") : "";
                String string3 = jSONObject.has("cpEpisodeId") ? jSONObject.getString("cpEpisodeId") : "";
                if (this.distroAnalyticsUrl.contains("<content_provider_id>")) {
                    this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<content_provider_id>", URLEncoder.encode(string));
                }
                if (this.distroAnalyticsUrl.contains("<show_id>")) {
                    this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<show_id>", URLEncoder.encode(string2));
                }
                if (this.distroAnalyticsUrl.contains("<episode_id>")) {
                    this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<episode_id>", URLEncoder.encode(string3));
                }
                if (this.distroAnalyticsUrl.contains("<device_category>")) {
                    this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<device_category>", Constants.DISTRO_DEVICE_CATEGORY);
                }
                CustomLog.d("DEBUG", "distroAnalyticsUrl " + this.distroAnalyticsUrl);
                APIUtils.getmMediaManager(this.mActivity.getApplicationContext()).sendDistroPixelAnalyticEvents(this.distroAnalyticsUrl, new MediaCatalogManager.MediaCatalogCallback<ResponseBody>() {
                    @Override
                    public void onFailure(Error error) {
                        if (error != null && error.getMessage() != null) {
                            CustomLog.e("DistroPixelAnalytics", " error: " + error.getMessage());
                        }
                        NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "sendDistroPixelAnalyticEvents", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
                    }

                    @Override
                    public void onSuccess(ResponseBody responseBody) {
                        CustomLog.e("DistroPixelAnalytics", " responseBody: " + responseBody);
                    }
                });
            } catch (JSONException e2) {
                throw new RuntimeException(e2);
            }
        }
    }

    private void handleKlikkAnalytics(final String str) {
        String str2;
        String str3;
        String str4;
        String str5;
        Configs configs = new Configs();
        if (configs.getKlikkVideoAnalyticsUrl() != null && configs.getKlikkVideoAnalyticsUrl().trim().length() > 0 && !configs.getKlikkVideoAnalyticsUrl().trim().equalsIgnoreCase("")) {
            this.klikkAnalyticsUrl = configs.getKlikkVideoAnalyticsUrl();
        }
        if (str == null || str.trim().length() <= 0 || (str2 = this.klikkAnalyticsAssetId) == null || str2.trim().length() <= 0 || (str3 = this.klikkAnalyticsPartnerId) == null || str3.trim().length() <= 0 || (str4 = this.klikkAnalyticsUrl) == null || str4.trim().length() <= 0) {
            return;
        }
        if (this.klikkAnalyticsUrl.contains("{{event}}")) {
            this.klikkAnalyticsUrl = this.klikkAnalyticsUrl.replace("{{event}}", str);
        }
        if (this.klikkAnalyticsUrl.contains("{{uuid}}") && (str5 = this.klikkAnalyticsSessionId) != null && str5.trim().length() > 0) {
            this.klikkAnalyticsUrl = this.klikkAnalyticsUrl.replace("{{uuid}}", this.klikkAnalyticsSessionId);
        }
        if (this.klikkAnalyticsUrl.contains("{{deviceOS}}")) {
            this.klikkAnalyticsUrl = this.klikkAnalyticsUrl.replace("{{deviceOS}}", LogSubCategory.LifeCycle.ANDROID);
        }
        if (this.klikkAnalyticsUrl.contains("{{assetId}}")) {
            this.klikkAnalyticsUrl = this.klikkAnalyticsUrl.replace("{{assetId}}", this.klikkAnalyticsAssetId);
        }
        if (this.klikkAnalyticsUrl.contains("{{epochTime}}")) {
            this.klikkAnalyticsUrl = this.klikkAnalyticsUrl.replace("{{epochTime}}", String.valueOf(System.currentTimeMillis()));
        }
        if (this.klikkAnalyticsUrl.contains("{{deviceType}}")) {
            this.klikkAnalyticsUrl = this.klikkAnalyticsUrl.replace("{{deviceType}}", "mobile");
        }
        CustomLog.e("klickAnalyticsUrl", " url: " + this.klikkAnalyticsUrl);
        OttSDK.getInstance().getMediaManager().sendKlikkCPStreamEvents(this.klikkAnalyticsUrl, new MediaCatalogManager.MediaCatalogCallback<JsonObject>() {
            @Override
            public void onFailure(Error error) {
                if (error == null || error.getMessage() == null) {
                    return;
                }
                CustomLog.e("klickAnalyticsUrl", " error: " + error.getMessage());
                NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "sendKlikkCPStreamEvents", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
            }

            @Override
            public void onSuccess(JsonObject jsonObject) {
                CustomLog.e("klickAnalyticsUrl", " jsonObject: " + jsonObject);
                if (str.equalsIgnoreCase("video_impression")) {
                    ExoPlayerFragment.this.isKlikVideoImpressionSent = true;
                }
                if (str.equalsIgnoreCase("video_view")) {
                    ExoPlayerFragment.this.isKlikVideoViewSent = true;
                }
            }
        });
    }

    private DataSource.Factory headers() {
        HashMap hashMap = new HashMap();
        hashMap.put("sessionid", "yupp_test_token_initial_test");
        hashMap.put("token", "st=1670312449~exp=1671176449~hmac=7bc08a64c14608d6187563f33208b9a17e4305c9bce4c2e76c1fc7f23c9b206d");
        return new DefaultHttpDataSource.Factory().setDefaultRequestProperties(hashMap);
    }

    private void hideSubtitles() {
        SubtitleView findViewById = this.container.findViewById(R.id.exo_subtitles);
        this.subtitleView = findViewById;
        if (findViewById != null) {
            findViewById.setVisibility(4);
        }
    }

    private void initAnalytics(ExoPlayer exoPlayer, boolean z) {
        String str;
        PlayerControlView playerControlView;
        if (this.mActivity == null) {
            this.mActivity = getActivity();
        }
        if (this.mOttAnalytics == null) {
            this.mOttAnalytics = YuppAnalytics.getInstance(getActivity());
        }
        if (this.mOttAnalytics == null || (str = this.mUrl) == null || str.length() == 0) {
            return;
        }
        String str2 = "";
        if (this.mUrl.equalsIgnoreCase("")) {
            return;
        }
        YuppPlayerExoAnalyticsInterface yuppPlayerExoAnalyticsInterface = this.mYuppPlayerExoAnalyticsInterface;
        if (yuppPlayerExoAnalyticsInterface != null) {
            yuppPlayerExoAnalyticsInterface.cleanup();
        }
        try {
            if (getActivity() != null && (getActivity() instanceof FusionViliteMainActivity)) {
                this.navigationFrom = getActivity().navigationFrom;
            }
        } catch (Exception unused) {
        }
        if (OttSDK.getInstance() != null && OttSDK.getInstance().getPreferenceManager() != null) {
            PreferenceManager preferenceManager = OttSDK.getInstance().getPreferenceManager();
            if (preferenceManager.getSessionId() != null) {
                str2 = preferenceManager.getSessionId();
            }
        }
        Map<String, String> createTags = createTags(this.metaDataId, this.navigationFrom, this.mUrl, this.customData, this.isSubscribed, this.isAutoPlay);
        if (createTags == null) {
            return;
        }
        this.mOttAnalytics.initInternalAnalyticsMetaData(createTags, str2, ClientConfiguration.IS_PRODUCTION);
        YuppPlayerExoAnalyticsInterface.getInstance(this.mActivity).cleanup();
        YuppPlayerExoAnalyticsInterface yuppPlayerExoAnalyticsInterface2 = YuppPlayerExoAnalyticsInterface.getInstance(this.mActivity);
        this.mYuppPlayerExoAnalyticsInterface = yuppPlayerExoAnalyticsInterface2;
        yuppPlayerExoAnalyticsInterface2.intiExoAnalyticsInterface(YuppAnalytics.getPlayStateMachine(), exoPlayer);
        this.mOttAnalytics.createSession();
        this.mYuppPlayerExoAnalyticsInterface.attachPlayer(exoPlayer);
        EventLogger eventLogger = this.eventLogger;
        if (eventLogger != null) {
            eventLogger.setYuppExoPlayerAnalyticsInterface(this.mYuppPlayerExoAnalyticsInterface);
        }
        try {
            YuppPlayerExoAnalyticsInterface yuppPlayerExoAnalyticsInterface3 = this.mYuppPlayerExoAnalyticsInterface;
            if (yuppPlayerExoAnalyticsInterface3 != null && yuppPlayerExoAnalyticsInterface3.getmSeekListener() != null && (playerControlView = this.mPlayerControlView) != null) {
                playerControlView.setmOnSeekBarChangeListener(this.mYuppPlayerExoAnalyticsInterface.getmSeekListener());
            }
        } catch (NullPointerException unused2) {
        }
        if (this.epgCheckHandler == null) {
            this.epgCheckHandler = new Handler();
        }
        this.epgCheckHandler.removeCallbacks(this.epgCheckRunnable);
        this.epgCheckHandler.postDelayed(this.epgCheckRunnable, 1000L);
    }

    private void initYuppAnalyticsInstance() {
        if (getContext() == null || this.mOttAnalytics == null) {
            return;
        }
        String str = "";
        if (OttSDK.getInstance() != null && OttSDK.getInstance().getPreferenceManager() != null) {
            PreferenceManager preferenceManager = OttSDK.getInstance().getPreferenceManager();
            if (preferenceManager.getSessionId() != null) {
                str = preferenceManager.getSessionId();
            }
        }
        this.mOttAnalytics.initClient(getContext(), str, ClientConfiguration.IS_PRODUCTION);
    }

    public void initializePlayer(Bundle bundle) {
        String str;
        PlayerControlView playerControlView;
        ExoPlayer exoPlayer;
        int i2;
        int i3;
        this.playAdsError = false;
        if (bundle == null) {
            return;
        }
        CastContext castContext = this.mc;
        if (castContext != null) {
            castContext.addCastStateListener(this.mCastStateListener);
        }
        hideChromeCast();
        int i4 = 2;
        if (this.player == null) {
            AdaptiveTrackSelection.Factory factory = new AdaptiveTrackSelection.Factory();
            preferExtensionDecoders = bundle.getBoolean("prefer_extension_decoders", false);
            this.renderersFactory = new DefaultRenderersFactory(getActivity()).setExtensionRendererMode((getActivity() == null || OTTApplication.getInstance() == null || !OTTApplication.getInstance().useExtensionRenderers()) ? 0 : preferExtensionDecoders ? 2 : 1);
            this.trackSelector = new DefaultTrackSelector(getActivity(), factory);
            this.trackSelectionHelper = new TrackSelectionHelper(getActivity(), this.trackSelector, factory, getActivity());
            Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(getContext().getApplicationContext());
            if (utilAppConfigurations != null && utilAppConfigurations.getMaxBitRate() != null && utilAppConfigurations.getMaxBitRate().trim().length() > 0) {
                this.maxVideoBitrate = Integer.parseInt(utilAppConfigurations.getMaxBitRate());
            }
            CustomLog.e("bitrate ", "maxVideoBitrate :" + this.maxVideoBitrate);
            if (this.maxVideoBitrate > 0) {
                DefaultTrackSelector defaultTrackSelector = this.trackSelector;
                defaultTrackSelector.setParameters(defaultTrackSelector.buildUponParameters().setMaxVideoBitrate(this.maxVideoBitrate * 1024));
            }
            this.videoQualityName = "Auto";
            this.videoQualitySetting = null;
            this.videoQuality = Preferences.instance(getActivity()).getVideoQuality();
            if (OttSDK.getInstance() != null) {
                this.videoQualityList = OttSDK.getInstance().getPreferenceManager().getVideoQualitySettings();
            }
            if (this.videoQualityList != null && utilAppConfigurations.getEnableBitrateFeature() != null && utilAppConfigurations.getEnableBitrateFeature().trim().equalsIgnoreCase("true")) {
                TrackSelectionHelper trackSelectionHelper = this.trackSelectionHelper;
                if (trackSelectionHelper != null) {
                    trackSelectionHelper.enabledBitrateFeature = true;
                }
                String str2 = this.videoQuality;
                if (str2 != null && !str2.equalsIgnoreCase("auto")) {
                    int size = this.videoQualityList.size();
                    int i5 = 0;
                    while (true) {
                        if (i5 >= size) {
                            i2 = 0;
                            i3 = 0;
                            break;
                        } else if (this.videoQuality.equalsIgnoreCase(this.videoQualityList.get(i5).getCode())) {
                            this.videoQualityName = this.videoQualityList.get(i5).getDisplayTitle();
                            this.videoQualitySetting = this.videoQualityList.get(i5);
                            i2 = this.videoQualityList.get(i5).getMaxBitRate().intValue();
                            i3 = this.videoQualityList.get(i5).getMinBitRate() != null ? this.videoQualityList.get(i5).getMinBitRate().intValue() : 0;
                        } else {
                            i5++;
                        }
                    }
                    if (i2 > 0) {
                        StringBuilder sb = new StringBuilder("Selected Bitrate ");
                        int i6 = i2 * 1024;
                        sb.append(i6);
                        CustomLog.e("Video BitRate ", sb.toString());
                        int i7 = i3 * 1024;
                        new DefaultTrackSelector.ParametersBuilder(getActivity()).setMaxVideoBitrate(i6).setMinVideoBitrate(i7).build();
                        if (i2 > 0) {
                            DefaultTrackSelector defaultTrackSelector2 = this.trackSelector;
                            defaultTrackSelector2.setParameters(defaultTrackSelector2.buildUponParameters().setMaxVideoBitrate(i6).setMinVideoBitrate(i7));
                        }
                    }
                }
            }
            this.isDAIStream = false;
            this.daiAssetKey = "";
            StreamResponse streamResponse = this.streamResponseObject;
            if (streamResponse != null && streamResponse.getStreams() != null && this.streamResponseObject.getStreams().size() > 0) {
                if (this.streamResponseObject.getStreams().get(0) != null && this.streamResponseObject.getStreams().get(0).getParams() != null && this.streamResponseObject.getStreams().get(0).getParams().getSsaiEnabled() != null && this.streamResponseObject.getStreams().get(0).getParams().getSsaiEnabled().booleanValue() && !TextUtils.isEmpty(this.streamResponseObject.getStreams().get(0).getParams().getDaiAssetKey())) {
                    this.isDAIStream = true;
                    this.daiAssetKey = this.streamResponseObject.getStreams().get(0).getParams().getDaiAssetKey();
                }
                if (this.streamResponseObject.getStreams().get(0) != null && this.streamResponseObject.getStreams().get(0).getStreamType() != null) {
                    this.streamType = this.streamResponseObject.getStreams().get(0).getStreamType();
                }
            }
            if (this.trackSelectionHelper != null) {
                this.lastSeenTrackGroupArray = null;
            }
            this.eventLogger = new EventLogger(this.trackSelector);
            DefaultDrmSessionManagerProvider defaultDrmSessionManagerProvider = new DefaultDrmSessionManagerProvider();
            defaultDrmSessionManagerProvider.setDrmHttpDataSourceFactory(buildHttpDataSourceFactory(false));
            DefaultMediaSourceFactory localAdInsertionComponents = new DefaultMediaSourceFactory(getActivity()).setDataSourceFactory(buildDataSourceFactory(true)).setDrmSessionManagerProvider(defaultDrmSessionManagerProvider).setLocalAdInsertionComponents(new AdsLoader.Provider() {
                public final AdsLoader getAdsLoader(MediaItem.AdsConfiguration adsConfiguration) {
                    AdsLoader adsLoader;
                    adsLoader = ExoPlayerFragment.this.getAdsLoader(adsConfiguration);
                    return adsLoader;
                }
            }, this.simpleExoPlayerView);
            if (this.isDAIStream) {
                ImaServerSideAdInsertionMediaSource.AdsLoader createAdsLoader = createAdsLoader();
                this.imaDaiAdsLoader = createAdsLoader;
                localAdInsertionComponents.setServerSideAdInsertionMediaSourceFactory(new ImaServerSideAdInsertionMediaSource.Factory(createAdsLoader, localAdInsertionComponents));
            }
            if (!getActivity().playerClosed) {
                this.player = new ExoPlayer.Builder(getContext(), this.renderersFactory).setTrackSelector(this.trackSelector).setMediaSourceFactory(new DefaultMediaSourceFactory(headers())).setMediaSourceFactory(localAdInsertionComponents).build();
            }
            if (this.isTrailer && (exoPlayer = this.player) != null) {
                exoPlayer.setVolume(0.0f);
            }
            getActivity().playerClosed = false;
            if (this.player != null) {
                accessNudge();
                if (getActivity() != null && (getActivity() instanceof FusionViliteMainActivity) && !getActivity().isDetailsPage && this.itemObject != null) {
                    getActivity().showSuggestionsLayout(this.itemObject);
                }
                initYuppAnalyticsInstance();
                initAnalytics(this.player, false);
                this.player.setHandleAudioBecomingNoisy(true);
                this.player.addListener(this);
                this.player.addListener(this.eventLogger);
                if (this.isDAIStream) {
                    this.imaDaiAdsLoader.setPlayer(this.player);
                }
                OttLog.error(TAG, "Intialize bundle" + this.isLive);
                if (!this.isLive) {
                    this.mPlayerControlView.goLiveButtonVisibility(false);
                }
                PlayerView playerView = this.simpleExoPlayerView;
                if (playerView != null) {
                    playerView.setPlayer((Player) null);
                }
                setPlayBackSpeed(Float.parseFloat(this.playerSpeeds[this.currentSpeedIndex]));
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                        PlayerView playerView2 = exoPlayerFragment.simpleExoPlayerView;
                        if (playerView2 != null) {
                            playerView2.setPlayer(exoPlayerFragment.player);
                            if (ExoPlayerFragment.this.simpleExoPlayerView.getVideoSurfaceView() != null) {
                                ExoPlayerFragment.this.simpleExoPlayerView.getVideoSurfaceView().invalidate();
                            }
                        }
                    }
                }, 200L);
                this.mPlayerControlView.updateController(this.player);
                try {
                    YuppPlayerExoAnalyticsInterface yuppPlayerExoAnalyticsInterface = this.mYuppPlayerExoAnalyticsInterface;
                    if (yuppPlayerExoAnalyticsInterface != null && yuppPlayerExoAnalyticsInterface.getmSeekListener() != null && (playerControlView = this.mPlayerControlView) != null) {
                        playerControlView.setmOnSeekBarChangeListener(this.mYuppPlayerExoAnalyticsInterface.getmSeekListener());
                    }
                } catch (NullPointerException unused) {
                }
                this.mPlayerControlView.setAutoPlayListener(this);
                this.mPlayerControlView.setNextVideoListener(this);
                this.mPlayerControlView.setListener(this);
                if (this.shouldRestorePosition) {
                    ButtonType buttonType = this.mButtonType;
                    if (buttonType != null && (buttonType == ButtonType.START_OVER || buttonType == ButtonType.RESUME)) {
                        PlayerControlView playerControlView2 = this.mPlayerControlView;
                        if (playerControlView2 != null) {
                            playerControlView2.updateGoLiveButtonOnResume();
                        }
                        updateSurfaceView(true);
                    }
                    long j = this.playerPosition;
                    if (j == -9223372036854775807L) {
                        this.player.seekToDefaultPosition(this.playerWindow);
                    } else {
                        ButtonType buttonType2 = this.mButtonType;
                        if (buttonType2 != null && buttonType2 == ButtonType.START_OVER) {
                            this.isOverlayStartOver = true;
                        }
                        if (this.isRelay) {
                            this.isRelay = false;
                            this.player.seekTo(this.playerWindow, 0L);
                        } else {
                            this.player.seekTo(this.playerWindow, j);
                        }
                    }
                }
                if (getActivity() != null && !getActivity().isScreenLocked()) {
                    this.player.setPlayWhenReady(this.shouldAutoPlay);
                }
                this.playerNeedsSource = true;
            }
        }
        if (this.playerNeedsSource && this.player != null) {
            String string = bundle.getString("playerurl");
            if (string == null) {
                return;
            }
            Uri[] uriArr = {Uri.parse(string)};
            if (this.isDAIStream) {
                if (TextUtils.isEmpty(this.streamType)) {
                    i4 = Util.inferContentType(uriArr[0]);
                } else {
                    String str3 = this.streamType;
                    if ((str3 == null || !str3.equalsIgnoreCase("hls")) && (str = this.streamType) != null && (str.equalsIgnoreCase("dash") || this.streamType.equalsIgnoreCase("widevine"))) {
                        i4 = 0;
                    }
                }
                this.player.setMediaItem(MediaItem.fromUri(new ImaServerSideAdInsertionUriBuilder().setAssetKey(this.daiAssetKey).setFormat(i4).build()));
            } else {
                List<MediaItem> list = this.mediaItems;
                if (list == null) {
                    this.mediaItems = new ArrayList();
                } else {
                    list.clear();
                }
                if (!TextUtils.isEmpty(this.streamType) && this.streamType.equalsIgnoreCase("distro") && uriArr[0].toString().contains("__PALN__")) {
                    String uri = uriArr[0].toString();
                    PreferenceManager utilPreferenceManager = APIUtils.getUtilPreferenceManager(getContext().getApplicationContext());
                    generateNonceForAdRequest(uri, utilPreferenceManager.getSessionId() != null ? utilPreferenceManager.getSessionId() : "", utilPreferenceManager.getDeviceUniqueId() != null ? utilPreferenceManager.getDeviceUniqueId() : "", getContext().getResources().getDisplayMetrics().widthPixels, getContext().getResources().getDisplayMetrics().heightPixels);
                    return;
                }
                this.mediaItems.add(createMediaItem(bundle, uriArr[0]));
                this.player.setMediaItems(this.mediaItems, false);
            }
            ExoPlayer exoPlayer2 = this.player;
            if (exoPlayer2 != null) {
                exoPlayer2.prepare();
            }
            this.playerNeedsSource = false;
        }
        boolean z = this.isCloseCaptionsAvailable;
        if (z || this.isAudioTrackAvailable) {
            if (z) {
                this.subtitleLayout.setVisibility(0);
            }
            if (this.isAudioTrackAvailable) {
                this.audioLayout.setVisibility(0);
            }
            this.playerMultipleAudioSubtitleTracksBtn.setVisibility(0);
            this.playerCaptionsBtn.setVisibility(8);
        } else {
            this.subtitleLayout.setVisibility(8);
            this.audioLayout.setVisibility(8);
            this.playerMultipleAudioSubtitleTracksBtn.setVisibility(8);
        }
        setWaterMarkVisibility();
    }

    private void intiateStreamPollHandler() {
        if (this.sessionInfo != null) {
            if (getActivity() != null && (getActivity() instanceof FusionViliteMainActivity)) {
                getActivity().setStreamPollKey(this.sessionInfo.getStreamPollKey());
            }
            this.streamPollHandler.removeCallbacks(this.streamPollRunnable);
            this.streamPollHandler.postDelayed(this.streamPollRunnable, this.sessionInfo.getPollIntervalInMillis().intValue());
        }
    }

    private static boolean isBehindLiveWindow(ExoPlaybackException exoPlaybackException) {
        if (exoPlaybackException.type != 0) {
            return false;
        }
        for (Throwable sourceException = exoPlaybackException.getSourceException(); sourceException != null; sourceException = sourceException.getCause()) {
            if (sourceException instanceof BehindLiveWindowException) {
                return true;
            }
        }
        return false;
    }

    private boolean isInPlaybackState() {
        ExoPlayer exoPlayer = this.player;
        return (exoPlayer != null ? exoPlayer.getPlaybackState() : 0) == 3 && !this.isPauseByUser;
    }

    public void lambda$buildAdEventListener$6(AdEvent adEvent) {
        AdEvent.AdEventType type = adEvent.getType();
        if (type == AdEvent.AdEventType.AD_BREAK_STARTED) {
            this.isPlayingAd = true;
        } else if (type == AdEvent.AdEventType.ALL_ADS_COMPLETED) {
            this.isPlayingAd = false;
        } else if (type == AdEvent.AdEventType.AD_BREAK_ENDED) {
            this.isPlayingAd = false;
        }
    }

    public void lambda$mHandleStreamResponseErrorResponse$7() {
        PlayerControlView playerControlView;
        int i2 = getActivity() != null ? getActivity().getResources().getConfiguration().orientation : 1;
        CustomLog.e("TAG", "orientdd : " + i2);
        if (i2 == 1 || (playerControlView = this.mPlayerControlView) == null) {
            return;
        }
        playerControlView.changeOrientationToPortrait();
    }

    public void lambda$onCreateView$0(View view) {
        ExoPlayer exoPlayer = this.player;
        if (exoPlayer != null) {
            if (exoPlayer.getVolume() == 0.0f) {
                this.trailer_muteButton.setImageResource(R.drawable.trailer_unmute);
                this.player.setVolume(1.0f);
            } else {
                this.trailer_muteButton.setImageResource(R.drawable.trailer_mute);
                this.player.setVolume(0.0f);
            }
            eventCTClickEvent(this.contentPageItem, "mute_button");
        }
    }

    public void lambda$onCreateView$1(View view) {
        if (OTTApplication.IS_PLAYER_SCREEN_LOCKED) {
            return;
        }
        OTTApplication.IS_PLAYER_SCREEN_LOCKED = true;
        this.relatedVideos_layout.setVisibility(4);
        this.relatedVideos_layout_seasons.setVisibility(4);
        this.playerUnLock.setVisibility(0);
        hideControls();
        int requestedOrientation = this.mActivity.getRequestedOrientation();
        int rotation = ((WindowManager) this.mActivity.getSystemService("window")).getDefaultDisplay().getRotation();
        this.mActivity.setRequestedOrientation(rotation != 1 ? rotation != 3 ? requestedOrientation : 8 : 0);
    }

    public void lambda$onCreateView$2(View view) {
        if (OTTApplication.IS_PLAYER_SCREEN_LOCKED) {
            OTTApplication.IS_PLAYER_SCREEN_LOCKED = false;
            this.mPlayerControlView.brightBar.setVisibility(0);
            this.mPlayerControlView.volBar.setVisibility(0);
            setViewVisibility(R.id.app_video_center_box, true);
            this.playerUnLock.setColorFilter(getResources().getColor(R.color.white));
            this.mPlayerControlView.show();
            if (this.isLive) {
                this.relatedVideos_layout.setVisibility(0);
            }
            this.playerUnLock.setVisibility(8);
        }
    }

    public void lambda$onCreateView$3(View view) {
        this.mPlayerControlView.hide();
        eventCTPlayerAction("audio");
        trackEvent(AnalyticsV2.EVENT_PLAYER_CAPTIONS);
        TrackSelectionHelper trackSelectionHelper = this.trackSelectionHelper;
        if (trackSelectionHelper == null || !this.isAudioTrackAvailable) {
            return;
        }
        trackSelectionHelper.showSelectionDialog(getActivity(), this, "text", this.trackSelector, 1, true);
    }

    public void lambda$onStop$5() {
        ExoPlayer exoPlayer = this.player;
        if (exoPlayer != null) {
            exoPlayer.setPlayWhenReady(false);
        }
    }

    public void lambda$startShowingContentRating$4() {
        PlayerControlView playerControlView;
        if (this.isPlayingAd && (playerControlView = this.mPlayerControlView) != null) {
            playerControlView.ageRatingTime = this.CONTENT_RATING_VISIBLE_DURATION;
        }
        this.contentRatingHandler = null;
        setContentRatingVisibility(8);
    }

    public void launchActivity() {
        Intent intent = new Intent((Context) getActivity(), (Class<?>) FusionViliteMainActivity.class);
        intent.setAction("android.intent.action.MAIN");
        intent.addCategory("android.intent.category.LAUNCHER");
        intent.addFlags(67108864);
        intent.addFlags(268468224);
        getActivity().startActivity(intent);
    }

    public void launchExternalBrowser(String str) {
        try {
            startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
        } catch (Exception unused) {
        }
    }

    public void loadChromeCast() {
        OttLog.error("loadChromeCast", "loadChromeCast");
        this.contentId = this.contentId.trim().length() > 0 ? this.contentId : this.metaDataId;
        ArrayList arrayList = this.mStreamList;
        long j = 0;
        if (arrayList == null || arrayList.size() <= 0) {
            String str = this.mUrl;
            if (str == null || str.length() <= 0) {
                showError(true, "Unable to play");
            } else {
                ExoPlayer exoPlayer = this.player;
                if (exoPlayer != null && exoPlayer.getCurrentPosition() > 0) {
                    j = this.player.getCurrentPosition();
                }
                ChromeCastUtils.loadRemoteMedia(this.mc.getSessionManager().getCurrentCastSession(), this.mUrl, this.mBackgroundImage, j, this.mTitle, this.mSubTitle, this.previewDuration, this.licenseUrl, this.itemObject, this.contentId, this.licensePlayReadyUrl, this.mUrlPlayReady);
                showOverLayLayoutIfAny();
            }
        } else {
            ExoPlayer exoPlayer2 = this.player;
            if (exoPlayer2 != null && exoPlayer2.getCurrentPosition() > 0) {
                j = this.player.getCurrentPosition();
            }
            ChromeCastUtils.loadRemoteMediaQueue(this.mc.getSessionManager().getCurrentCastSession(), this.mStreamList, this.mBackgroundImage, j, this.mTitle, this.mSubTitle, this.streamPosition, this.previewDuration, this.licenseUrl, this.itemObject, this.contentId, this.licensePlayReadyUrl, this.mUrlPlayReady);
            showOverLayLayoutIfAny();
        }
        this.mc.removeCastStateListener(this.mCastStateListener);
        FragmentHost fragmentHost = this.mFragmentHost;
        if (fragmentHost != null) {
            fragmentHost.exitMiniPlayer();
        }
    }

    public void loadChromeCastFromStart(Object obj, long j, String str) {
        OttLog.error("loadChromeCastFromStart", "loadChromeCastFromStart");
        CustomLog.e("loadChromeCastFromStart ", "contentId :" + this.contentId);
        CustomLog.e("loadChromeCastFromStart", "contentKey :" + str);
        if (this.contentId.equalsIgnoreCase(str) && !Preferences.instance(getActivity()).getBooleanPreference("chromecast_stopped").booleanValue()) {
            if (this.isReplayClicked) {
                String str2 = this.mUrl;
                if (str2 == null || str2.length() <= 0) {
                    showError(true, "Unable to play");
                    return;
                }
                intiateStreamPollHandler();
                ChromeCastUtils.loadRemoteMedia(this.mc.getSessionManager().getCurrentCastSession(), this.mUrl, this.mBackgroundImage, 0L, this.mTitle, this.mSubTitle, this.previewDuration, this.licenseUrl, obj, str, this.licensePlayReadyUrl, this.mUrlPlayReady);
                this.isReplayClicked = false;
                return;
            }
            return;
        }
        ArrayList arrayList = this.mStreamList;
        if (arrayList != null && arrayList.size() > 0) {
            if (this.navigationToPackage) {
                this.navigationToPackage = false;
                sendStreamPlayerStatus(ConcurrentStreamStatus.POLL);
                return;
            } else {
                intiateStreamPollHandler();
                ChromeCastUtils.loadRemoteMediaQueue(this.mc.getSessionManager().getCurrentCastSession(), this.mStreamList, this.mBackgroundImage, 1000 * j, this.mTitle, this.mSubTitle, this.streamPosition, this.previewDuration, this.licenseUrl, this.itemObject, this.contentId, this.licensePlayReadyUrl, this.mUrlPlayReady);
                return;
            }
        }
        String str3 = this.mUrl;
        if (str3 == null || str3.length() <= 0) {
            showError(true, "Unable to play");
            return;
        }
        this.contentId = str;
        intiateStreamPollHandler();
        if (!this.navigationToPackage) {
            ChromeCastUtils.loadRemoteMedia(this.mc.getSessionManager().getCurrentCastSession(), this.mUrl, this.mBackgroundImage, j, this.mTitle, this.mSubTitle, this.previewDuration, this.licenseUrl, obj, str, this.licensePlayReadyUrl, this.mUrlPlayReady);
        } else {
            this.navigationToPackage = false;
            sendStreamPlayerStatus(ConcurrentStreamStatus.POLL);
        }
    }

    public void loadMoreDataAPI(int i2, String str) {
        if (OttSDK.getInstance() == null || OttSDK.getInstance().getMediaManager() == null || TextUtils.isEmpty(this.mPath) || TextUtils.isEmpty(str)) {
            return;
        }
        OttSDK.getInstance().getMediaManager().getPageSectionContent(this.mPath, str, i2, 10, null, null, new MediaCatalogManager.MediaCatalogCallback<List<Section.SectionData>>() {
            @Override
            public void onFailure(Error error) {
                NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "/service/api/v1/section/data", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
            }

            @Override
            public void onSuccess(List<Section.SectionData> list) {
                if (ExoPlayerFragment.this.getActivity() == null || list == null || list.size() < 1) {
                    return;
                }
                ExoPlayerFragment.this.lastIndex = list.get(0).getLastIndex().intValue();
                ExoPlayerFragment.this.hasMoreData = list.get(0).getHasMoreData().booleanValue();
                if (ExoPlayerFragment.this.cardsList != null) {
                    ExoPlayerFragment.this.cardsList.addAll(list.get(0).getCards());
                }
                if (ExoPlayerFragment.this.cardsList == null || ExoPlayerFragment.this.cardsList.size() <= 1) {
                    return;
                }
                LinkedHashSet linkedHashSet = new LinkedHashSet(ExoPlayerFragment.this.recommendationCards);
                linkedHashSet.addAll(ExoPlayerFragment.this.cardsList);
                ExoPlayerFragment.this.recommendationCards = new ArrayList(linkedHashSet);
                ExoPlayerFragment.this.cardsList.clear();
                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                boolean z = exoPlayerFragment.isLive;
                if (z) {
                    exoPlayerFragment.mGridAdapter.setData(ExoPlayerFragment.this.recommendationCards, Integer.valueOf(NavigationConstants.ROW_ITEM), Boolean.valueOf(ExoPlayerFragment.this.hasMoreData));
                } else {
                    if (z) {
                        return;
                    }
                    int itemCount = exoPlayerFragment.seasonViewAdapter.getItemCount();
                    ExoPlayerFragment.this.seasonViewAdapter.updateDataList(ExoPlayerFragment.this.recommendationCards);
                    ExoPlayerFragment.this.seasonViewAdapter.notifyItemRangeInserted(itemCount, list.get(0).getCards().size());
                }
            }
        });
    }

    public void mHandleStreamResponseErrorResponse(Object obj, Error error) {
        if (getActivity() == null) {
            return;
        }
        if (Constants.IS_LAST_CHANNEL.booleanValue()) {
            Constants.IS_LAST_CHANNEL = Boolean.FALSE;
            launchActivity();
            return;
        }
        PlayerControlView playerControlView = this.mPlayerControlView;
        if (playerControlView != null) {
            playerControlView.hideLoadingBar();
        }
        ContentPage contentPage = (ContentPage) obj;
        if (contentPage != null && contentPage.getPageData() != null && contentPage.getPageData().size() > 0 && contentPage.getPageData().get(0).getContent() != null) {
            setBackgroundImage(contentPage.getPageData().get(0).getContent().getBackgroundImage(), true);
            if ((error != null && error.getCode().intValue() == 405) || (error != null && error.getCode().intValue() == 402)) {
                getActivity().updateSubscriptionBanner();
            }
        }
        if (error != null && error.getCode().intValue() == 404 && this.shouldRemainUnPIPMode) {
            ((FusionViliteMainActivity) getActivity()).moveTaskToBack(false);
            this.shouldRemainUnPIPMode = false;
        }
        if (error != null) {
            showError(true, error.getMessage());
        }
        if (getActivity() != null && (getActivity() instanceof FusionViliteMainActivity)) {
            getActivity().showSuggestionsLayout(obj);
        }
        showReplayButton(false);
        PlayerControlView playerControlView2 = this.mPlayerControlView;
        if (playerControlView2 != null) {
            playerControlView2.setListener(this);
        }
        this.isPlayerError = true;
        HashMap hashMap = new HashMap();
        if (error != null) {
            hashMap.put("errorMsg", error.getMessage());
        }
        hashMap.put("PIN", this.parentalPassCode);
        String str = Configurations.ParentalControlPopupMessage;
        if (str == null || str.trim().length() <= 0) {
            hashMap.put("msg1", String.format(getActivity().getResources().getString(R.string.parental_control_popup_title), Integer.valueOf(Configurations.ParentalControlPinLength)));
        } else {
            hashMap.put("msg1", Configurations.ParentalControlPopupMessage);
        }
        if (error != null) {
            int intValue = error.getCode().intValue();
            if (intValue == -823) {
                NavigationUtils.showDialog(getActivity(), DialogType.PARENTAL_CONTROL_PASSCODE_DIALOG, hashMap, this.dialogListener);
            } else if (intValue == 200 || intValue == 404) {
                Toast.makeText((Context) this.mActivity, (CharSequence) ("" + error.getMessage()), 0).show();
            } else if (intValue == -821) {
                NavigationUtils.showDialog(getActivity(), DialogType.PARENTAL_CONTROL_PASSCODE_DIALOG, hashMap, this.dialogListener);
            } else if (intValue == -820) {
                NavigationUtils.showDialog(getActivity(), DialogType.PARENTAL_CONTROL_PASSCODE_DIALOG, hashMap, this.dialogListener);
            } else if (intValue == -15 || intValue == -14) {
                AppCompatButton appCompatButton = this.verify_button;
                if (appCompatButton != null) {
                    appCompatButton.setVisibility(0);
                }
                if (this.initialOTPVerify) {
                    this.initialOTPVerify = false;
                    AnalyticsV2.getInstance().trackEvent(AnalyticsV2.EVENT_PLAYER_OTP);
                    NavigationUtils.loadScreenActivityForResult(getActivity(), ScreenType.OTP_VERIFY, NavigationConstants.NAV_FROM_PLAYER, (String) null, 9, "", "");
                } else {
                    showError(true, error.getMessage());
                }
            } else {
                this.parentalPassCode = "";
            }
        }
        try {
            if (this.mCastLayout != null) {
                hideChromeCast();
                this.mCastLayout.setVisibility(4);
            }
        } catch (Exception unused) {
        }
        new Handler().post(new Runnable() {
            @Override
            public final void run() {
                ExoPlayerFragment.this.lambda$mHandleStreamResponseErrorResponse$7();
            }
        });
    }

    public void mHandleStreamResponseSuccessResponse(com.yupptv.ottsdk.model.stream.StreamResponse r15, final java.lang.Object r16, final java.util.List<com.yupptv.ottsdk.model.PageData> r17, final com.yupptv.ottsdk.model.PageInfo r18, com.yupptv.ottsdk.model.StreamStatus r19) {
        throw new UnsupportedOperationException("Method not decompiled: com.yupptv.ott.player.ExoPlayerFragment.mHandleStreamResponseSuccessResponse(com.yupptv.ottsdk.model.stream.StreamResponse, java.lang.Object, java.util.List, com.yupptv.ottsdk.model.PageInfo, com.yupptv.ottsdk.model.StreamStatus):void");
    }

    public void mHandleStreamWatchnowSuccessResponse(StreamResponse streamResponse, Object obj, List<PageData> list, final PageInfo pageInfo, StreamStatus streamStatus) {
        prepareplayerUrl(streamResponse);
        updateSurfaceView(true);
        this.playerPosition = this.seekPosition;
        StreamResponse streamResponse2 = this.streamResponseObject;
        if (streamResponse2 != null && streamResponse2.getAnalyticsInfo() != null && this.streamResponseObject.getAnalyticsInfo().getContentType() != null && this.streamResponseObject.getAnalyticsInfo().getContentType().equalsIgnoreCase("live")) {
            this.playerPosition = -9223372036854775807L;
        }
        this.shouldRestorePosition = true;
        if (TextUtils.isEmpty(this.mUrl)) {
            return;
        }
        this.mHandler.post(new Runnable() {
            @Override
            public void run() {
                ExoPlayerFragment.this.mPlayerBundle = new Bundle();
                ExoPlayerFragment.this.mPlayerBundle.putString("playerurl", ExoPlayerFragment.this.mUrl);
                if (ExoPlayerFragment.this.getActivity() != null) {
                    ExoPlayerFragment.this.shouldAutoPlay = true;
                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                    exoPlayerFragment.initializePlayer(exoPlayerFragment.mPlayerBundle);
                    ExoPlayerFragment.this.showReplayButton(false);
                    PageInfo pageInfo2 = pageInfo;
                    if (pageInfo2 == null || pageInfo2.getPath() == null) {
                        return;
                    }
                    ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                    exoPlayerFragment2.mNextVideoObject = null;
                    exoPlayerFragment2.getNextVideo(pageInfo.getPath());
                }
            }
        });
    }

    @NonNull
    private View.OnTouchListener onTouchListener() {
        return new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                LinearLayout linearLayout = ExoPlayerFragment.this.relatedVideos_layout;
                if (linearLayout != null && linearLayout.getVisibility() == 0) {
                    return true;
                }
                CustomLog.e("Ads ::", "onTouch playing ad" + ExoPlayerFragment.this.isPlayingAd);
                if (ExoPlayerFragment.this.isPlayingAd) {
                    CustomLog.e("Ads ::", "onTouch playing ad" + ExoPlayerFragment.this.player.isPlayingAd());
                    PlayerControlView playerControlView = ExoPlayerFragment.this.mPlayerControlView;
                    if (playerControlView != null) {
                        playerControlView.hide();
                        return true;
                    }
                }
                if (motionEvent.getActionMasked() == 0 && ExoPlayerFragment.this.player_replay.getVisibility() != 0) {
                    if (ExoPlayerFragment.this.mPlayerControlView.isVisible()) {
                        ExoPlayerFragment.this.mPlayerControlView.hide();
                        ExoPlayerFragment.this.getActivity().getSupportActionBar().hide();
                    } else {
                        ExoPlayerFragment.this.mPlayerControlView.show();
                        ExoPlayerFragment.this.getActivity().getSupportActionBar().show();
                    }
                }
                if (ExoPlayerFragment.this.player_replay.getVisibility() == 0) {
                    ExoPlayerFragment.this.mPlayerControlView.showOptions(10000);
                }
                return true;
            }
        };
    }

    private void pauseMOUTracker() {
        MOUTracker mOUTracker = this.mouTracker;
        if (mOUTracker != null) {
            mOUTracker.pausedAt();
        }
    }

    public void playLastChannel() {
        String stringPreference = Preferences.instance(getActivity()).getStringPreference("lastchannel");
        if (stringPreference == null || stringPreference.trim().length() <= 0) {
            return;
        }
        OttSDK.getInstance().getMediaManager().getPageContent(stringPreference, new MediaCatalogManager.MediaCatalogCallback<ContentPage>() {
            @Override
            public void onFailure(Error error) {
                if (ExoPlayerFragment.this.getActivity() != null && !ExoPlayerFragment.this.getActivity().isFinishing()) {
                    com.yupptv.ott.fragments.a.a(error, ExoPlayerFragment.this.getActivity(), 1);
                }
                NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "/service/api/v1/page/content", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
            }

            @Override
            public void onSuccess(ContentPage contentPage) {
                if (ExoPlayerFragment.this.getActivity() instanceof FusionViliteMainActivity) {
                    ExoPlayerFragment.this.getActivity().setButtonType(ButtonType.NONE);
                    ExoPlayerFragment.this.getActivity().goToDetail(contentPage);
                }
            }
        });
    }

    private void prepareplayerUrl(StreamResponse streamResponse) {
        this.drmExtraHeaders = null;
        if (streamResponse == null || streamResponse.getStreams() == null) {
            return;
        }
        if (streamResponse.getPageAttributes() != null && streamResponse.getPageAttributes().getAssetId() != null && streamResponse.getPageAttributes().getAssetId().trim().length() > 0 && !streamResponse.getPageAttributes().getAssetId().trim().equalsIgnoreCase("")) {
            this.klikkAnalyticsAssetId = streamResponse.getPageAttributes().getAssetId();
        }
        int size = streamResponse.getStreams().size();
        this.parentalPassCode = "";
        if (size > 0) {
            PlayerControlView playerControlView = this.mPlayerControlView;
            if (playerControlView != null) {
                playerControlView.landHolder.setVisibility(0);
            }
            this.startOverBtn.setVisibility(0);
            this.playerSettingsBtn.setVisibility(8);
            this.mUrl = streamResponse.getStreams().get(0).getUrl() != null ? streamResponse.getStreams().get(0).getUrl() : "";
            if (streamResponse.getStreams().get(0).getAttributes() != null && streamResponse.getStreams().get(0).getAttributes().getPartnerCode() != null && streamResponse.getStreams().get(0).getAttributes().getPartnerCode().trim().length() > 0) {
                this.klikkAnalyticsPartnerId = streamResponse.getStreams().get(0).getAttributes().getPartnerCode() != null ? streamResponse.getStreams().get(0).getAttributes().getPartnerCode() : "";
            }
            int i2 = 0;
            while (true) {
                if (i2 >= size) {
                    break;
                }
                if (streamResponse.getStreams().get(i2).getUrl() == null || streamResponse.getStreams().get(i2).getStreamType() == null || !streamResponse.getStreams().get(i2).getStreamType().equalsIgnoreCase("widevine")) {
                    if (streamResponse.getAnalyticsInfo() == null || TextUtils.isEmpty(streamResponse.getAnalyticsInfo().getContentType())) {
                        if (streamResponse.getStreams().get(i2).getUrl() != null && streamResponse.getStreams().get(i2).getStreamType() != null && streamResponse.getStreams().get(i2).getStreamType().equalsIgnoreCase("akamai")) {
                            this.mUrl = streamResponse.getStreams().get(i2).getUrl();
                            if (streamResponse.getStreams().get(i2).getAttributes() != null && streamResponse.getStreams().get(i2).getAttributes().getPartnerCode() != null && streamResponse.getStreams().get(i2).getAttributes().getPartnerCode().trim().length() > 0) {
                                this.klikkAnalyticsPartnerId = streamResponse.getStreams().get(i2).getAttributes().getPartnerCode() != null ? streamResponse.getStreams().get(i2).getAttributes().getPartnerCode() : "";
                            }
                        } else if (streamResponse.getStreams().get(i2).getUrl() == null || streamResponse.getStreams().get(i2).getStreamType() == null || !streamResponse.getStreams().get(i2).getStreamType().equalsIgnoreCase("dishaes")) {
                            this.mUrl = streamResponse.getStreams().get(i2).getUrl();
                            if (streamResponse.getStreams().get(i2).getAttributes() != null && streamResponse.getStreams().get(i2).getAttributes().getPartnerCode() != null && streamResponse.getStreams().get(i2).getAttributes().getPartnerCode().trim().length() > 0) {
                                this.klikkAnalyticsPartnerId = streamResponse.getStreams().get(i2).getAttributes().getPartnerCode() != null ? streamResponse.getStreams().get(i2).getAttributes().getPartnerCode() : "";
                            }
                        } else {
                            this.mUrl = streamResponse.getStreams().get(i2).getUrl();
                            Stream.StreamParams params = streamResponse.getStreams().get(i2).getParams();
                            if (params != null && params.getSessionid() != null && params.getSessionid().trim().length() > 0) {
                                this.mAesSession = params.getSessionid().trim();
                            }
                            if (params != null && params.getToken() != null && params.getToken().trim().length() > 0) {
                                this.mAesToken = params.getToken().trim();
                            }
                            if (streamResponse.getStreams().get(i2).getAttributes() != null && streamResponse.getStreams().get(i2).getAttributes().getPartnerCode() != null && streamResponse.getStreams().get(i2).getAttributes().getPartnerCode().trim().length() > 0) {
                                this.klikkAnalyticsPartnerId = streamResponse.getStreams().get(i2).getAttributes().getPartnerCode() != null ? streamResponse.getStreams().get(i2).getAttributes().getPartnerCode() : "";
                            }
                        }
                    } else if (streamResponse.getAnalyticsInfo().getContentType().equalsIgnoreCase("live")) {
                        this.startOverBtn.setVisibility(8);
                        this.mPlayerControlView.isLive = true;
                        this.playerSettingsBtn.setVisibility(0);
                        PlayerControlView playerControlView2 = this.mPlayerControlView;
                        if (playerControlView2 != null) {
                            playerControlView2.landHolder.setVisibility(4);
                        }
                    } else {
                        this.startOverBtn.setVisibility(0);
                        this.playerSettingsBtn.setVisibility(8);
                    }
                    i2++;
                } else {
                    CustomLog.e("Widevine", "DRM Stream");
                    this.mUrl = streamResponse.getStreams().get(i2).getUrl();
                    if (streamResponse.getStreams().get(i2).getAttributes() != null) {
                        String appendHeaders = streamResponse.getStreams().get(i2).getAttributes().getAppendHeaders();
                        if (!TextUtils.isEmpty(appendHeaders)) {
                            try {
                                JSONObject jSONObject = new JSONObject(appendHeaders);
                                Iterator<String> keys = jSONObject.keys();
                                this.drmExtraHeaders = new HashMap<>();
                                while (keys.hasNext()) {
                                    String next = keys.next();
                                    this.drmExtraHeaders.put(next, jSONObject.getString(next));
                                }
                            } catch (Throwable unused) {
                            }
                        }
                        if (streamResponse.getStreams().get(i2).getAttributes().getPartnerCode() != null && streamResponse.getStreams().get(i2).getAttributes().getPartnerCode().trim().length() > 0) {
                            this.klikkAnalyticsPartnerId = streamResponse.getStreams().get(i2).getAttributes().getPartnerCode() != null ? streamResponse.getStreams().get(i2).getAttributes().getPartnerCode() : "";
                        }
                    }
                    String licenseKey = streamResponse.getStreams().get(i2).getStreamKeys().getLicenseKey();
                    this.licenseUrl = licenseKey;
                    updateDrmLicense(licenseKey);
                    setPlayerView(this.container);
                }
            }
            for (int i3 = 0; i3 < size; i3++) {
                try {
                } catch (Exception unused2) {
                    this.mUrlPlayReady = streamResponse.getStreams().get(0).getUrl() != null ? streamResponse.getStreams().get(0).getUrl() : "";
                    this.licensePlayReadyUrl = streamResponse.getStreams().get(0).getStreamKeys().getLicenseKey() != null ? streamResponse.getStreams().get(0).getStreamKeys().getLicenseKey() : "";
                }
                if (streamResponse.getStreams().get(i3).getUrl() != null && streamResponse.getStreams().get(i3).getStreamType() != null && streamResponse.getStreams().get(i3).getStreamType().equalsIgnoreCase("playReady")) {
                    this.mUrlPlayReady = streamResponse.getStreams().get(i3).getUrl();
                    this.licensePlayReadyUrl = streamResponse.getStreams().get(i3).getStreamKeys().getLicenseKey();
                    break;
                }
                if (streamResponse.getStreams().get(i3).getUrl() != null && streamResponse.getStreams().get(i3).getStreamType() != null && streamResponse.getStreams().get(i3).getStreamType().equalsIgnoreCase("akamai")) {
                    this.mUrlPlayReady = streamResponse.getStreams().get(i3).getUrl();
                    this.licensePlayReadyUrl = streamResponse.getStreams().get(i3).getStreamKeys().getLicenseKey();
                }
            }
        }
        if (streamResponse.getPageAttributes() == null || TextUtils.isEmpty(streamResponse.getPageAttributes().getPgRatingTitle()) || TextUtils.isEmpty(streamResponse.getPageAttributes().getPgRatingSubtitle())) {
            return;
        }
        setContentRating(streamResponse.getPageAttributes().getPgRatingTitle(), streamResponse.getPageAttributes().getPgRatingSubtitle());
    }

    private void registerAudioFocus() {
        if (this.audioEventManager == null) {
            this.audioEventManager = new AudioEventManager(this.mActivity);
        }
        this.audioEventManager.register(new AudioEventManagerCallbackListener() {
            @Override
            public void CommandCreate() {
            }

            @Override
            public void CommandPause() {
                ImageView imageView;
                CustomLog.e("registerAudioFocus", "CommandPause");
                ExoPlayer exoPlayer = ExoPlayerFragment.this.player;
                if (exoPlayer != null) {
                    exoPlayer.setPlayWhenReady(false);
                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                    if (exoPlayerFragment.mPauseButton == null || (imageView = exoPlayerFragment.mPlayButton) == null) {
                        return;
                    }
                    imageView.setVisibility(0);
                    ExoPlayerFragment.this.mPauseButton.setVisibility(8);
                }
            }

            @Override
            public void CommandPlay() {
                ExoPlayer exoPlayer = ExoPlayerFragment.this.player;
                if (exoPlayer == null || !exoPlayer.getPlayWhenReady()) {
                    return;
                }
                ExoPlayerFragment.this.player.setPlayWhenReady(true);
                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                ImageView imageView = exoPlayerFragment.mPlayButton;
                if (imageView == null || exoPlayerFragment.mPauseButton == null) {
                    return;
                }
                imageView.setVisibility(8);
                ExoPlayerFragment.this.mPauseButton.setVisibility(0);
            }

            @Override
            public void CommandRelease(boolean z) {
                CustomLog.e("registerAudioFocus", "CommandRelease");
                ExoPlayer exoPlayer = ExoPlayerFragment.this.player;
                if (exoPlayer != null) {
                    exoPlayer.setPlayWhenReady(false);
                }
            }

            @Override
            public void CommandVolume(float f2) {
                CustomLog.e("registerAudioFocus", "CommandVolume");
            }
        });
    }

    private void releaseAdsLoader() {
        AdsLoader adsLoader;
        this.isComingFromBackground = false;
        if (!this.playAds || (adsLoader = this.adsLoader) == null) {
            return;
        }
        this.isPlayingAd = false;
        this.isAdLoaded = false;
        adsLoader.release();
        this.adsLoader = null;
        this.loadedAdTagUri = null;
        PlayerView playerView = this.simpleExoPlayerView;
        if (playerView == null || playerView.getOverlayFrameLayout() == null) {
            return;
        }
        this.simpleExoPlayerView.getOverlayFrameLayout().removeAllViews();
    }

    public void releaseAnalytics() {
        YuppAnalytics yuppAnalytics;
        if (this.isPlayingAd && (yuppAnalytics = this.mOttAnalytics) != null) {
            yuppAnalytics.handleAdEndedByUser(this.adType);
        }
        Handler handler = this.epgCheckHandler;
        if (handler != null) {
            handler.removeCallbacks(this.epgCheckRunnable);
        }
        YuppAnalytics yuppAnalytics2 = this.mOttAnalytics;
        if (yuppAnalytics2 != null) {
            yuppAnalytics2.handlePlayEndedByUser();
        }
        YuppPlayerExoAnalyticsInterface yuppPlayerExoAnalyticsInterface = this.mYuppPlayerExoAnalyticsInterface;
        if (yuppPlayerExoAnalyticsInterface != null) {
            yuppPlayerExoAnalyticsInterface.cleanup();
            this.mYuppPlayerExoAnalyticsInterface.releaseYuppExoAnalyticsInterface();
        }
        this.mOttAnalytics = null;
    }

    private void releaseAnalyticsAuto() {
        YuppAnalytics yuppAnalytics;
        if (this.isPlayingAd && (yuppAnalytics = this.mOttAnalytics) != null) {
            yuppAnalytics.handleAdEndedByUser(this.adType);
        }
        YuppAnalytics yuppAnalytics2 = this.mOttAnalytics;
        if (yuppAnalytics2 != null) {
            yuppAnalytics2.handlePlayEnd();
        }
        YuppPlayerExoAnalyticsInterface yuppPlayerExoAnalyticsInterface = this.mYuppPlayerExoAnalyticsInterface;
        if (yuppPlayerExoAnalyticsInterface != null) {
            yuppPlayerExoAnalyticsInterface.cleanup();
        }
        this.mOttAnalytics = null;
    }

    private void releasePlayerAtUnknownException() {
        ImaServerSideAdInsertionMediaSource.AdsLoader adsLoader = this.imaDaiAdsLoader;
        if (adsLoader != null && this.imaDaiAdsLoaderState != null) {
            this.imaDaiAdsLoaderState = adsLoader.release();
        }
        ContentPage contentPage = this.contentPageItem;
        if (contentPage == null || contentPage.getPageData() == null || this.contentPageItem.getPageData().get(0) == null || this.contentPageItem.getPageData().get(0).getContent() == null || TextUtils.isEmpty(this.contentPageItem.getPageData().get(0).getContent().getBackgroundImage())) {
            this.background_image.setImageResource(R.drawable.default_banner);
        } else {
            String backgroundImage = this.contentPageItem.getPageData().get(0).getContent().getBackgroundImage();
            this.bg_image = backgroundImage;
            setBackgroundImage(backgroundImage, true);
        }
        try {
            if (this.itemObject != null && getActivity() != null && (getActivity() instanceof FusionViliteMainActivity)) {
                getActivity().showSuggestionsLayout(this.itemObject);
            }
        } catch (Exception unused) {
        }
        this.isTrailer = false;
    }

    public void removedStreamActiveSession() {
        if (this.sessionInfo == null || getActivity() == null) {
            return;
        }
        getActivity().setStreamPollKey("");
        if (OttSDK.getInstance() == null || OttSDK.getInstance().getUserManager() == null) {
            return;
        }
        OttSDK.getInstance().getUserManager().removedStreamActiveSession(this.sessionInfo.getStreamPollKey(), new UserManager.UserCallback<String>() {
            @Override
            public void onEmptySuccess() {
                com.yupptv.ottsdk.managers.User.a.a(this);
            }

            @Override
            public void onFailure(Error error) {
                ExoPlayerFragment.this.streamPollHandler.removeCallbacks(ExoPlayerFragment.this.streamPollRunnable);
                NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "/service/api/v1/stream/session/end", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
            }

            @Override
            public void onSuccess(String str) {
                ExoPlayerFragment.this.streamPollHandler.removeCallbacks(ExoPlayerFragment.this.streamPollRunnable);
            }
        });
    }

    public void replayVideo() {
        ContentPage contentPage;
        if (!this.parentalPassCode.isEmpty() || (contentPage = this.contentPageItem) == null || contentPage.getStreamStatus() == null || this.contentPageItem.getStreamStatus().getParentControlled() == null || !this.contentPageItem.getStreamStatus().getParentControlled().booleanValue()) {
            this.timer = null;
            if (this.mOttAnalytics == null) {
                this.mOttAnalytics = YuppAnalytics.getInstance(getActivity());
            }
            if (this.mNextVideoObject != null) {
                this.showNextVideo = true;
            }
            getPageInfo();
            showReplayButton(false);
            return;
        }
        this.isPlayerError = true;
        if (this.mPlayerControlView.player_loading.getVisibility() == 0) {
            this.mPlayerControlView.showProgress(false);
        }
        HashMap hashMap = new HashMap();
        String str = Configurations.ParentalControlPopupMessage;
        hashMap.put("msg1", (str == null || str.trim().length() <= 0) ? String.format(getActivity().getResources().getString(R.string.parental_control_popup_title), Integer.valueOf(Configurations.ParentalControlPinLength)) : Configurations.ParentalControlPopupMessage);
        NavigationUtils.showDialog(getActivity(), DialogType.PARENTAL_CONTROL_PASSCODE_DIALOG, hashMap, this.dialogListener);
    }

    private void resetValues() {
        this.isTVShow = false;
        this.isLive = false;
        this.isInitPlay = true;
        this.currentAdPosition = -1;
        this.totalAds = -1;
        this.mAesToken = "";
        this.mAesSession = "";
        this.mUrl = "";
        this.mUrlPlayReady = "";
        this.testURL = "";
        this.testStartTime = 0L;
    }

    private void resumeMOUTracker() {
        MOUTracker mOUTracker = this.mouTracker;
        if (mOUTracker != null) {
            mOUTracker.resumedAt();
        }
    }

    public void sendStreamPlayerStatus(ConcurrentStreamStatus concurrentStreamStatus) {
        StreamResponse.SessionInfo sessionInfo = this.sessionInfo;
        if (sessionInfo == null || TextUtils.isEmpty(sessionInfo.getStreamPollKey())) {
            return;
        }
        OttSDK.getInstance().getUserManager().doStreamPoll(this.sessionInfo.getStreamPollKey(), new UserManager.UserCallback<String>() {
            @Override
            public void onEmptySuccess() {
                com.yupptv.ottsdk.managers.User.a.a(this);
            }

            @Override
            public void onFailure(Error error) {
                CustomLog.e("service/api/v1/stream/poll ", "onFailure");
                OttLog.error("poll error", "++++++" + error.toString());
                NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "/service/api/v1/stream/poll", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
                if (ExoPlayerFragment.this.mc != null && ExoPlayerFragment.this.mc.getCastState() == 4) {
                    ChromeCastUtils.stopChromecast(ExoPlayerFragment.this.mc.getSessionManager().getCurrentCastSession());
                    ExoPlayerFragment.this.removedStreamActiveSession();
                }
                if (ExoPlayerFragment.this.getActivity() == null || !ExoPlayerFragment.this.isAdded() || ExoPlayerFragment.this.sessionInfo == null) {
                    return;
                }
                ExoPlayerFragment.this.streamStatus = 1;
                HashMap hashMap = new HashMap();
                hashMap.put(Constants.DIALOG_TITLE, error.getMessage());
                if (error.getDetails() != null) {
                    hashMap.put(Constants.DIALOG_MSG, error.getDetails().getDescription());
                } else {
                    hashMap.put(Constants.DIALOG_MSG, "");
                }
                int intValue = error.getCode().intValue();
                if (intValue == -4402) {
                    ExoPlayerFragment.this.stopPlayer();
                    hashMap.put(Constants.DIALOG_BUTTON_LABEL3, ExoPlayerFragment.this.getString(R.string.close_screen));
                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                    exoPlayerFragment.showDialogPopup(hashMap, "", exoPlayerFragment.sessionInfo.getStreamPollKey());
                    ExoPlayerFragment.this.sessionInfo = null;
                    return;
                }
                if (intValue == -4401) {
                    ExoPlayerFragment.this.stopPlayer();
                    hashMap.put(Constants.DIALOG_BUTTON_LABEL3, ExoPlayerFragment.this.getString(R.string.close_screen));
                    hashMap.put(Constants.DIALOG_BUTTON_LABEL1, ExoPlayerFragment.this.getString(R.string.upgrade_plan));
                    ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                    exoPlayerFragment2.showDialogPopup(hashMap, NavigationConstants.PAYMENT_UPGRADE_PLAN, exoPlayerFragment2.sessionInfo.getStreamPollKey());
                    ExoPlayerFragment.this.sessionInfo = null;
                    return;
                }
                if (intValue == -4001) {
                    ExoPlayerFragment.this.stopPlayer();
                    hashMap.put(Constants.DIALOG_BUTTON_LABEL2, ExoPlayerFragment.this.getString(R.string.view_active_screens));
                    ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                    exoPlayerFragment3.showDialogPopup(hashMap, "", exoPlayerFragment3.sessionInfo.getStreamPollKey());
                    ExoPlayerFragment.this.sessionInfo = null;
                    return;
                }
                if (intValue != -4000) {
                    if (ExoPlayerFragment.this.sessionInfo.getPollIntervalInMillis().intValue() > 0) {
                        ExoPlayerFragment.this.streamPollHandler.removeCallbacks(ExoPlayerFragment.this.streamPollRunnable);
                        ExoPlayerFragment.this.streamPollHandler.postDelayed(ExoPlayerFragment.this.streamPollRunnable, ExoPlayerFragment.this.sessionInfo.getPollIntervalInMillis().intValue());
                        return;
                    }
                    return;
                }
                ExoPlayerFragment.this.stopPlayer();
                hashMap.put(Constants.DIALOG_BUTTON_LABEL2, ExoPlayerFragment.this.getResources().getString(R.string.view_active_screens));
                hashMap.put(Constants.DIALOG_BUTTON_LABEL1, ExoPlayerFragment.this.getResources().getString(R.string.upgrade_plan));
                ExoPlayerFragment exoPlayerFragment4 = ExoPlayerFragment.this;
                exoPlayerFragment4.showDialogPopup(hashMap, NavigationConstants.PAYMENT_UPGRADE_PLAN, exoPlayerFragment4.sessionInfo.getStreamPollKey());
                ExoPlayerFragment.this.sessionInfo = null;
            }

            @Override
            public void onSuccess(String str) {
                CustomLog.e("service/api/v1/stream/poll ", "onSuccess");
                if (ExoPlayerFragment.this.sessionInfo.getPollIntervalInMillis().intValue() > 0) {
                    ExoPlayerFragment.this.streamPollHandler.removeCallbacks(ExoPlayerFragment.this.streamPollRunnable);
                    ExoPlayerFragment.this.streamPollHandler.postDelayed(ExoPlayerFragment.this.streamPollRunnable, ExoPlayerFragment.this.sessionInfo.getPollIntervalInMillis().intValue());
                }
            }
        });
    }

    private void setAdapter(GridController gridController) {
        this.recycledViewPool.clear();
        this.relatedVideosRecyclerView.setAdapter((RecyclerView.Adapter) null);
        RecyclerView recyclerView = this.relatedVideosRecyclerView;
        if (recyclerView != null && this.isLive) {
            recyclerView.setAdapter(gridController.getAdapter());
        }
        this.relatedvideosrecyclerview_episodes.setAdapter((RecyclerView.Adapter) null);
        RecyclerView recyclerView2 = this.relatedvideosrecyclerview_episodes;
        if (recyclerView2 == null || this.isLive) {
            return;
        }
        recyclerView2.setAdapter(gridController.getAdapter());
    }

    private void setContentRating(String str, String str2) {
        TextView textView = this.maturityRatingTitle;
        if (textView == null || this.maturityRatingDesc == null) {
            return;
        }
        textView.setText(str);
        this.maturityRatingDesc.setText(str2);
    }

    public void setPlayBackSpeed(float f2) {
        if (this.player != null) {
            PlaybackParameters playbackParameters = new PlaybackParameters(f2);
            this.playbackParameters = playbackParameters;
            this.player.setPlaybackParameters(playbackParameters);
        }
    }

    public void setPlayerView(@Nullable View view) {
        if (getActivity() == null || !isAdded()) {
            return;
        }
        getActivity().runOnUiThread(new AnonymousClass26(view));
    }

    public void setProgramEndTime(long j) {
        this.programEndTime = j;
    }

    public void setProgramStartTime(long j) {
        this.programStartTime = j;
    }

    private void setViewVisibility(int i2, boolean z) {
        getView(i2).setVisibility(z ? 0 : 4);
    }

    private void setWaterMarkVisibility() {
        StreamResponse streamResponse;
        boolean z;
        String str = "";
        try {
            this.waterMark.setVisibility(8);
            this.waterMarkRelativeLayout.setVisibility(8);
            OttSDK ottSDK = OttSDK.getInstance();
            Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(getContext().getApplicationContext());
            if (ottSDK == null || ottSDK.getPreferenceManager() == null || ottSDK.getPreferenceManager().getLoggedUser() == null || ottSDK.getPreferenceManager().getLoggedUser().getUserId() == null || ottSDK.getApplicationManager() == null || utilAppConfigurations == null || (streamResponse = this.streamResponseObject) == null || streamResponse.getAnalyticsInfo() == null || this.streamResponseObject.getAnalyticsInfo().getContentType() == null || this.streamResponseObject.getAnalyticsInfo().getContentType().trim().length() <= 0 || this.streamResponseObject.getAnalyticsInfo().getContentType().trim().equalsIgnoreCase("")) {
                this.waterMark.setVisibility(8);
                this.waterMarkRelativeLayout.setVisibility(8);
                return;
            }
            int intValue = ottSDK.getPreferenceManager().getLoggedUser().getUserCategory().intValue();
            if (utilAppConfigurations.getWaterMarkInfoOnPlayer() == null || utilAppConfigurations.getWaterMarkInfoOnPlayer().equalsIgnoreCase("") || utilAppConfigurations.getWaterMarkInfoOnPlayer().isEmpty()) {
                this.waterMark.setVisibility(8);
                this.waterMarkRelativeLayout.setVisibility(8);
                return;
            }
            JSONObject jSONObject = new JSONObject(utilAppConfigurations.getWaterMarkInfoOnPlayer());
            if (!jSONObject.has("supportedContentTypes")) {
                this.waterMark.setVisibility(8);
                this.waterMarkRelativeLayout.setVisibility(8);
                return;
            }
            String string = jSONObject.getString("supportedContentTypes");
            String contentType = this.streamResponseObject.getAnalyticsInfo().getContentType();
            if (string == null || string.trim().length() <= 0 || string.trim().equalsIgnoreCase("")) {
                this.waterMark.setVisibility(8);
                this.waterMarkRelativeLayout.setVisibility(8);
                return;
            }
            if (string.contains(",")) {
                String[] split = string.split(",");
                z = false;
                for (String str2 : split) {
                    if (str2.equalsIgnoreCase(contentType)) {
                        z = true;
                    }
                }
            } else {
                z = string.equalsIgnoreCase(contentType);
            }
            if (!z) {
                ImageView imageView = this.waterMark;
                if (imageView != null) {
                    imageView.setVisibility(8);
                    this.waterMarkRelativeLayout.setVisibility(8);
                    return;
                }
                return;
            }
            if (jSONObject.has("dishtvImagePath") && jSONObject.getString("dishtvImagePath").trim().length() > 0 && intValue == 1) {
                str = jSONObject.getString("dishtvImagePath");
            }
            if (jSONObject.has("d2hImagePath") && jSONObject.getString("d2hImagePath").trim().length() > 0 && intValue == 2) {
                str = jSONObject.getString("d2hImagePath");
            }
            if (jSONObject.has("defaultImagePath") && jSONObject.getString("defaultImagePath").trim().length() > 0) {
                str = jSONObject.getString("defaultImagePath");
            }
            Glide.with(getContext().getApplicationContext()).load(APIUtils.getAbsoluteImagePath(getContext().getApplicationContext(), str)).into(this.waterMark);
            this.waterMark.setVisibility(0);
            this.waterMarkRelativeLayout.setVisibility(0);
        } catch (Exception e2) {
            CustomLog.e("waterMarkVisibilityException", " " + e2.getMessage());
            this.waterMark.setVisibility(8);
            this.waterMarkRelativeLayout.setVisibility(8);
        }
    }

    public void share() {
        String str;
        if (this.shareInfo != null) {
            trackEvent(AnalyticsV2.EVENT_PLAYER_SHARE);
            Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(getContext().getApplicationContext());
            String siteURL = (utilAppConfigurations == null || utilAppConfigurations.getSiteURL() == null) ? "" : utilAppConfigurations.getSiteURL();
            if (siteURL.length() > 1) {
                StringBuilder a = com.yupptv.ott.a.a(siteURL);
                a.append(siteURL.endsWith("/") ? "" : "/");
                a.append(this.contentPageItem.getPageInfo().getPath());
                str = a.toString();
            } else {
                str = "";
            }
            String imageUrl = !TextUtils.isEmpty(this.shareInfo.getImageUrl()) ? this.shareInfo.getImageUrl() : "";
            this.shareText = this.shareInfo.getName();
            if (TextUtils.isEmpty(this.shareInfo.getDescription())) {
                this.shareText += "\n" + str;
            } else {
                this.shareText += " \n \n " + this.shareInfo.getDescription() + "\n" + str;
            }
            if (this.shareText.contains("{name}") && !TextUtils.isEmpty(this.mTitle)) {
                this.shareText = this.shareText.replace("{name}", this.mTitle);
            }
            if (imageUrl == null || imageUrl.equalsIgnoreCase("") || imageUrl.length() <= 0) {
                UiUtils.prepareShareIntent(getActivity(), null, this.shareText);
            } else {
                Glide.with(getActivity().getApplicationContext()).asBitmap().load(APIUtils.getAbsoluteImagePath(getContext().getApplicationContext(), imageUrl)).diskCacheStrategy(DiskCacheStrategy.ALL).dontAnimate().into(new CustomTarget<Bitmap>() {
                    public void onLoadCleared(@Nullable Drawable drawable) {
                        UiUtils.prepareShareIntent(ExoPlayerFragment.this.getActivity(), null, ExoPlayerFragment.this.shareText);
                    }

                    public void onLoadFailed(@Nullable Drawable drawable) {
                        super.onLoadFailed(drawable);
                        UiUtils.prepareShareIntent(ExoPlayerFragment.this.getActivity(), null, ExoPlayerFragment.this.shareText);
                    }

                    public void onResourceReady(@NonNull Object obj, @Nullable Transition transition) {
                        onResourceReady((Bitmap) obj, (Transition<? super Bitmap>) transition);
                    }

                    public void onResourceReady(@NonNull Bitmap bitmap, @Nullable Transition<? super Bitmap> transition) {
                        UiUtils.prepareShareIntent(ExoPlayerFragment.this.getActivity(), bitmap, ExoPlayerFragment.this.shareText);
                    }
                });
            }
        }
    }

    public void showChromeCast() {
        OttLog.error("stateChangedOnCastConnected", "showChromeCast");
    }

    public void showDialogPopup(HashMap hashMap, final String str, final String str2) {
        ActionBottomSheetDialogFragment actionBottomSheetDialogFragment = this.mBottomSheetDialog;
        if (actionBottomSheetDialogFragment != null) {
            actionBottomSheetDialogFragment.dismiss();
        }
        if (getActivity() == null) {
            return;
        }
        NavigationUtils.showDialog(getActivity(), DialogType.PLAYER_ACTIVE_SCREEN_DIALOG, hashMap, new DialogListener() {
            @Override
            public void itemClicked(boolean z, int i2, int i3) {
            }

            @Override
            public void itemClicked(boolean z, int i2, HashMap hashMap2) {
                Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(ExoPlayerFragment.this.getContext().getApplicationContext());
                final String rokuPaymentUpgradeMessage = utilAppConfigurations.getRokuPaymentUpgradeMessage();
                final String amazonPaymentUpgradeMessage = utilAppConfigurations.getAmazonPaymentUpgradeMessage();
                if (i2 == 0) {
                    OttSDK.getInstance().getPaymentManager().getActivePackages(new PaymentManager.PaymentCallback<List<ActivePackagesResponse>>() {
                        @Override
                        public void onFailure(Error error) {
                            ExoPlayerFragment.this.navigationToPackage = true;
                            NavigationUtils.loadScreenActivityForResult(ExoPlayerFragment.this.getActivity(), ScreenType.PAYMENTS, NavigationConstants.NAV_FROM_PLAYER, 9, "", "");
                            NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "/service/api/auth/user/activepackages", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
                        }

                        @Override
                        public void onSuccess(List<ActivePackagesResponse> list) {
                            int size = list.size();
                            if (size <= 0) {
                                NavigationUtils.loadScreenActivityForResult(ExoPlayerFragment.this.getActivity(), ScreenType.PAYMENTS, NavigationConstants.NAV_FROM_PLAYER, 9, "", "");
                                return;
                            }
                            for (int i3 = 0; i3 < size; i3++) {
                                if (list.get(i3).getGateway().equalsIgnoreCase(NavigationConstants.PAYMENT_ROKU_INAPP)) {
                                    if (str.equalsIgnoreCase(NavigationConstants.PAYMENT_UPGRADE_PLAN)) {
                                        ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                                        exoPlayerFragment.showGatewayBlockDialog(exoPlayerFragment.getString(R.string.gateway_blocked_upgrade_title), rokuPaymentUpgradeMessage.trim().length() > 0 ? rokuPaymentUpgradeMessage : ExoPlayerFragment.this.getString(R.string.gateway_blocked_upgrade_subtitle_roku));
                                    } else {
                                        ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                                        exoPlayerFragment2.showGatewayBlockDialog(exoPlayerFragment2.getString(R.string.gateway_blocked_title), ExoPlayerFragment.this.getString(R.string.gateway_blocked_subtitle_roku));
                                    }
                                } else if (!list.get(i3).getGateway().equalsIgnoreCase(NavigationConstants.PAYMENT_AMAZON_INAPP)) {
                                    ExoPlayerFragment.this.navigationToPackage = true;
                                    NavigationUtils.loadScreenActivityForResult(ExoPlayerFragment.this.getActivity(), ScreenType.PAYMENTS, NavigationConstants.NAV_FROM_PLAYER, 9, NavigationConstants.PAYMENT_UPGRADE_PLAN, "");
                                } else if (str.equalsIgnoreCase(NavigationConstants.PAYMENT_UPGRADE_PLAN)) {
                                    ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                                    exoPlayerFragment3.showGatewayBlockDialog(exoPlayerFragment3.getString(R.string.gateway_blocked_upgrade_title), amazonPaymentUpgradeMessage.trim().length() > 0 ? amazonPaymentUpgradeMessage : ExoPlayerFragment.this.getString(R.string.gateway_blocked_upgrade_subtitle_amazon));
                                } else {
                                    ExoPlayerFragment exoPlayerFragment4 = ExoPlayerFragment.this;
                                    exoPlayerFragment4.showGatewayBlockDialog(exoPlayerFragment4.getString(R.string.gateway_blocked_title), ExoPlayerFragment.this.getString(R.string.gateway_blocked_subtitle_amazon));
                                }
                            }
                        }
                    });
                    return;
                }
                if (i2 == 1) {
                    ExoPlayerFragment.this.navigationToPackage = true;
                    NavigationUtils.loadScreenActivityForResult(ExoPlayerFragment.this.getActivity(), Boolean.TRUE, ListType.ACTIVE_SCREEN, NavigationConstants.NAV_FROM_PLAYER, 9, str2);
                } else if (i2 == 2) {
                    ExoPlayerFragment.this.CO_doCollapse();
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            if (ExoPlayerFragment.this.getActivity().mWatchWhileLayout != null) {
                                ExoPlayerFragment.this.getActivity().mWatchWhileLayout.mState = 2;
                                ExoPlayerFragment.this.getActivity().mWatchWhileLayout.slideHorizontal(true);
                            }
                        }
                    }, 50L);
                }
            }
        });
    }

    public void showGatewayBlockDialog(String str, String str2) {
        int i2 = getResources().getDisplayMetrics().heightPixels;
        Dialog dialog = new Dialog(getActivity());
        this.dialog = dialog;
        dialog.requestWindowFeature(1);
        this.dialog.setContentView(R.layout.cancel_subscription_popup);
        this.dialog.getWindow().setLayout((int) (getResources().getDisplayMetrics().widthPixels * 0.9d), -2);
        this.dialog.setCanceledOnTouchOutside(false);
        TextView textView = (TextView) this.dialog.findViewById(R.id.headerTitle);
        TextView textView2 = (TextView) this.dialog.findViewById(R.id.cancel_description);
        if (str.trim().length() > 0) {
            textView.setText(str);
        }
        if (str2.trim().length() > 0) {
            textView2.setText(str2);
        }
        this.dialog.findViewById(R.id.no).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Dialog dialog2 = ExoPlayerFragment.this.dialog;
                if (dialog2 != null) {
                    dialog2.dismiss();
                }
                ExoPlayerFragment.this.CO_doCollapse();
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        ExoPlayerFragment.this.getActivity().mWatchWhileLayout.slideHorizontal(true);
                    }
                }, 50L);
            }
        });
        this.dialog.show();
    }

    public void showPlaybackSpeedsSelection() {
        if (getActivity() != null) {
            Dialog dialog = new Dialog(getActivity(), R.style.Theme_AppCompat_DayNight_Dialog);
            this.mDialog = dialog;
            dialog.requestWindowFeature(1);
            Dialog dialog2 = this.mDialog;
            dialog2.setContentView(buildView(LayoutInflater.from(dialog2.getContext()), getActivity()));
            this.mDialog.show();
        }
    }

    public void showReplayButton(boolean z) {
        if (!z) {
            AppCompatButton appCompatButton = this.player_replay;
            if (appCompatButton != null) {
                appCompatButton.setVisibility(z ? 0 : 8);
            }
        } else if (this.mMiniControlsContainer.getVisibility() != 0 || getActivity().getPlayerCurrentState() == 1) {
            this.mPlayerControlView.hide();
            hideMiniControls();
            AppCompatButton appCompatButton2 = this.player_replay;
            if (appCompatButton2 != null) {
                appCompatButton2.setVisibility(z ? 0 : 8);
                this.imageBackIV.setVisibility(0);
                if (getActivity() != null && (getActivity() instanceof FusionViliteMainActivity)) {
                    getActivity().showSuggestionsLayout(this.contentPageItem);
                    getActivity().mWatchWhileLayout.isErrorShown(true);
                }
            }
        } else {
            showMiniControls();
            this.player_replay.setVisibility(8);
            this.mPauseButton.setVisibility(8);
            this.mPlayButton.setVisibility(8);
            showProgress(false);
            this.mReplayButton.setVisibility(0);
        }
        if (this.showGoLive && this.mReplayGoLive != null && getActivity().getPlayerCurrentState() != 2) {
            this.mReplayGoLive.setVisibility(8);
            return;
        }
        TextView textView = this.mReplayGoLive;
        if (textView != null) {
            textView.setVisibility(8);
        }
    }

    private void showReplayLayout() {
        releaseAnalyticsAuto();
        releasePlayer();
        showReplayButton(true);
        this.mPlayerControlView.hideLoadingBar();
        this.mPlayerControlView.hide();
        this.waterMark.setVisibility(8);
    }

    public void showStartOverDialog() {
        PlayerControlView playerControlView;
        PlayerControlView playerControlView2 = this.mPlayerControlView;
        if (playerControlView2 != null) {
            boolean z = playerControlView2.startOver;
            if (!z && (!z || this.mButtonType != ButtonType.START_OVER)) {
                if (UiUtils.isNetworkConnected(getActivity()) && (playerControlView = this.mPlayerControlView) != null) {
                    playerControlView.seekToLive();
                    this.mPlayerControlView.updateGoLiveButton();
                    return;
                } else {
                    ExoPlayer exoPlayer = this.player;
                    if (exoPlayer != null) {
                        exoPlayer.seekTo(0L);
                        return;
                    }
                    return;
                }
            }
            ContentPage contentPage = this.contentPageItem;
            if (contentPage == null || contentPage.getPageInfo() == null) {
                ExoPlayer exoPlayer2 = this.player;
                if (exoPlayer2 != null) {
                    exoPlayer2.seekTo(0L);
                    return;
                }
                return;
            }
            if (this.contentPageItem.getPageInfo().getAttributes() != null) {
                if (this.contentPageItem.getPageInfo().getAttributes().getIsLive() == null || !this.contentPageItem.getPageInfo().getAttributes().getIsLive().booleanValue() || this.contentPageItem.getPageInfo().getAttributes().getStartTime() == null) {
                    PlayerControlView playerControlView3 = this.mPlayerControlView;
                    if (playerControlView3.startOver) {
                        playerControlView3.setProgramStartTime(0L);
                        this.mPlayerControlView.startProgramFromStart();
                        return;
                    } else {
                        if (this.mButtonType == ButtonType.START_OVER) {
                            LaunchResumeOrStartOverDialog(0L, this.contentPageItem.getPageInfo().getPath());
                            return;
                        }
                        return;
                    }
                }
                String startTime = this.contentPageItem.getPageInfo().getAttributes().getStartTime();
                Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(getContext().getApplicationContext());
                String startOverTextMessage = utilAppConfigurations.getStartOverTextMessage();
                ExoPlayer exoPlayer3 = this.player;
                long maxdvrtime = (exoPlayer3 == null || !exoPlayer3.isCurrentWindowLive()) ? utilAppConfigurations.getMaxdvrtime() : this.player.getDuration();
                try {
                    long parseLong = Long.parseLong(startTime);
                    long currentTimeMillis = System.currentTimeMillis();
                    if (currentTimeMillis - parseLong <= maxdvrtime) {
                        if (this.mButtonType == ButtonType.START_OVER && this.player == null) {
                            LaunchResumeOrStartOverDialog(Long.valueOf(parseLong), this.contentPageItem.getPageInfo().getPath());
                            return;
                        }
                        PlayerControlView playerControlView4 = this.mPlayerControlView;
                        if (playerControlView4.startOver) {
                            playerControlView4.setProgramStartTime(parseLong);
                            this.mPlayerControlView.startProgramFromStart();
                            this.mPlayerControlView.updateGoLiveButton();
                            return;
                        }
                        return;
                    }
                    ExoPlayer exoPlayer4 = this.player;
                    final boolean z2 = exoPlayer4 != null && exoPlayer4.getPlayWhenReady();
                    if (z2) {
                        this.player.setPlayWhenReady(false);
                    }
                    final long j = currentTimeMillis - maxdvrtime;
                    HashMap hashMap = new HashMap();
                    if (startOverTextMessage == null) {
                        startOverTextMessage = "";
                    }
                    hashMap.put("msg2", startOverTextMessage);
                    hashMap.put("msg1", "");
                    NavigationUtils.showDialog(getActivity(), DialogType.STARTOVER_DIALOG, hashMap, new DialogListener() {
                        @Override
                        public void itemClicked(boolean z3, int i2, int i3) {
                        }

                        @Override
                        public void itemClicked(boolean z3, int i2, HashMap hashMap2) {
                            ExoPlayer exoPlayer5;
                            ExoPlayer exoPlayer6;
                            if (i2 != 1) {
                                if (i2 == 0 && z2 && (exoPlayer5 = ExoPlayerFragment.this.player) != null) {
                                    exoPlayer5.setPlayWhenReady(true);
                                    return;
                                }
                                return;
                            }
                            ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                            if (exoPlayerFragment.mButtonType == ButtonType.START_OVER && exoPlayerFragment.player == null) {
                                exoPlayerFragment.LaunchResumeOrStartOverDialog(Long.valueOf(j), ExoPlayerFragment.this.contentPageItem.getPageInfo().getPath());
                                return;
                            }
                            PlayerControlView playerControlView5 = exoPlayerFragment.mPlayerControlView;
                            if (playerControlView5.startOver) {
                                playerControlView5.setProgramStartTime(j);
                                ExoPlayerFragment.this.mPlayerControlView.startProgramFromStart();
                                ExoPlayerFragment.this.mPlayerControlView.updateGoLiveButton();
                                if (!z2 || (exoPlayer6 = ExoPlayerFragment.this.player) == null) {
                                    return;
                                }
                                exoPlayer6.setPlayWhenReady(true);
                            }
                        }
                    });
                } catch (NumberFormatException unused) {
                    this.mPlayerControlView.startProgramFromStart();
                }
            }
        }
    }

    private void showToast(int i2) {
        showToast(getString(i2));
    }

    public void startDistroPlayback() {
        this.mediaItems.add(createMediaItem(this.mPlayerBundle, getMacroReplacedUri(this.palStreamUrl, this.playerWidth, this.playerHeight, this.palBoxID)));
        ExoPlayer exoPlayer = this.player;
        if (exoPlayer != null) {
            exoPlayer.setMediaItems(this.mediaItems, false);
            this.player.prepare();
        }
        this.playerNeedsSource = false;
        if (this.isCloseCaptionsAvailable || this.isAudioTrackAvailable) {
            this.playerMultipleAudioSubtitleTracksBtn.setVisibility(0);
            this.playerCaptionsBtn.setVisibility(8);
        } else {
            this.playerMultipleAudioSubtitleTracksBtn.setVisibility(8);
        }
        setWaterMarkVisibility();
    }

    public void startShowingContentRating() {
        if (this.contentRatingHandler != null || TextUtils.isEmpty(this.maturityRatingTitle.getText()) || this.isPlayingAd) {
            return;
        }
        setContentRatingVisibility(0);
        PlayerControlView playerControlView = this.mPlayerControlView;
        if (playerControlView != null) {
            playerControlView.ageRatingTime = 0L;
        }
        this.startTime = System.currentTimeMillis();
        Handler handler = new Handler();
        this.contentRatingHandler = handler;
        handler.postDelayed(new Runnable() {
            @Override
            public final void run() {
                ExoPlayerFragment.this.lambda$startShowingContentRating$4();
            }
        }, this.CONTENT_RATING_VISIBLE_DURATION);
    }

    public void stateChangedOnCastConnected() {
        OttLog.error("stateChangedOnCastConnected", "stateChangedOnCastConnected");
        onPause();
        showChromeCast();
    }

    private void stopTimer() {
        CountDownTimer countDownTimer = this.countDownTimer;
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
    }

    public void toggleCastButton() {
        CastContext castContext = this.mc;
        if (castContext != null && castContext.getCastState() == 1) {
            this.mMediaRouteButton.setVisibility(8);
            return;
        }
        if (this.mc != null) {
            if (getActivity() != null) {
                if (this.mc.getCastState() == 4) {
                    this.mMediaRouteButton.setRemoteIndicatorDrawable(getActivity().getResources().getDrawable(R.drawable.quantum_ic_cast_connected_white_24));
                } else if (this.mc.getCastState() == 2) {
                    this.mMediaRouteButton.setRemoteIndicatorDrawable(getActivity().getResources().getDrawable(R.drawable.us_chromcast_vd));
                } else {
                    this.mMediaRouteButton.setRemoteIndicatorDrawable(getActivity().getResources().getDrawable(R.drawable.mr_button_connecting_dark));
                }
            }
            this.mMediaRouteButton.setVisibility(0);
        }
    }

    public void trackEvent(String str) {
        try {
            AnalyticsV2.getInstance().trackEvent(str);
        } catch (NullPointerException unused) {
        }
    }

    public void trackEvents(String str, int i2, ContentPage contentPage) {
        try {
            HashMap hashMap = new HashMap();
            hashMap.put(AnalyticsUtils.ATTRIBUTE_ACTIONS, i2 == 0 ? AnalyticsUtils.ATTRIBUTE_VALUE_ACTION_REMOVED : AnalyticsUtils.ATTRIBUTE_VALUE_ACTION_ADDED);
            CustomLog.e("TAG", "#ATTRIBUTE_ACTIONS : " + i2);
            AnalyticsUtils.getInstance().trackAnalyticsEvent(ScreenType.PLAYER, null, contentPage, null, str, AnalyticsUtils.ATTRIBUTE_VALUE_SOURCE_PLAYER_PAGE, hashMap);
        } catch (NullPointerException unused) {
        }
    }

    private void unRegisterAudioFocus() {
        AudioEventManager audioEventManager = this.audioEventManager;
        if (audioEventManager != null) {
            audioEventManager.unregister();
        }
    }

    private void updateBottomSheets() {
        if (this.isLive) {
            if ((getActivity() != null ? getActivity().getResources().getConfiguration().orientation : 1) == 2) {
                LinearLayout linearLayout = this.backLiveBottomCarousel;
                if (linearLayout != null) {
                    linearLayout.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                            exoPlayerFragment.changeBgColorAnimate(exoPlayerFragment.relatedVideos_layout, false);
                            ExoPlayerFragment.this.backLiveBottomCarousel.setVisibility(4);
                            if (ExoPlayerFragment.this.bottomSheetBehavior != null) {
                                ExoPlayerFragment.this.bottomSheetBehavior.setState(4);
                            }
                        }
                    });
                }
                LinearLayout linearLayout2 = this.channel_suggestions;
                if (linearLayout2 != null) {
                    linearLayout2.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            if (ExoPlayerFragment.this.bottomSheetBehavior != null) {
                                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                                if (exoPlayerFragment.VIEWSTATECOLLAPSED) {
                                    exoPlayerFragment.bottomSheetBehavior.setState(3);
                                    return;
                                }
                                exoPlayerFragment.changeBgColorAnimate(exoPlayerFragment.relatedVideos_layout, false);
                                ExoPlayerFragment.this.backLiveBottomCarousel.setVisibility(4);
                                ExoPlayerFragment.this.bottomSheetBehavior.setState(4);
                            }
                        }
                    });
                }
                if (this.relatedVideosRecyclerView != null) {
                    Section section = this.sectionInfo;
                    if (section != null && section.getSectionInfo() != null && !TextUtils.isEmpty(this.sectionInfo.getSectionInfo().getName())) {
                        this.recommendationText.setText(this.sectionInfo.getSectionInfo().getName());
                    }
                    this.bottomSheetBehavior = BottomSheetBehavior.from(this.relatedVideos_layout);
                    this.relatedVideos_layout.setClickable(false);
                    this.relatedVideos_layout.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            ExoPlayerFragment.this.relative_seasonui.setVisibility(8);
                            ExoPlayerFragment.this.recommendation_control_backbutton.setVisibility(8);
                            ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                            if (exoPlayerFragment.isLive) {
                                exoPlayerFragment.bottomSheetBehavior.setState(4);
                            }
                            new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
                                @Override
                                public void run() {
                                    ExoPlayerFragment.this.relatedVideos_layout.setVisibility(8);
                                }
                            }, 10L);
                        }
                    });
                    this.bottomSheetBehavior.addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
                        public void onSlide(@NonNull View view, float f2) {
                        }

                        public void onStateChanged(@NonNull View view, int i2) {
                            ExoPlayerFragment.this.relatedVideos_layout.setVisibility(0);
                            if (i2 == 3) {
                                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                                exoPlayerFragment.mPlayerRecommendationsRightArrow.setImageDrawable(exoPlayerFragment.getResources().getDrawable(R.drawable.up_arrow));
                                ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                                exoPlayerFragment2.changeBgColorAnimate(exoPlayerFragment2.relatedVideos_layout, true);
                                ExoPlayerFragment.this.hideControls();
                                LinearLayout linearLayout3 = ExoPlayerFragment.this.backLiveBottomCarousel;
                                if (linearLayout3 != null) {
                                    linearLayout3.setVisibility(0);
                                }
                            } else if (i2 == 1) {
                                if (ExoPlayerFragment.this.backLiveBottomCarousel.getVisibility() == 0) {
                                    ExoPlayerFragment.this.backLiveBottomCarousel.setVisibility(4);
                                }
                                ExoPlayerFragment.this.relatedVideos_layout.setVisibility(0);
                                ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                                exoPlayerFragment3.changeBgColorAnimate(exoPlayerFragment3.relatedVideos_layout, false);
                                LinearLayout linearLayout4 = ExoPlayerFragment.this.backLiveBottomCarousel;
                                if (linearLayout4 != null) {
                                    linearLayout4.setVisibility(4);
                                }
                            }
                            if (i2 != 4) {
                                ExoPlayerFragment exoPlayerFragment4 = ExoPlayerFragment.this;
                                exoPlayerFragment4.mPlayerRecommendationsRightArrow.setImageDrawable(exoPlayerFragment4.getResources().getDrawable(R.drawable.down_arrow));
                                ExoPlayerFragment.this.relatedVideos_layout.setGravity(80);
                                ExoPlayerFragment.this.pausePlayer();
                                ExoPlayerFragment.this.VIEWSTATECOLLAPSED = false;
                                return;
                            }
                            ExoPlayerFragment exoPlayerFragment5 = ExoPlayerFragment.this;
                            exoPlayerFragment5.mPlayerRecommendationsRightArrow.setImageDrawable(exoPlayerFragment5.getResources().getDrawable(R.drawable.up_arrow));
                            ExoPlayerFragment.this.relatedVideos_layout.setGravity(48);
                            ExoPlayerFragment.this.relatedVideos_layout.setVisibility(4);
                            LinearLayout linearLayout5 = ExoPlayerFragment.this.relatedVideos_layout;
                            linearLayout5.setBackgroundColor(linearLayout5.getContext().getResources().getColor(R.color.transparent));
                            LinearLayout linearLayout6 = ExoPlayerFragment.this.backLiveBottomCarousel;
                            if (linearLayout6 != null) {
                                linearLayout6.setVisibility(4);
                            }
                            ExoPlayerFragment exoPlayerFragment6 = ExoPlayerFragment.this;
                            exoPlayerFragment6.mPlayerControlView.isShowControls = false;
                            exoPlayerFragment6.resumePlayer();
                            ExoPlayerFragment.this.VIEWSTATECOLLAPSED = true;
                        }
                    });
                }
            }
        }
    }

    public void updateDrmLicense(String str) {
        this.isdrm = true;
        this.mPlayerBundle.putString("drm_license_url", str);
        this.mPlayerBundle.putString("drm_scheme_uuid", C.WIDEVINE_UUID.toString());
        try {
            this.mPlayerBundle.putString("drm_scheme_uuid", UiUtils.getDrmUuid("widevine").toString());
        } catch (ParserException unused) {
        }
        this.mPlayerBundle.putStringArray("drm_key_request_properties", new String[0]);
        this.mPlayerBundle.putString("drm_license_url", str);
    }

    public void updateFavourites() {
        ContentPage contentPage = this.contentPageItem;
        if (contentPage == null || contentPage.getPageButtons() == null) {
            return;
        }
        final boolean booleanValue = this.contentPageItem.getPageButtons().getIsFavourite().booleanValue();
        if (booleanValue) {
            OttSDK.getInstance().getUserManager().removeUserFavourite(this.contentPageItem.getPageInfo().getPath(), new UserManager.UserCallback<String>() {
                @Override
                public void onEmptySuccess() {
                    com.yupptv.ottsdk.managers.User.a.a(this);
                }

                @Override
                public void onFailure(Error error) {
                    if (ExoPlayerFragment.this.getActivity() == null) {
                        return;
                    }
                    NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "/service/api/auth/user/favourite/item", "NA", "NA", "NA", com.yupptv.ott.f.a(error, com.yupptv.ott.epg.a.a(error, ExoPlayerFragment.this.getActivity(), 1, "")), error.getMessage());
                }

                @Override
                public void onSuccess(String str) {
                    if (ExoPlayerFragment.this.getActivity() == null) {
                        return;
                    }
                    ExoPlayerFragment.this.contentPageItem.getPageButtons().setIsFavourite(Boolean.valueOf(!booleanValue));
                    ExoPlayerFragment.this.updateFavouritesIcon();
                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                    exoPlayerFragment.trackEvents(AnalyticsUtils.EVENT_FAVOURITES, 0, exoPlayerFragment.contentPageItem);
                }
            });
        } else {
            OttSDK.getInstance().getUserManager().addUserFavourite(this.contentPageItem.getPageInfo().getPath(), new UserManager.UserCallback<String>() {
                @Override
                public void onEmptySuccess() {
                    com.yupptv.ottsdk.managers.User.a.a(this);
                }

                @Override
                public void onFailure(Error error) {
                    if (ExoPlayerFragment.this.getActivity() == null) {
                        return;
                    }
                    CustomLog.e("Content not available", error.getMessage());
                    NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "/service/api/auth/user/favourite/item", "NA", "NA", "NA", com.yupptv.ott.f.a(error, com.yupptv.ott.epg.a.a(error, ExoPlayerFragment.this.getActivity(), 1, "")), error.getMessage());
                }

                @Override
                public void onSuccess(String str) {
                    if (ExoPlayerFragment.this.getActivity() == null) {
                        return;
                    }
                    ExoPlayerFragment.this.contentPageItem.getPageButtons().setIsFavourite(Boolean.valueOf(!booleanValue));
                    ExoPlayerFragment.this.updateFavouritesIcon();
                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                    exoPlayerFragment.trackEvents(AnalyticsUtils.EVENT_FAVOURITES, 1, exoPlayerFragment.contentPageItem);
                }
            });
        }
    }

    public void updateItem(Object obj) {
        String str;
        String str2;
        String str3;
        this.isKlikVideoImpressionSent = false;
        this.isKlikVideoViewSent = false;
        if (obj == null) {
            return;
        }
        if (!(obj instanceof ContentPage)) {
            if (obj instanceof OfflineDownloadData) {
                OfflineDownloadData offlineDownloadData = (OfflineDownloadData) obj;
                this.mPlayerHeaderTitle.setText(offlineDownloadData.getTitle());
                this.mPlayerHeaderSubTitle.setText(offlineDownloadData.getSubTitle());
                Glide.with(getActivity()).asBitmap().load(APIUtils.getAbsoluteImagePath(getContext().getApplicationContext(), offlineDownloadData.getImageUrl())).error(R.drawable.default_img).into(this.mPlayerHeaderIcon);
                this.mTitleView.setText(offlineDownloadData.getTitle());
                this.mSubTitleView.setText(offlineDownloadData.getSubTitle());
                ImageView imageView = this.playerShareBtn;
                if (imageView != null) {
                    imageView.setVisibility(8);
                }
                if (this.nextEpisodeText != null) {
                    this.nextEpisodeLayout.setVisibility(8);
                    return;
                }
                return;
            }
            return;
        }
        ContentPage contentPage = (ContentPage) obj;
        this.pagePath = contentPage.getPageInfo().getPath();
        List<PageData> list = null;
        if (contentPage.getPageData() != null && contentPage.getPageData().size() > 0) {
            list = contentPage.getPageData();
        }
        Content content = new Content();
        if (list != null && list.size() > 0) {
            int i2 = 0;
            while (true) {
                if (i2 >= list.size()) {
                    break;
                }
                if (list.get(i2).getPaneType().equalsIgnoreCase("content")) {
                    content = list.get(i2).getContent();
                    break;
                }
                i2++;
            }
        }
        PageInfo pageInfo = contentPage.getPageInfo();
        if (pageInfo != null && pageInfo.getAttributes() != null && pageInfo.getAttributes().getTakeaTestURL() != null && pageInfo.getAttributes().getTakeaTestURL().trim().length() > 0) {
            this.testURL = pageInfo.getAttributes().getTakeaTestURL();
            this.testStartTime = Long.valueOf((pageInfo.getAttributes().getTakeaTestStartTime() == null || pageInfo.getAttributes().getTakeaTestStartTime().trim().length() <= 0) ? 0L : Long.parseLong(pageInfo.getAttributes().getTakeaTestStartTime()));
        }
        if (content != null) {
            this.mTitleView.setText(content.getTitle());
            this.mSubTitleView.setVisibility(4);
            this.mPlayerHeaderIcon.setVisibility(8);
            RecyclerView recyclerView = this.buttonRecyclerView;
            if (recyclerView != null) {
                recyclerView.setVisibility(8);
            }
            this.imageUrl = content.getBackgroundImage();
            String str4 = "";
            int i3 = 1;
            if (content.getDataRows() != null) {
                int i4 = 0;
                str = "";
                str2 = str;
                str3 = str2;
                while (i4 < content.getDataRows().size()) {
                    if (content.getDataRows().get(i4).getElements() != null) {
                        int i5 = 0;
                        while (i5 < content.getDataRows().get(i4).getElements().size()) {
                            if (content.getDataRows().get(i4).getRowDataType().equalsIgnoreCase("content")) {
                                if (content.getDataRows().get(i4).getRowNumber().intValue() == i3 && content.getDataRows().get(i4).getElements().get(i5).getElementType().equalsIgnoreCase("image")) {
                                    if (content.getDataRows().get(i4).getElements().get(i5).getData() == null || content.getDataRows().get(i4).getElements().get(i5).getData().length() <= i3) {
                                        this.mPlayerHeaderIcon.setVisibility(8);
                                    } else {
                                        if (getActivity() != null) {
                                            Glide.with(getActivity().getApplicationContext()).asBitmap().load(APIUtils.getAbsoluteImagePath(getActivity().getApplicationContext(), content.getDataRows().get(i4).getElements().get(i5).getData())).error(R.drawable.default_img).into(new BitmapImageViewTarget(this.mPlayerHeaderIcon) {
                                                public void setResource(Bitmap bitmap) {
                                                    if (ExoPlayerFragment.this.getActivity() != null) {
                                                        Drawable create = RoundedBitmapDrawableFactory.create(ExoPlayerFragment.this.getActivity().getResources(), bitmap);
                                                        create.setCircular(true);
                                                        ExoPlayerFragment.this.mPlayerHeaderIcon.setImageDrawable(create);
                                                    }
                                                }
                                            });
                                        }
                                        this.mPlayerHeaderIcon.setVisibility(8);
                                    }
                                }
                                if (content.getDataRows().get(i4).getRowNumber().intValue() == i3 && content.getDataRows().get(i4).getElements().get(i5).getElementType().equalsIgnoreCase("text")) {
                                    StringBuilder a = com.yupptv.ott.a.a(str4);
                                    a.append(content.getDataRows().get(i4).getElements().get(i5).getData());
                                    a.append(" ");
                                    str4 = a.toString();
                                    this.mTitle = str4;
                                }
                                if (content.getDataRows().get(i4).getElements().get(i5).getElementSubtype().equalsIgnoreCase("landscapeSubtitle") && content.getDataRows().get(i4).getElements().get(i5).getElementType().equalsIgnoreCase("text")) {
                                    StringBuilder a2 = com.yupptv.ott.a.a(str);
                                    a2.append(content.getDataRows().get(i4).getElements().get(i5).getData());
                                    a2.append(" ");
                                    str = a2.toString();
                                    this.mSubTitle = str;
                                    this.mSubTitleView.setVisibility(0);
                                }
                                if (content.getDataRows().get(i4).getElements().get(i5).getElementType().equalsIgnoreCase("marker")) {
                                    if (content.getDataRows().get(i4).getElements().get(i5).getElementSubtype().equalsIgnoreCase("duration")) {
                                        str2 = content.getDataRows().get(i4).getElements().get(i5).getData();
                                    } else if (content.getDataRows().get(i4).getElements().get(i5).getElementSubtype().equalsIgnoreCase("exipiryDays") || content.getDataRows().get(i4).getElements().get(i5).getElementSubtype().equalsIgnoreCase("expiryDays") || content.getDataRows().get(i4).getElements().get(i5).getElementSubtype().equalsIgnoreCase("expiry") || content.getDataRows().get(i4).getElements().get(i5).getElementSubtype().equalsIgnoreCase("available_soon")) {
                                        str3 = content.getDataRows().get(i4).getElements().get(i5).getData();
                                    }
                                }
                                if (content.getDataRows().get(i4).getElements().get(i5).getElementType().equalsIgnoreCase("description")) {
                                    this.description = content.getDataRows().get(i4).getElements().get(i5).getData();
                                }
                                if (content.getDataRows().get(i4).getElements().get(i5).getElementType().equalsIgnoreCase("image") && this.imageUrl.trim().length() == 0) {
                                    this.imageUrl = content.getDataRows().get(i4).getElements().get(i5).getData();
                                }
                            } else if (content.getDataRows().get(i4).getRowDataType().equalsIgnoreCase("button")) {
                                if (this.buttonList == null) {
                                    this.buttonList = new ArrayList();
                                }
                                this.buttonList.clear();
                                for (int i6 = 0; i6 < content.getDataRows().get(i4).getElements().size(); i6++) {
                                    Content.Elements elements = content.getDataRows().get(i4).getElements().get(i6);
                                    if (elements.getElementType().equalsIgnoreCase("button")) {
                                        this.buttonList.add(elements);
                                    }
                                }
                                LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.mActivity, 0, false);
                                this.linearLayoutManager = linearLayoutManager;
                                this.buttonRecyclerView.setLayoutManager(linearLayoutManager);
                                this.buttonRecyclerView.setVisibility(8);
                                this.imgBackIV.setVisibility(0);
                                this.buttonRecyclerView.setAdapter(new ButtonsViewAdapter(this.mActivity, this.buttonList));
                            }
                            i5++;
                            i3 = 1;
                        }
                    }
                    i4++;
                    i3 = 1;
                }
            } else {
                str = "";
                str2 = str;
                str3 = str2;
            }
            if (str4.length() > 1) {
                this.mPlayerHeaderTitle.setText(str4);
                this.playerPortraitHeaderTitle.setText(str4);
            }
            if (str != null && str.length() > 1) {
                if (str2 == null || str2.length() <= 0) {
                    this.mPlayerHeaderSubTitle.setText(str);
                    this.mPlayerHeaderSubTitle.setVisibility(0);
                    this.playerPortraitHeaderSubTitle.setText(str);
                    this.playerPortraitHeaderSubTitle.setVisibility(0);
                } else {
                    SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
                    spannableStringBuilder.append((CharSequence) str).append((CharSequence) "  ");
                    spannableStringBuilder.setSpan(new ImageSpan((Context) getActivity(), R.drawable.clock), spannableStringBuilder.length() - 1, spannableStringBuilder.length(), 0);
                    spannableStringBuilder.append((CharSequence) "  ".concat(str2));
                    this.mPlayerHeaderSubTitle.setText(spannableStringBuilder);
                    this.mPlayerHeaderSubTitle.setVisibility(0);
                }
            }
            this.mSubTitleView.setText(str);
            if (str3 == null || str3.trim().length() <= 0) {
                this.mPlayerHeaderMarker.setVisibility(8);
            } else {
                this.mPlayerHeaderMarker.setText(str3.trim());
                this.mPlayerHeaderMarker.setVisibility(0);
            }
        }
    }

    public void updateNextVideoLayoutVisibility(boolean z) {
        AppCompatButton appCompatButton;
        if (this.showNextEpisodeButton && (appCompatButton = this.nextEpisodeButton) != null) {
            appCompatButton.setVisibility(z ? 0 : 8);
            return;
        }
        RelativeLayout relativeLayout = this.mNextVideoLayout;
        if (relativeLayout != null) {
            relativeLayout.setVisibility(z ? 0 : 8);
        }
    }

    private void updatePlayerScreen(final boolean z) {
        this.mHandler.post(new Runnable() {
            @Override
            public void run() {
                RelativeLayout relativeLayout;
                if (ExoPlayerFragment.this.getActivity() == null) {
                    return;
                }
                RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) ExoPlayerFragment.this.seekbarContainer.getLayoutParams();
                int i2 = ExoPlayerFragment.this.getActivity() != null ? ExoPlayerFragment.this.getActivity().getResources().getConfiguration().orientation : 1;
                CustomLog.e("TAG", "orientdd : " + i2);
                ExoPlayerFragment.this.playerSettingsBtn.setVisibility(0);
                if (i2 == 1) {
                    RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) ExoPlayerFragment.this.currentTime.getLayoutParams();
                    layoutParams2.removeRule(21);
                    layoutParams2.removeRule(16);
                    layoutParams2.removeRule(21);
                    layoutParams2.addRule(20);
                    layoutParams2.setMargins((int) ExoPlayerFragment.this.totalTime.getResources().getDimension(R.dimen._15sdp), 0, 0, 0);
                    ExoPlayerFragment.this.currentTime.setLayoutParams(layoutParams2);
                    RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) ExoPlayerFragment.this.totalTime.getLayoutParams();
                    layoutParams3.removeRule(21);
                    layoutParams3.removeRule(17);
                    layoutParams3.removeRule(16);
                    layoutParams3.removeRule(20);
                    layoutParams3.addRule(17, R.id.current);
                    layoutParams3.setMargins(0, 0, 0, 0);
                    ExoPlayerFragment.this.totalTime.setLayoutParams(layoutParams3);
                } else {
                    RelativeLayout.LayoutParams layoutParams4 = (RelativeLayout.LayoutParams) ExoPlayerFragment.this.totalTime.getLayoutParams();
                    layoutParams4.removeRule(20);
                    layoutParams4.removeRule(17);
                    layoutParams4.removeRule(16);
                    layoutParams4.addRule(21);
                    layoutParams4.setMargins(0, 0, (int) ExoPlayerFragment.this.totalTime.getResources().getDimension(R.dimen._15sdp), 0);
                    ExoPlayerFragment.this.totalTime.setLayoutParams(layoutParams4);
                    RelativeLayout.LayoutParams layoutParams5 = (RelativeLayout.LayoutParams) ExoPlayerFragment.this.currentTime.getLayoutParams();
                    layoutParams5.removeRule(17);
                    layoutParams5.removeRule(20);
                    layoutParams5.addRule(16, R.id.total);
                    layoutParams5.setMargins(0, 0, 0, 0);
                    ExoPlayerFragment.this.currentTime.setLayoutParams(layoutParams5);
                }
                if (i2 == 1 && !ExoPlayerFragment.this.getActivity().isScreenLocked()) {
                    LinearLayout.LayoutParams layoutParams6 = (LinearLayout.LayoutParams) ExoPlayerFragment.this.player_forward_icon.getLayoutParams();
                    Resources resources = ExoPlayerFragment.this.player_forward_icon.getContext().getResources();
                    int i3 = R.dimen._60sdp;
                    layoutParams6.setMargins((int) resources.getDimension(i3), 0, 0, 0);
                    ExoPlayerFragment.this.player_forward_icon.setLayoutParams(layoutParams6);
                    LinearLayout.LayoutParams layoutParams7 = (LinearLayout.LayoutParams) ExoPlayerFragment.this.player_rewind_icon.getLayoutParams();
                    layoutParams7.setMargins(0, 0, (int) ExoPlayerFragment.this.player_rewind_icon.getContext().getResources().getDimension(i3), 0);
                    ExoPlayerFragment.this.player_rewind_icon.setLayoutParams(layoutParams7);
                    ExoPlayerFragment.this.relative_seasonui.setVisibility(8);
                    ExoPlayerFragment.this.playerUnLock.setVisibility(8);
                    ExoPlayerFragment.this.playerLockBtn.setVisibility(8);
                    ExoPlayerFragment.this.player_bottom_buttons_layout.setVisibility(8);
                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                    if (exoPlayerFragment.isaccessible && exoPlayerFragment.access_layout.getVisibility() == 0) {
                        RelativeLayout.LayoutParams layoutParams8 = (RelativeLayout.LayoutParams) ExoPlayerFragment.this.mNextVideoLayout.getLayoutParams();
                        layoutParams8.setMargins(10, 10, 10, 10);
                        ExoPlayerFragment.this.mNextVideoLayout.setLayoutParams(layoutParams8);
                    }
                    ExoPlayerFragment.this.parent_access_layout.setVisibility(8);
                    layoutParams.setMargins(0, 0, 0, (int) ExoPlayerFragment.this.seekbarContainer.getContext().getResources().getDimension(R.dimen._15sdp));
                    layoutParams.addRule(12);
                    ExoPlayerFragment.this.seekbarContainer.setLayoutParams(layoutParams);
                    ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                    LinearLayout linearLayout = exoPlayerFragment2.relatedVideos_layout;
                    if (linearLayout != null && exoPlayerFragment2.isLive && linearLayout.getVisibility() == 0) {
                        ExoPlayerFragment.this.relatedVideos_layout.setVisibility(8);
                    }
                    if (ExoPlayerFragment.this.relatedVideos_layout_seasons != null) {
                        ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                        if (!exoPlayerFragment3.isLive && exoPlayerFragment3.relatedVideos_layout_seasons.getVisibility() == 0) {
                            ExoPlayerFragment.this.relatedVideos_layout_seasons.setVisibility(8);
                        }
                    }
                    RelativeLayout relativeLayout2 = ExoPlayerFragment.this.mPlayerHeaderLayout;
                    if (relativeLayout2 != null) {
                        relativeLayout2.setVisibility(8);
                    }
                    Animation loadAnimation = AnimationUtils.loadAnimation(ExoPlayerFragment.this.getContext(), android.R.anim.fade_in);
                    ExoPlayerFragment.this.mPlayerControlView.collapseBtn.setVisibility(0);
                    ExoPlayerFragment.this.mPlayerControlView.player_collapse_buttonLayout.setVisibility(0);
                    ExoPlayerFragment.this.mPlayerControlView.collapseBtn.startAnimation(loadAnimation);
                    List<Card> list = ExoPlayerFragment.this.recommendationCards;
                    if (list != null && list.size() > 0) {
                        ExoPlayerFragment.this.mPlayerRecommendationsIcon.setVisibility(8);
                        CustomLog.e("orientation ", "recommend");
                    }
                    if (ExoPlayerFragment.this.mFragmentHost != null) {
                        ExoPlayerFragment.this.mFragmentHost.onVideoFullscreen(false);
                    }
                    ExoPlayerFragment.this.mPlayerControlView.volBar.setVisibility(8);
                    ExoPlayerFragment.this.mPlayerControlView.brightBar.setVisibility(8);
                    ExoPlayerFragment.this.mPlayerControlView.setDirectFullScreen(false);
                    return;
                }
                RelativeLayout.LayoutParams layoutParams9 = (RelativeLayout.LayoutParams) ExoPlayerFragment.this.access_layout.getLayoutParams();
                layoutParams9.setMargins(0, 0, 0, 0);
                ExoPlayerFragment.this.access_layout.setLayoutParams(layoutParams9);
                if (ExoPlayerFragment.this.playerSettingsBtn != null) {
                    ExoPlayerFragment exoPlayerFragment4 = ExoPlayerFragment.this;
                    if (!exoPlayerFragment4.isLive) {
                        exoPlayerFragment4.playerSettingsBtn.setVisibility(8);
                    }
                }
                ExoPlayerFragment.this.episodesLL.setVisibility(8);
                ExoPlayerFragment exoPlayerFragment5 = ExoPlayerFragment.this;
                if (exoPlayerFragment5.isLive) {
                    exoPlayerFragment5.videoQualitySettingsLayout.setVisibility(8);
                } else {
                    exoPlayerFragment5.videoQualitySettingsLayout.setVisibility(0);
                    ArrayList<String> arrayList = Constants.seasons_list;
                    if (arrayList != null && arrayList.size() > 0) {
                        ExoPlayerFragment.this.episodesLL.setVisibility(0);
                    }
                }
                ExoPlayerFragment exoPlayerFragment6 = ExoPlayerFragment.this;
                if (exoPlayerFragment6.isaccessible && !FusionViliteMainActivity.enterPIPMode) {
                    exoPlayerFragment6.parent_access_layout.setVisibility(0);
                    if (ExoPlayerFragment.this.contentPageItem != null && ExoPlayerFragment.this.contentPageItem.getPageInfo() != null && ExoPlayerFragment.this.contentPageItem.getPageInfo().getAttributes() != null && ExoPlayerFragment.this.contentPageItem.getPageInfo().getAttributes().getCasting() != null && ExoPlayerFragment.this.contentPageItem.getPageInfo().getAttributes().getCasting().equalsIgnoreCase("true")) {
                        RelativeLayout.LayoutParams layoutParams10 = (RelativeLayout.LayoutParams) ExoPlayerFragment.this.access_layout.getLayoutParams();
                        layoutParams10.setMargins(0, 0, (int) ExoPlayerFragment.this.access_layout.getContext().getResources().getDimension(R.dimen._40sdp), 0);
                        ExoPlayerFragment.this.access_layout.setLayoutParams(layoutParams10);
                    }
                }
                LinearLayout.LayoutParams layoutParams11 = (LinearLayout.LayoutParams) ExoPlayerFragment.this.player_forward_icon.getLayoutParams();
                Resources resources2 = ExoPlayerFragment.this.player_forward_icon.getContext().getResources();
                int i4 = R.dimen._120sdp;
                layoutParams11.setMargins((int) resources2.getDimension(i4), 0, 0, 0);
                ExoPlayerFragment.this.player_forward_icon.setLayoutParams(layoutParams11);
                LinearLayout.LayoutParams layoutParams12 = (LinearLayout.LayoutParams) ExoPlayerFragment.this.player_rewind_icon.getLayoutParams();
                layoutParams12.setMargins(0, 0, (int) ExoPlayerFragment.this.player_rewind_icon.getContext().getResources().getDimension(i4), 0);
                ExoPlayerFragment.this.player_rewind_icon.setLayoutParams(layoutParams12);
                ExoPlayerFragment.this.playerLockBtn.setVisibility(0);
                ExoPlayerFragment.this.player_bottom_buttons_layout.setVisibility(0);
                layoutParams.removeRule(12);
                layoutParams.addRule(2, R.id.audiovideosubtitlelayout);
                ExoPlayerFragment exoPlayerFragment7 = ExoPlayerFragment.this;
                if (exoPlayerFragment7.isLive) {
                    layoutParams.setMargins(0, 0, 0, (int) exoPlayerFragment7.seekbarContainer.getContext().getResources().getDimension(R.dimen._35sdp));
                }
                ExoPlayerFragment.this.seekbarContainer.setLayoutParams(layoutParams);
                ExoPlayerFragment exoPlayerFragment8 = ExoPlayerFragment.this;
                if (exoPlayerFragment8.mPlayerControlView.portraitcontrolVisible && (relativeLayout = exoPlayerFragment8.mPlayerHeaderLayout) != null) {
                    relativeLayout.setVisibility(0);
                }
                List<Card> list2 = ExoPlayerFragment.this.recommendationCards;
                if (list2 != null && list2.size() > 0) {
                    ExoPlayerFragment.this.mPlayerRecommendationsIcon.setVisibility(8);
                    CustomLog.e("orientation ", "recommend");
                }
                RelativeLayout relativeLayout3 = ExoPlayerFragment.this.mPlayerControlView.player_collapse_buttonLayout;
                if (relativeLayout3 != null) {
                    relativeLayout3.setVisibility(8);
                }
                ExoPlayerFragment exoPlayerFragment9 = ExoPlayerFragment.this;
                PlayerControlView playerControlView = exoPlayerFragment9.mPlayerControlView;
                if (playerControlView != null && exoPlayerFragment9.isLive) {
                    playerControlView.isShowControls = false;
                }
                if (exoPlayerFragment9.mFragmentHost != null) {
                    ExoPlayerFragment.this.mFragmentHost.onVideoFullscreen(true);
                }
                ExoPlayerFragment.this.mPlayerControlView.setDirectFullScreen(z);
            }
        });
    }

    public void updatePosition() {
        YuppAnalytics yuppAnalytics;
        ExoPlayer exoPlayer = this.player;
        if (exoPlayer == null || exoPlayer.isPlayingAd() || (yuppAnalytics = this.mOttAnalytics) == null) {
            return;
        }
        yuppAnalytics.setPlayerPosition(this.player.getCurrentPosition() > 0 ? this.player.getCurrentPosition() : -1L);
    }

    private void updateResumePosition() {
        ExoPlayer exoPlayer = this.player;
        if (exoPlayer != null) {
            this.resumePosition = exoPlayer.isCurrentWindowSeekable() ? Math.max(0L, this.player.getCurrentPosition()) : -9223372036854775807L;
        }
    }

    public void updateSurfaceView(boolean z) {
        PlayerView playerView = this.simpleExoPlayerView;
        if (playerView != null) {
            playerView.setVisibility(z ? 0 : 4);
            if (this.simpleExoPlayerView.getVideoSurfaceView() != null) {
                this.simpleExoPlayerView.getVideoSurfaceView().setVisibility(z ? 0 : 4);
                if (this.simpleExoPlayerView.getVideoSurfaceView() instanceof SurfaceView) {
                    ((SurfaceView) this.simpleExoPlayerView.getVideoSurfaceView()).setSecure(true);
                }
            }
        }
    }

    private void updateViews() {
        for (int i2 = 0; i2 < this.playerSpeedsList.length; i2++) {
            if (i2 == this.currentSpeedIndex) {
                this.playbackSpeedViews[i2].setChecked(true);
                this.playbackSpeedViews[i2].setBackgroundColor(this.mActivity.getResources().getColor(R.color.home_bg_color));
                this.playbackSpeedViews[i2].setCheckMarkDrawable(R.drawable.lang_check_image);
                this.playbackSpeedViews[i2].setTextColor(getResources().getColor(R.color.selected_track_text_color));
            } else {
                this.playbackSpeedViews[i2].setBackgroundColor(this.mActivity.getResources().getColor(R.color.home_bg_color));
                this.playbackSpeedViews[i2].setChecked(false);
                this.playbackSpeedViews[i2].setCheckMarkDrawable(R.drawable.app_lang_uncheck);
                this.playbackSpeedViews[i2].setTextColor(getResources().getColor(R.color.track_text_color));
            }
        }
    }

    public void updateVolumeUI(int i2) {
        if (this.volumeSeekbar == null || this.volumeLevelText == null) {
            return;
        }
        int i3 = R.id.app_video_volume_icon;
        if (getImageView(i3) != null) {
            int i4 = (int) ((i2 * 100.0d) / this.mMaxVolume);
            this.volumeSeekbar.setProgress(i4);
            this.volumeLevelText.setText(" " + i4);
            getImageView(i3).setImageResource(R.drawable.volume_img);
        }
    }

    @Override
    public void CO_doCollapse() {
        FragmentHost fragmentHost = this.mFragmentHost;
        if (fragmentHost != null) {
            fragmentHost.onVideoCollapse();
            if (this.relatedVideos_layout.getVisibility() == 0) {
                this.relatedVideos_layout.setVisibility(8);
            }
            RecyclerView recyclerView = this.buttonRecyclerView;
            if (recyclerView != null && recyclerView.getVisibility() == 0) {
                this.buttonRecyclerView.setVisibility(8);
            }
            if (this.relatedVideos_layout_seasons.getVisibility() == 0) {
                this.relatedVideos_layout_seasons.setVisibility(8);
            }
        }
    }

    @Override
    public void CO_doFullscreen(boolean z) {
        FragmentHost fragmentHost = this.mFragmentHost;
        if (fragmentHost != null) {
            fragmentHost.onVideoFullscreen(z);
        }
    }

    public void accessNudge() {
        StreamResponse streamResponse;
        ContentPage contentPage = this.contentPageItem;
        if (contentPage != null && contentPage.getPageInfo() != null && this.contentPageItem.getPageInfo().getAttributes() != null && this.contentPageItem.getPageInfo().getAttributes().getContentAccessible() && !FusionViliteMainActivity.enterPIPMode && (streamResponse = this.lastStreamResponse) != null && !TextUtils.isEmpty(streamResponse.getPageAttributes().getFirstEpisodeFreeFullAccessText())) {
            this.access_TV.setText(this.lastStreamResponse.getPageAttributes().getFirstEpisodeFreeFullAccessText());
            this.isaccessible = true;
        }
        this.access_layout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (OTTApplication.IS_PLAYER_SCREEN_LOCKED) {
                    ExoPlayerFragment.this.playerUnLock.setVisibility(0);
                    return;
                }
                Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(ExoPlayerFragment.this.requireContext());
                if (utilAppConfigurations == null || TextUtils.isEmpty(utilAppConfigurations.getFreeEpisodeNudgeTargetPath())) {
                    return;
                }
                if (utilAppConfigurations.getFreeEpisodeNudgeTargetPath().startsWith("http") || utilAppConfigurations.getFreeEpisodeNudgeTargetPath().startsWith("https")) {
                    ExoPlayerFragment.this.launchExternalBrowser(utilAppConfigurations.getFreeEpisodeNudgeTargetPath());
                } else {
                    ((FusionViliteMainActivity) ExoPlayerFragment.this.getContext()).launchWebviewPlansPage(utilAppConfigurations.getFreeEpisodeNudgeTargetPath(), null, "player nudge");
                }
                OTTApplication.PAUSE_PLAY_BACK = true;
                ExoPlayerFragment.this.pausePlayer();
                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                exoPlayerFragment.eventCTClickEvent(exoPlayerFragment.contentPageItem, "get full access");
            }
        });
    }

    public void callRecoEvent() {
        ExoPlayer exoPlayer = this.player;
        if (exoPlayer == null || exoPlayer.getPlaybackState() == 4) {
            return;
        }
        HashMap hashMap = new HashMap();
        if (this.sessionStartTime > 0) {
            this.totalPlaytime += System.currentTimeMillis() - this.sessionStartTime;
            this.sessionStartTime = 0L;
        }
        long seconds = TimeUnit.MILLISECONDS.toSeconds(this.totalPlaytime);
        if (seconds > 0) {
            hashMap.put("value", String.valueOf(seconds));
            hashMap.put("carousal_name", this.carousalName);
            hashMap.put("carousal_position", "" + this.carousalPosition);
            hashMap.put("content_position", "" + this.contentPosition);
            hashMap.put("target_path", "" + this.playTargetPath);
            hashMap.put("tabName", "" + this.tabName);
            hashMap.put("tracking_id", this.trackingId);
            hashMap.put("origin_medium", this.originMedium);
            hashMap.put("origin_source", this.originSource);
            if (MyRecoManager.getInstance().getRecommendationTabName() != null && !MyRecoManager.getInstance().getRecommendationTabName().isEmpty()) {
                hashMap.put("tabName", MyRecoManager.getInstance().getRecommendationTabName());
                MyRecoManager.getInstance().setRecommendationTabName("");
            }
            NavigationUtils.sendRecoEvents(this.mActivity, hashMap);
            this.carousalName = "";
            this.carousalPosition = 0;
            this.contentPosition = 0;
            this.playTargetPath = "";
            this.tabName = "";
            this.trackingId = "";
            this.originMedium = "";
            this.originSource = "";
            this.totalPlaytime = 0L;
        }
    }

    public void callRedirectDialog(HashMap<String, String> hashMap) {
        NavigationUtils.showDialog(this.source, this.mActivity, DialogType.DEEPLINK_INFO, hashMap, this.itemObject, new BottomButtonsActionListener() {
            @Override
            public void onButtonClicked(AppCompatButton appCompatButton, Object obj, ButtonType buttonType) {
            }

            @Override
            public void onDismiss() {
            }
        });
    }

    public void checkPlayingSameContent(String str, OfflinePlayingCallBack offlinePlayingCallBack) {
        if (str == null || !str.equals(this.mPath) || this.offlineData == null) {
            offlinePlayingCallBack.onPlayingSameContent(false);
        } else {
            offlinePlayingCallBack.onPlayingSameContent(true);
        }
    }

    public void checkRequestEPG() {
        if (!this.isLive) {
            this.takeTestButton.setVisibility(8);
            return;
        }
        if (this.programEndTime > 0 && (System.currentTimeMillis() / 1000) - 60 >= this.programEndTime / 1000) {
            getStreamInfo();
            this.takeTestButton.setVisibility(8);
            return;
        }
        String str = this.testURL;
        if (str == null || str.trim().isEmpty() || getActivity() == null || getActivity().getResources().getConfiguration().orientation != 2) {
            this.takeTestButton.setVisibility(8);
            return;
        }
        OttSDK ottSDK = OttSDK.getInstance();
        if (ottSDK == null || ottSDK.getPreferenceManager() == null || ottSDK.getPreferenceManager().getLoggedUser() == null || ottSDK.getPreferenceManager().getLoggedUser().getAttributes() == null || ottSDK.getPreferenceManager().getLoggedUser().getAttributes().getLms_user_name() == null || ottSDK.getPreferenceManager().getLoggedUser().getAttributes().getLms_user_name().trim().length() <= 0) {
            this.takeTestButton.setVisibility(8);
            return;
        }
        if ((System.currentTimeMillis() / 1000) - 60 >= this.testStartTime.longValue() / 1000 && System.currentTimeMillis() / 1000 <= this.programEndTime / 1000) {
            stopTimer();
            this.takeTestButton.setBackground(getResources().getDrawable(R.drawable.action_background_onfocus));
            this.takeTestButton.setEnabled(true);
            this.takeTestButton.setText(this.takeTestButtonText);
            this.takeTestButton.setVisibility(0);
            return;
        }
        if (System.currentTimeMillis() / 1000 < this.programStartTime / 1000 || System.currentTimeMillis() / 1000 > this.testStartTime.longValue() / 1000) {
            return;
        }
        startTimer(Long.valueOf(this.testStartTime.longValue() - System.currentTimeMillis()));
        this.takeTestButton.setBackground(getResources().getDrawable(R.drawable.action_background_offfocus));
        this.takeTestButton.setEnabled(false);
        this.takeTestButton.setVisibility(0);
    }

    public DataSource createDataSource() {
        return null;
    }

    public MediaSource createMediaSource(MediaItem mediaItem) {
        return null;
    }

    public void ctEventPopup(String str, String str2, String str3, String str4, String str5) {
        CleverTap.moviesEventPopUp("no", str2, str4, str5, str3, "", "", "na", "", "", str, null, getActivity().bottomTabSelected, "", MyRecoManager.getInstance().getContentModel(), -1, -1, null, MyRecoManager.getInstance().getContentTag());
    }

    public void endGesture() {
        this.mVolume = -1.0f;
        this.mBrightness = -1.0f;
        PlayerControlView playerControlView = this.mPlayerControlView;
        if (playerControlView.volBrightSeekbarVisible) {
            playerControlView.volBrightSeekbarVisible = false;
            playerControlView.show();
        }
        setViewVisibility(R.id.forward_layout, true);
        setViewVisibility(R.id.rewind_layout, true);
    }

    public void eventCTPlayerAction(String str) {
        Object obj = this.itemObject;
        if (obj != null) {
        }
        String contentTitle = MyRecoManager.getInstance().getContentTitle();
        String contentPartnerName = MyRecoManager.getInstance().getContentPartnerName();
        StreamResponse streamResponse = this.lastStreamResponse;
        CleverTap.moviesEventVideoPlayerActions(str, "na", "na", MyRecoManager.getInstance().getContentId(), contentTitle, MyRecoManager.getInstance().getContentModel(), contentPartnerName, (streamResponse == null || TextUtils.isEmpty(streamResponse.getPageAttributes().getFirstEpisodeFreeFullAccessText())) ? MyRecoManager.getInstance().getContentType() : "tvshow", MyRecoManager.getInstance().getContentTag());
    }

    public void fetchData(String str, final long j, final CardItemCallback cardItemCallback, ButtonType buttonType) {
        if (TextUtils.isEmpty(str)) {
            Toast.makeText((Context) getActivity(), R.string.error_unknown, 1).show();
            return;
        }
        if (buttonType == null) {
            buttonType = ButtonType.NONE;
        }
        this.mButtonType = buttonType;
        if (getActivity() instanceof FusionViliteMainActivity) {
            getActivity().currentItemtargerPath = str;
        }
        if (getActivity() instanceof FusionViliteMainActivity) {
            getActivity().clearPlayerData();
        }
        OttSDK.getInstance().getMediaManager().getPageContent(str, new MediaCatalogManager.MediaCatalogCallback<ContentPage>() {
            @Override
            public void onFailure(Error error) {
                if (ExoPlayerFragment.this.getActivity() != null && !ExoPlayerFragment.this.getActivity().isFinishing()) {
                    com.yupptv.ott.fragments.a.a(error, ExoPlayerFragment.this.getActivity(), 1);
                }
                CardItemCallback cardItemCallback2 = cardItemCallback;
                if (cardItemCallback2 != null) {
                    cardItemCallback2.updateData(null);
                }
                NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "/service/api/v1/page/content", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
            }

            @Override
            public void onSuccess(ContentPage contentPage) {
                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                exoPlayerFragment.startPlay(contentPage, j, exoPlayerFragment.mButtonType);
                cardItemCallback.updateData(contentPage);
            }
        });
    }

    public void fetchRecommendations(final List<PageData> list) {
        List<Card> list2;
        this.relative_seasonui.setVisibility(8);
        this.recommendation_control_backbutton.setVisibility(8);
        if (this.contentPageItem != null) {
            this.sectionInfo = null;
            int size = list.size();
            try {
                if (this.isLive) {
                    this.channel_suggestions.setVisibility(0);
                } else {
                    this.channel_suggestions.setVisibility(8);
                    this.relatedVideos_layout.setVisibility(8);
                }
                String str = Constants.seasons_list.get(this.tab_position_clicked - 1);
                for (int i2 = 0; i2 < Constants.seasons_list.size(); i2++) {
                    if (!Constants.seasons_list.get(0).isEmpty()) {
                        this.title_seasons = Constants.seasons_list.get(i2);
                    }
                    if (this.title_seasons.equalsIgnoreCase(str)) {
                        this.value = i2;
                        APIUtils.getmMediaManager(requireContext()).getPageSectionContent(UpNextFragment.playerPageData.getPageInfo().getPath(), UpNextFragment.sectionsInfo.get(i2).getSectionInfo().getCode(), 0, 15, null, null, new MediaCatalogManager.MediaCatalogCallback<List<Section.SectionData>>() {
                            @Override
                            public void onFailure(Error error) {
                                if (ExoPlayerFragment.this.getActivity() == null) {
                                    return;
                                }
                                NavigationUtils.logKibanaError("ExoPlayerFragment", "API", "/service/api/v1/section/data", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
                            }

                            @Override
                            public void onSuccess(List<Section.SectionData> list3) {
                                List<Section> list4;
                                if (ExoPlayerFragment.this.getActivity() == null || list3 == null || list3.size() < 1) {
                                    return;
                                }
                                ExoPlayerFragment.this.lastIndex = list3.get(0).getLastIndex().intValue();
                                ExoPlayerFragment.this.hasMoreData = list3.get(0).getHasMoreData().booleanValue();
                                if (list3.get(0).getCards().isEmpty() || list3.get(0).getCards().size() == 0) {
                                    ExoPlayerFragment.this.relatedVideos_layout.setVisibility(8);
                                }
                                ExoPlayerFragment.this.recommendationCards = list3.get(0).getCards();
                                try {
                                    if (list3.get(0) != null && list3.get(0).getCards() != null && (list4 = UpNextFragment.sectionsInfo) != null && list4.get(ExoPlayerFragment.this.value) != null && UpNextFragment.sectionsInfo.get(ExoPlayerFragment.this.value).getSectionData() != null) {
                                        UpNextFragment.sectionsInfo.get(ExoPlayerFragment.this.value).getSectionData().setCards(list3.get(0).getCards());
                                    }
                                    ExoPlayerFragment.this.button_season.setText(Constants.seasons_list.get(ExoPlayerFragment.this.value).toString());
                                    int i3 = ExoPlayerFragment.this.value + 1;
                                    boolean z = (list.get(i3) == null || ((PageData) list.get(i3)).getSection() == null || ((PageData) list.get(i3)).getSection().getSectionInfo() == null || ((PageData) list.get(i3)).getSection().getSectionInfo().getParams() == null || TextUtils.isEmpty(((PageData) list.get(i3)).getSection().getSectionInfo().getParams().getShowCardTitle()) || !((PageData) list.get(i3)).getSection().getSectionInfo().getParams().getShowCardTitle().equalsIgnoreCase("true")) ? false : true;
                                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                                    exoPlayerFragment.linearLayoutManager_seasons = new LinearLayoutManager(exoPlayerFragment.mActivity, 0, false);
                                    ExoPlayerFragment.this.relatedvideosrecyclerview_episodes.setLayoutManager(ExoPlayerFragment.this.linearLayoutManager_seasons);
                                    ExoPlayerFragment.this.relatedvideosrecyclerview_episodes.setVisibility(0);
                                    ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                                    FragmentActivity fragmentActivity = exoPlayerFragment2.mActivity;
                                    ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                                    exoPlayerFragment2.seasonViewAdapter = exoPlayerFragment2.new SeasonViewAdapter(fragmentActivity, exoPlayerFragment3.recommendationCards, z, exoPlayerFragment3.value);
                                    ExoPlayerFragment.this.relatedvideosrecyclerview_episodes.setAdapter(ExoPlayerFragment.this.seasonViewAdapter);
                                } catch (Exception unused) {
                                }
                            }
                        });
                    }
                }
                ArrayList<String> arrayList = Constants.seasons_list;
                if (arrayList != null && arrayList.get(this.tab_position_clicked - 1) != null) {
                    this.button_season.setText(Constants.seasons_list.get(this.tab_position_clicked - 1).toString());
                    this.button_season.setTextColor(getResources().getColor(R.color.white));
                }
            } catch (Exception unused) {
            }
            int i3 = -1;
            this.mGridAdapter.setFilterDuplicates(false);
            for (int i4 = 0; i4 < size; i4++) {
                if (list.get(i4).getPaneType().equalsIgnoreCase("section") && list.get(i4).getSection() != null && list.get(i4).getSection().getSectionInfo() != null && list.get(i4).getSection().getSectionInfo().getName() != null && list.get(i4).getSection().getSectionInfo().getName().trim().length() > 0 && !list.get(i4).getSection().getSectionInfo().getName().trim().toLowerCase().contains("cast") && !list.get(i4).getSection().getSectionInfo().getName().trim().toLowerCase().contains("crew")) {
                    ContentPage contentPage = this.contentPageItem;
                    if (contentPage == null || contentPage.getPageInfo() == null || this.contentPageItem.getPageInfo().getAttributes() == null || this.contentPageItem.getPageInfo().getAttributes().getSeasonSeqNo() == null || list.get(i4).getSection().getSectionData() == null || list.get(i4).getSection().getSectionData().getCards().size() <= 0 || list.get(i4).getSection().getSectionData().getCards().get(0).getTarget() == null || list.get(i4).getSection().getSectionData().getCards().get(0).getTarget().getPageAttributes() == null || list.get(i4).getSection().getSectionData().getCards().get(0).getTarget().getPageAttributes().getSeasonSeqNo() == null) {
                        this.sectionInfo = list.get(i4).getSection();
                    } else {
                        if (list.get(i4).getSection().getSectionData().getHasMoreData().booleanValue()) {
                            this.hasMoreData = true;
                        }
                        if (this.contentPageItem.getPageInfo().getAttributes().getSeasonSeqNo().equals(list.get(i4).getSection().getSectionData().getCards().get(0).getTarget().getPageAttributes().getSeasonSeqNo())) {
                            this.sectionInfo = list.get(i4).getSection();
                        }
                    }
                    i3 = i4;
                    break;
                }
            }
            Section section = this.sectionInfo;
            if (section != null && section.getSectionData() != null && this.sectionInfo.getSectionData().getCards().size() > 0) {
                List<Card> cards = this.sectionInfo.getSectionData().getCards();
                this.recommendationCards = cards;
                if (cards != null) {
                    cards.size();
                }
                if (this.isLive || (list2 = this.recommendationCards) == null || list2.size() <= 0) {
                    this.mPlayerRecommendationsIcon.setVisibility(8);
                } else {
                    this.episodesLL.setVisibility(0);
                    if (getResources().getConfiguration().orientation != 1) {
                        this.mPlayerRecommendationsIcon.setVisibility(8);
                    }
                    CustomLog.e("orientation ", "recommend");
                }
                if (this.isLive) {
                    this.mGridAdapter.setFilterDuplicates(false);
                    GridController gridController = this.mGridAdapter;
                    List<Card> list3 = this.recommendationCards;
                    Integer valueOf = Integer.valueOf(NavigationConstants.ROW_ITEM);
                    Boolean bool = Boolean.FALSE;
                    gridController.setData(list3, valueOf, bool);
                    List<Card> list4 = this.recommendationCards;
                    if (list4 != null && list4.size() + 1 == this.mGridAdapter.getAdapter().getCopyOfModels().size()) {
                        this.mGridAdapter.setData(this.recommendationCards, Integer.valueOf(NavigationConstants.ROW_ITEM), bool);
                    }
                    setAdapter(this.mGridAdapter);
                } else {
                    boolean z = (i3 < 0 || list.get(i3) == null || list.get(i3).getSection() == null || list.get(i3).getSection().getSectionInfo() == null || list.get(i3).getSection().getSectionInfo().getParams() == null || TextUtils.isEmpty(list.get(i3).getSection().getSectionInfo().getParams().getShowCardTitle()) || !list.get(i3).getSection().getSectionInfo().getParams().getShowCardTitle().equalsIgnoreCase("true")) ? false : true;
                    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.mActivity, 0, false);
                    this.linearLayoutManager_seasons = linearLayoutManager;
                    this.relatedvideosrecyclerview_episodes.setLayoutManager(linearLayoutManager);
                    this.relatedvideosrecyclerview_episodes.setVisibility(0);
                    SeasonViewAdapter seasonViewAdapter = new SeasonViewAdapter(this.mActivity, this.recommendationCards, z, i3);
                    this.seasonViewAdapter = seasonViewAdapter;
                    this.relatedvideosrecyclerview_episodes.setAdapter(seasonViewAdapter);
                }
            }
            List<Card> list5 = this.recommendationCards;
            if (list5 == null || list5.size() <= 0 || this.isLive) {
                return;
            }
            this.mListSeasons.addAll(this.recommendationCards);
            this.mListSeasonNames.clear();
        }
    }

    public int getCachedDuration() {
        return getDuration();
    }

    @NonNull
    public CastStateListener getCastStateListener() {
        return new CastStateListener() {
            public void onCastStateChanged(int i2) {
                if (ExoPlayerFragment.this.mc == null || !ExoPlayerFragment.this.isAdded()) {
                    return;
                }
                if (ExoPlayerFragment.this.mc.getCastState() == 4) {
                    String str = ExoPlayerFragment.this.mUrl;
                    if (str == null || str.length() <= 0 || !ExoPlayerFragment.this.isVisible()) {
                        return;
                    }
                    ExoPlayerFragment.this.tooglePlayer(false);
                    new Handler().post(new Runnable() {
                        @Override
                        public void run() {
                            ExoPlayerFragment.this.stateChangedOnCastConnected();
                            ExoPlayerFragment.this.releaseAnalytics();
                            ExoPlayerFragment.this.loadChromeCast();
                            ExoPlayerFragment.this.isPlayerInitiated = false;
                            ExoPlayerFragment.this.isChromeCastStop = true;
                        }
                    });
                    return;
                }
                if (ExoPlayerFragment.this.mc.getCastState() == 2 && ExoPlayerFragment.this.isVisible()) {
                    ExoPlayerFragment.this.mMediaRouteButton.setRemoteIndicatorDrawable(ExoPlayerFragment.this.getResources().getDrawable(R.drawable.quantum_ic_cast_connected_white_24));
                    ExoPlayerFragment.this.shouldAutoPlay = true;
                    if (ExoPlayerFragment.this.isPauseByUser || ExoPlayerFragment.this.isPlayerAutoPaused) {
                        ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                        if (!exoPlayerFragment.isTrailer && !exoPlayerFragment.isShowNextEpisodeButtonShowing) {
                            exoPlayerFragment.tooglePlayer(false);
                            return;
                        }
                    }
                    ExoPlayerFragment.this.tooglePlayer(true);
                    return;
                }
                if (ExoPlayerFragment.this.mc.getCastState() == 3) {
                    ExoPlayerFragment.this.tooglePlayer(false);
                    OttLog.error("connecting state", "+++++++++++" + ExoPlayerFragment.this.getActivity().mWatchWhileLayout.mState);
                    if (ExoPlayerFragment.this.getActivity().mWatchWhileLayout.mState == 2) {
                        ExoPlayerFragment.this.getActivity().exitMiniPlayer();
                        ExoPlayerFragment.this.getActivity().showChromecastLoading(true);
                    } else if (ExoPlayerFragment.this.getActivity().mWatchWhileLayout.mState == 0) {
                        ExoPlayerFragment.this.getActivity().exitMiniPlayer();
                        ExoPlayerFragment.this.getActivity().showChromecastLoading(false);
                    } else {
                        ExoPlayerFragment.this.stateChangedOnCastConnected();
                        ExoPlayerFragment.this.showOverLayLayoutIfAny();
                    }
                    ExoPlayerFragment.this.mMediaRouteButton.setRemoteIndicatorDrawable(ExoPlayerFragment.this.getResources().getDrawable(R.drawable.mr_button_connecting_dark));
                }
            }
        };
    }

    public Object getCurrentPlayingItem() {
        return this.itemObject;
    }

    public int getCurrentPosition() {
        ExoPlayer exoPlayer = this.player;
        if (exoPlayer != null) {
            return (int) exoPlayer.getCurrentPosition();
        }
        return 0;
    }

    public boolean getIsLive() {
        return this.isLive;
    }

    public void getNoProAndProUserSheetDialog(Object obj, String str, String str2, String str3, DialogType dialogType) {
        HashMap hashMap = new HashMap();
        hashMap.put("dialog_template_code", str2);
        hashMap.put("dialog_key_target_path", str3);
        NavigationUtils.showDialog(str, getActivity(), dialogType, hashMap, obj, new BottomButtonsActionListener() {
            @Override
            public void onButtonClicked(AppCompatButton appCompatButton, Object obj2, ButtonType buttonType) {
            }

            @Override
            public void onDismiss() {
            }
        });
    }

    public void getPlayerView(boolean z) {
        DefaultTrackSelector defaultTrackSelector;
        this.playerSettingsBtn.setVisibility(0);
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.seekbarContainer.getLayoutParams();
        if (z) {
            ImageView imageView = this.playerSettingsBtn;
            if (imageView != null && !this.isLive) {
                imageView.setVisibility(8);
            }
            this.episodesLL.setVisibility(8);
            if (this.isLive) {
                this.videoQualitySettingsLayout.setVisibility(8);
            } else {
                this.videoQualitySettingsLayout.setVisibility(0);
                ArrayList<String> arrayList = Constants.seasons_list;
                if (arrayList != null && arrayList.size() > 0) {
                    this.episodesLL.setVisibility(0);
                }
            }
            this.playerLockBtn.setVisibility(0);
            this.player_bottom_buttons_layout.setVisibility(0);
            layoutParams.removeRule(12);
            layoutParams.addRule(2, R.id.audiovideosubtitlelayout);
            if (this.isLive) {
                layoutParams.setMargins(0, 0, 0, (int) this.seekbarContainer.getContext().getResources().getDimension(R.dimen._35sdp));
            }
            this.seekbarContainer.setLayoutParams(layoutParams);
        } else {
            this.relative_seasonui.setVisibility(8);
            this.playerUnLock.setVisibility(8);
            this.playerLockBtn.setVisibility(8);
            this.player_bottom_buttons_layout.setVisibility(8);
            layoutParams.setMargins(0, 0, 0, (int) this.seekbarContainer.getContext().getResources().getDimension(R.dimen._15sdp));
            layoutParams.addRule(12);
            this.seekbarContainer.setLayoutParams(layoutParams);
        }
        this.relatedVideos_layout.setVisibility(8);
        this.relatedVideos_layout_seasons.setVisibility(8);
        this.relative_seasonui.setVisibility(8);
        this.recommendation_control_backbutton.setVisibility(8);
        updateBottomSheets();
        ExoPlayer exoPlayer = this.player;
        if (exoPlayer != null && exoPlayer.getVideoFormat() != null) {
            CustomLog.e("Playing ", "Bitrate : " + this.player.getVideoFormat().bitrate);
        }
        AppCompatImageView appCompatImageView = this.btnZoomin;
        if (appCompatImageView != null) {
            if (z) {
                appCompatImageView.setVisibility(8);
            } else {
                appCompatImageView.setVisibility(8);
            }
        }
        if (z && UiUtils.isNetworkConnected(getActivity()) && this.offlineData == null) {
            StreamResponse streamResponse = this.streamResponseObject;
            if (streamResponse != null) {
                streamResponse.getAnalyticsInfo().getContentType().equalsIgnoreCase("live");
            }
            CustomLog.e("Playing ", "recommend");
            List<Card> list = this.recommendationCards;
            if (list == null || list.size() <= 0) {
                this.mPlayerRecommendationsIcon.setVisibility(8);
            } else {
                if (getResources().getConfiguration().orientation != 1) {
                    this.mPlayerRecommendationsIcon.setVisibility(8);
                }
                CustomLog.e("orientation ", "recommend");
            }
        } else {
            this.playerChatBtn.setVisibility(8);
            this.mPlayerRecommendationsIcon.setVisibility(8);
            this.takeTestButton.setVisibility(8);
        }
        ImageView imageView2 = this.playerCaptionsBtn;
        if (imageView2 == null) {
            boolean z2 = this.isCloseCaptionsAvailable;
            if (!z2 && !this.isAudioTrackAvailable) {
                if (!z2) {
                    imageView2.setVisibility(8);
                }
                this.audioLayout.setVisibility(8);
                this.subtitleLayout.setVisibility(8);
                this.playerMultipleAudioSubtitleTracksBtn.setVisibility(8);
                return;
            }
            imageView2.setVisibility(8);
            this.playerMultipleAudioSubtitleTracksBtn.setVisibility(0);
            if (this.isCloseCaptionsAvailable) {
                this.subtitleLayout.setVisibility(0);
            }
            if (this.isAudioTrackAvailable) {
                this.audioLayout.setVisibility(0);
                return;
            }
            return;
        }
        if (this.showCC && ((this.isCloseCaptionsAvailable || this.isAudioTrackAvailable) && (defaultTrackSelector = this.trackSelector) != null && defaultTrackSelector.getCurrentMappedTrackInfo() != null && this.trackSelector.getCurrentMappedTrackInfo().getTrackGroups(2) != null && this.trackSelector.getCurrentMappedTrackInfo().getTrackGroups(2).length > 0)) {
            this.playerCaptionsBtn.setVisibility(8);
            return;
        }
        boolean z3 = this.isCloseCaptionsAvailable;
        if (!z3 && !this.isAudioTrackAvailable) {
            if (!z3) {
                this.playerCaptionsBtn.setVisibility(8);
            }
            this.audioLayout.setVisibility(8);
            this.subtitleLayout.setVisibility(8);
            this.playerMultipleAudioSubtitleTracksBtn.setVisibility(8);
            return;
        }
        this.playerCaptionsBtn.setVisibility(8);
        this.playerMultipleAudioSubtitleTracksBtn.setVisibility(0);
        if (this.isCloseCaptionsAvailable) {
            this.subtitleLayout.setVisibility(0);
        }
        if (this.isAudioTrackAvailable) {
            this.audioLayout.setVisibility(0);
        }
    }

    public void getSubscribeSheetDialog(Object obj, String str, Content.Elements elements, String str2) {
        String template = (elements == null || elements.getProperties() == null) ? "" : elements.getProperties().getTemplate();
        HashMap hashMap = new HashMap();
        hashMap.put("dialog_template_code", template);
        hashMap.put("dialog_key_target_path", str2);
        NavigationUtils.showSubscribeDialog(str, getActivity(), DialogType.SUBSCRIBE_SHEET_DIALOG, hashMap, obj, new BottomButtonsActionListener() {
            @Override
            public void onButtonClicked(AppCompatButton appCompatButton, Object obj2, ButtonType buttonType) {
            }

            @Override
            public void onDismiss() {
            }
        });
    }

    public int[] getSupportedTypes() {
        return new int[0];
    }

    public void getUpgradeSheetDialog(Object obj, String str, Content.Elements elements, String str2) {
        String template = (elements == null || elements.getProperties() == null) ? "" : elements.getProperties().getTemplate();
        HashMap hashMap = new HashMap();
        hashMap.put("dialog_template_code", template);
        hashMap.put("dialog_key_target_path", str2);
        NavigationUtils.showSubscribeDialog(str, getActivity(), DialogType.SUBSCRIBE_SHEET_DIALOG, hashMap, obj, new BottomButtonsActionListener() {
            @Override
            public void onButtonClicked(AppCompatButton appCompatButton, Object obj2, ButtonType buttonType) {
            }

            @Override
            public void onDismiss() {
            }
        });
    }

    public void getUserCocpSheetDialog(Object obj, String str, Content.Elements elements, String str2) {
        String template = elements != null ? elements.getProperties().getTemplate() : "";
        HashMap hashMap = new HashMap();
        hashMap.put("dialog_template_code", template);
        hashMap.put("dialog_key_target_path", str2);
        NavigationUtils.showUserCocpDialog(str, getActivity(), DialogType.USER_COCP_SHEET_DIALOG, hashMap, obj, new BottomButtonsActionListener() {
            @Override
            public void onButtonClicked(AppCompatButton appCompatButton, Object obj2, ButtonType buttonType) {
            }

            @Override
            public void onDismiss() {
            }
        });
    }

    public void getUserSuspendedSheetDialog(Object obj, String str, Content.Elements elements, String str2) {
        String template = elements != null ? elements.getProperties().getTemplate() : "";
        HashMap hashMap = new HashMap();
        hashMap.put("dialog_template_code", template);
        hashMap.put("dialog_key_target_path", str2);
        NavigationUtils.showUserSuspendedDialog(str, getActivity(), DialogType.USER_SUSPENDED_SHEET_DIALOG, hashMap, obj, new BottomButtonsActionListener() {
            @Override
            public void onButtonClicked(AppCompatButton appCompatButton, Object obj2, ButtonType buttonType) {
            }

            @Override
            public void onDismiss() {
            }
        });
    }

    public void hideChromeCast() {
        FrameLayout frameLayout = this.mCastLayout;
        if (frameLayout == null || frameLayout.getVisibility() != 0) {
            return;
        }
        this.mCastLayout.setVisibility(8);
    }

    public void hideControls() {
        PlayerControlView playerControlView = this.mPlayerControlView;
        if (playerControlView != null) {
            playerControlView.hide();
            this.errorWarningImg.setVisibility(8);
        }
        if (this.mPlayerControlView.player_loading.getVisibility() == 0) {
            this.mPlayerControlView.showProgress(false);
            this.miniPlayerLoader.setVisibility(0);
        } else if (this.miniPlayerLoader.getVisibility() == 0) {
            this.mPlayerControlView.showProgress(true);
            showProgress(false);
        }
        TextView textView = this.error_text_view;
        if (textView != null && textView.getVisibility() == 0) {
            this.mIsError = true;
            this.errorWarningImg.setVisibility(0);
        }
        ImageView imageView = this.waterMark;
        if (imageView != null && imageView.getVisibility() == 0) {
            this.waterMark.setVisibility(8);
        }
        if (OTTApplication.IS_PLAYER_SCREEN_LOCKED) {
            this.playerLockBtn.setVisibility(0);
        }
    }

    public void hideControlsWithoutAnim() {
        PlayerControlView playerControlView = this.mPlayerControlView;
        if (playerControlView != null) {
            playerControlView.hidewithoutAnimation();
        }
        setContentRatingVisibility(8);
        ExoPlayer exoPlayer = this.player;
        if (exoPlayer != null) {
            exoPlayer.isPlayingAd();
        }
    }

    public void hideDocPlayer() {
        hideMiniControls();
    }

    public void hideMiniControls() {
        View view = this.mMiniControlsContainer;
        if (view != null) {
            view.setVisibility(8);
        }
    }

    @Override
    public void hideNextVideo() {
        RelativeLayout relativeLayout = this.mNextVideoLayout;
        if (relativeLayout != null && relativeLayout.getVisibility() == 0) {
            this.mNextVideoLayout.setVisibility(8);
        }
        AppCompatButton appCompatButton = this.nextEpisodeButton;
        if (appCompatButton == null || appCompatButton.getVisibility() != 0 || this.isShowNextEpisodeButtonShowing) {
            return;
        }
        this.nextEpisodeButton.setVisibility(4);
    }

    public void hidePipControles() {
        AppCompatButton appCompatButton = this.skipIntroButton;
        if (appCompatButton != null && appCompatButton.getVisibility() == 0) {
            this.skipIntroButton.setVisibility(8);
        }
        FrameLayout frameLayout = this.watchCreditsFrameLayout;
        if (frameLayout != null && frameLayout.getVisibility() == 0) {
            this.watchCreditsFrameLayout.setVisibility(8);
        }
        hideNextVideo();
        hideControls();
        if (!this.isaccessible && getActivity().getResources().getConfiguration().orientation != 2) {
            this.parent_access_layout.setVisibility(8);
        }
        LinearLayout linearLayout = this.relatedVideos_layout;
        if (linearLayout != null && linearLayout.getVisibility() == 0) {
            this.relatedVideos_layout.setVisibility(8);
        }
        LinearLayout linearLayout2 = this.relatedVideos_layout_seasons;
        if (linearLayout2 != null && linearLayout2.getVisibility() == 0) {
            this.relatedVideos_layout_seasons.setVisibility(8);
        }
        Dialog dialog = this.mDialog;
        if (dialog != null && dialog.isShowing()) {
            this.mDialog.dismiss();
        }
        Dialog dialog2 = this.trackSelectionHelper.mDialog;
        if (dialog2 == null || !dialog2.isShowing()) {
            return;
        }
        this.trackSelectionHelper.mDialog.dismiss();
    }

    public boolean isAdPlaying() {
        return this.isPlayingAd;
    }

    public boolean isPlaying() {
        ExoPlayer exoPlayer;
        if (isAdPlaying() || (exoPlayer = this.player) == null) {
            return false;
        }
        return exoPlayer.isPlaying();
    }

    public void landscapeRecomendations(boolean z) {
        if ((getActivity() != null ? getActivity().getResources().getConfiguration().orientation : 1) == 2 && this.isLive) {
            if (z || OTTApplication.IS_PLAYER_SCREEN_LOCKED) {
                this.relatedVideos_layout.setVisibility(8);
            } else {
                this.relatedVideos_layout.setVisibility(0);
            }
        }
    }

    @SuppressLint({"NewApi"})
    public void offlineDownload(String str, String str2, String str3, String str4, String str5, VideoDownloadCallBack videoDownloadCallBack, DownloadTracker downloadTracker) {
        DownloadTracker downloadTracker2 = downloadTracker == null ? OTTApplication.getInstance().getDownloadTracker() : downloadTracker;
        StreamResponse streamResponse = this.streamResponseObject;
        long j = 0;
        if (streamResponse != null && streamResponse.getStreamStatus() != null && this.streamResponseObject.getStreamStatus().getTotalDurationInMillis() != null && this.streamResponseObject.getStreamStatus().getTotalDurationInMillis().longValue() > 0) {
            j = this.streamResponseObject.getStreamStatus().getTotalDurationInMillis().longValue();
        }
        long j2 = j;
        long currentTimeMillis = System.currentTimeMillis() + Configurations.offlineDownloadExpiryDays;
        OfflineDownloadData offlineDownloadData = new OfflineDownloadData();
        String str6 = str2 == null ? "" : str2;
        offlineDownloadData.setTitle(str6);
        offlineDownloadData.setSubTitle(str3);
        offlineDownloadData.setImageUrl(str5);
        offlineDownloadData.setTargetPath(this.mUrl);
        offlineDownloadData.setPath(this.mPath);
        offlineDownloadData.setCode(this.mCode);
        offlineDownloadData.setSiteUrl(str4);
        offlineDownloadData.setLicenseUrl(this.licenseUrl);
        offlineDownloadData.setUserId(str);
        offlineDownloadData.setContentDuration(UiUtils.milliSec2String(j2));
        offlineDownloadData.setIsDRM(Boolean.valueOf(this.isdrm));
        MediaDownloadService.setTargetPath(this.mUrl, offlineDownloadData);
        downloadTracker2.toggleDownload(getActivity(), offlineDownloadData, Uri.parse(this.mUrl), "", this.mediaItems.get(0), this.renderersFactory, videoDownloadCallBack);
        WithoutInternetOfflineDownloadsEntity withoutInternetOfflineDownloadsEntity = new WithoutInternetOfflineDownloadsEntity();
        withoutInternetOfflineDownloadsEntity.setUserId(str);
        withoutInternetOfflineDownloadsEntity.setTargetPath(this.mUrl);
        withoutInternetOfflineDownloadsEntity.setImageUrl(str5);
        withoutInternetOfflineDownloadsEntity.setTitle(str6);
        withoutInternetOfflineDownloadsEntity.setSubTitle(str3);
        withoutInternetOfflineDownloadsEntity.setPath(this.mPath);
        withoutInternetOfflineDownloadsEntity.setCode(this.mCode);
        withoutInternetOfflineDownloadsEntity.setSiteUrl(str4);
        withoutInternetOfflineDownloadsEntity.setLicenseUrl(this.licenseUrl);
        withoutInternetOfflineDownloadsEntity.setIsdrm(Boolean.valueOf(this.isdrm));
        withoutInternetOfflineDownloadsEntity.setExpiryTime(Long.valueOf(currentTimeMillis));
        withoutInternetOfflineDownloadsEntity.setContentDuration(UiUtils.milliSec2String(j2));
        withoutInternetOfflineDownloadsEntity.setDownloadInProgress(Boolean.TRUE);
        UiUtils.insertIntoWithOutInternetOfflineDB(getActivity(), withoutInternetOfflineDownloadsEntity);
    }

    @SuppressLint({"ClickableViewAccessibility"})
    public void offlineSubscription(String str) {
        try {
            ExoPlayer exoPlayer = this.player;
            if (exoPlayer != null) {
                exoPlayer.release();
            }
            this.mForeground = false;
            PlayerControlView playerControlView = this.mPlayerControlView;
            if (playerControlView != null) {
                playerControlView.removeCallbacks();
                this.mPlayerControlView.hide();
                this.mPlayerControlView.setListener(null);
            }
            View view = this.container;
            if (view != null) {
                view.setBackgroundColor(getResources().getColor(R.color.black));
                this.simpleExoPlayerView.setOnTouchListener(onTouchListener());
            }
            releaseAnalytics();
            showError(true, str);
        } catch (Exception unused) {
        }
    }

    @Override
    public void onActionItemClicked(Object obj, int i2, View view, int i3, boolean z) {
    }

    public void onActivityCreated(@Nullable Bundle bundle) {
        super.onActivityCreated(bundle);
        try {
            this.audioEventManager = new AudioEventManager(this.mActivity);
        } catch (Exception unused) {
        }
        if (getActivity() != null) {
            if (this.mOttAnalytics == null) {
                this.mOttAnalytics = YuppAnalytics.getInstance(getActivity());
            }
            if (UiUtils.showChromeCast ? Utils.checkPlayServices(getActivity()) : false) {
                CastButtonFactory.setUpMediaRouteButton(getActivity(), this.mMediaRouteButton);
                this.mc = CastContext.getSharedInstance(getActivity());
                CastStateListener castStateListener = getCastStateListener();
                this.mCastStateListener = castStateListener;
                this.mc.addCastStateListener(castStateListener);
                this.mc.getCastOptions().getEnableReconnectionService();
            }
        }
    }

    public void onAttach(Context context) {
        super.onAttach(context);
        if (getActivity() != null) {
            this.mActivity = getActivity();
        }
    }

    public void onAttachFragment(Fragment fragment) {
        super.onAttachFragment(fragment);
    }

    public void onAudioAttributesChanged(AudioAttributes audioAttributes) {
        u2.a(this, audioAttributes);
    }

    public void onAudioSessionIdChanged(int i2) {
        u2.b(this, i2);
    }

    public void onAvailableCommandsChanged(Player.Commands commands) {
        u2.c(this, commands);
    }

    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        OTTApplication.playerPresent = true;
        if (this.container != null && Build.VERSION.SDK_INT >= 35) {
            if (getActivity().getResources().getConfiguration().orientation != 1) {
                this.container.setPadding(100, 0, 0, 0);
            } else {
                this.container.setPadding(0, 0, 0, 0);
            }
        }
        if (!UiUtils.showLandscapePlayer && this.mForeground && isVisible() && !this.navigatoToDetailsPage) {
            updatePlayerScreen(false);
            FixedAspectRatioRelativeLayout fixedAspectRatioRelativeLayout = this.bgFixedAspectRL;
            if (fixedAspectRatioRelativeLayout != null && fixedAspectRatioRelativeLayout.getVisibility() == 0 && (getActivity() instanceof FusionViliteMainActivity)) {
                getActivity().showSystemUI();
                this.bgFixedAspectRL.requestLayout();
            }
        } else if (this.navigatoToDetailsPage) {
            getActivity().showSystemUI();
        }
        this.navigatoToDetailsPage = false;
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.shouldAutoPlay = true;
        this.fragmentManager = getFragmentManager();
        CookieHandler cookieHandler = CookieHandler.getDefault();
        CookieManager cookieManager = DEFAULT_COOKIE_MANAGER;
        if (cookieHandler != cookieManager) {
            CookieHandler.setDefault(cookieManager);
        }
    }

    @Nullable
    @SuppressLint({"CommitTransaction"})
    public View onCreateView(LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
        this.container = layoutInflater.inflate(R.layout.exoplayer, viewGroup, false);
        setHasOptionsMenu(true);
        this.mPlayerBundle = new Bundle();
        hideSubtitles();
        setPlayerView(this.container);
        this.volumeLevelText = (TextView) this.container.findViewById(R.id.app_video_volume);
        this.volumeSeekbar = (VerticalSeekBar) this.container.findViewById(R.id.volume_seek_bar);
        this.playerController = (RelativeLayout) this.container.findViewById(R.id.parent_controller);
        this.error_text_view = (TextView) this.container.findViewById(R.id.error_text_view);
        this.waterMark = (ImageView) this.container.findViewById(R.id.water_mark);
        this.trailer_muteButton = (ImageView) this.container.findViewById(R.id.trailer_muteButton);
        this.waterMarkRelativeLayout = (RelativeLayout) this.container.findViewById(R.id.waterMarkRelativeLayout);
        this.freeErrorEpisodePopup = (RelativeLayout) this.container.findViewById(R.id.subscribe_view);
        this.subscribe_btn = this.container.findViewById(R.id.free_ep_subscribe_button);
        this.free_episode_details_TV = (TextView) this.container.findViewById(R.id.free_episode_details_TV);
        this.titleTV = (TextView) this.container.findViewById(R.id.free_episode_title_TV);
        this.mOrientationUtils = new OrientationUtils(getActivity());
        this.mCastLayout = (FrameLayout) this.container.findViewById(R.id.chromecast_fragment);
        MediaRouteButton findViewById = this.container.findViewById(R.id.media_route_button);
        this.mMediaRouteButton = findViewById;
        findViewById.setVisibility(8);
        try {
            if (getActivity() != null) {
                CastContext.getSharedInstance(getActivity());
            }
        } catch (Exception unused) {
        }
        this.shouldRestorePosition = false;
        this.mNextVideoGoLive = (TextView) this.container.findViewById(R.id.nextlayout_goliveButton);
        this.mReplayGoLive = (TextView) this.container.findViewById(R.id.playend_goliveButton);
        this.mNextVideoGoLive.setOnClickListener(this.onclick);
        this.mReplayGoLive.setOnClickListener(this.onclick);
        this.mNextVideoLayout = (RelativeLayout) this.container.findViewById(R.id.next_video_layout);
        this.mNextVideoImage = (ImageView) this.container.findViewById(R.id.next_video_image);
        this.mComingUpText = (TextView) this.container.findViewById(R.id.next_video_title);
        this.mComingUpTextTitle = (TextView) this.container.findViewById(R.id.comingup_text);
        this.player_forward_icon = (Forward) this.container.findViewById(R.id.player_forward_icon);
        this.player_rewind_icon = (Rewind) this.container.findViewById(R.id.player_rewind_icon);
        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.player_forward_icon.getLayoutParams();
        Resources resources = this.player_forward_icon.getContext().getResources();
        int i2 = R.dimen._60sdp;
        layoutParams.setMargins((int) resources.getDimension(i2), 0, 0, 0);
        this.player_forward_icon.setLayoutParams(layoutParams);
        LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) this.player_rewind_icon.getLayoutParams();
        layoutParams2.setMargins(0, 0, (int) this.player_rewind_icon.getContext().getResources().getDimension(i2), 0);
        this.player_rewind_icon.setLayoutParams(layoutParams2);
        this.mNextVideoDescription = (TextView) this.container.findViewById(R.id.autoPlayDescription);
        this.mNextVideoPlayIcon = (ImageView) this.container.findViewById(R.id.playImage);
        this.mNextVideoReplay = (LinearLayout) this.container.findViewById(R.id.autoplay_replay);
        this.mNextVideoCloseIcon = (ImageView) this.container.findViewById(R.id.nextvideo_close);
        this.player_bottom_buttons_layout = (LinearLayout) this.container.findViewById(R.id.audiovideosubtitlelayout);
        LinearLayout linearLayout = (LinearLayout) this.container.findViewById(R.id.landcontainer);
        this.seekbarContainer = linearLayout;
        RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) linearLayout.getLayoutParams();
        layoutParams3.addRule(12);
        this.seekbarContainer.setLayoutParams(layoutParams3);
        this.mNextVideoLayout.setOnClickListener(this.onclick);
        this.mNextVideoLayout.setVisibility(8);
        LinearLayout linearLayout2 = (LinearLayout) this.container.findViewById(R.id.episodesLL);
        this.episodesLL = linearLayout2;
        if (!this.isLive && this.recommendationCards != null) {
            linearLayout2.setVisibility(0);
        }
        this.episodesLL.setOnClickListener(this.onclick);
        ImageView imageView = (ImageView) this.container.findViewById(R.id.dropIcon_seasons);
        this.dropIcon_seasons = imageView;
        imageView.setTag(Integer.valueOf(R.drawable.down_arrow));
        this.button_season = (TextView) this.container.findViewById(R.id.button_season);
        this.relative_seasonui = (RelativeLayout) this.container.findViewById(R.id.relative_seasonui);
        this.recommendation_control_backbutton = (RelativeLayout) this.container.findViewById(R.id.recommendation_control_backbutton);
        this.backButton = (ImageView) this.container.findViewById(R.id.backButton);
        this.trailer_back_layout = (LinearLayout) this.container.findViewById(R.id.trailer_back_layout);
        this.backButton.setOnClickListener(this.onclick);
        this.trailer_muteButton.setOnClickListener(this.onclick);
        this.trailer_back_layout.setVisibility(8);
        this.trailer_muteButton.setVisibility(8);
        this.img_back = (ImageView) this.container.findViewById(R.id.img_back);
        ImageView imageView2 = (ImageView) this.container.findViewById(R.id.iV_Gradient_top);
        this.iV_Gradient_top = imageView2;
        imageView2.setVisibility(8);
        ImageView imageView3 = this.trailer_muteButton;
        if (imageView3 != null) {
            imageView3.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    ExoPlayerFragment.this.lambda$onCreateView$0(view);
                }
            });
        }
        this.relative_seasonui.setBackgroundResource(R.drawable.onclick_bg_spinner);
        RelativeLayout relativeLayout = this.relative_seasonui;
        if (relativeLayout != null) {
            relativeLayout.setOnClickListener(new AnonymousClass3(layoutInflater));
        }
        this.mNextVideoPlayIcon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                List<Card> cards;
                ExoPlayerFragment.this.updateNextVideoLayoutVisibility(false);
                ExoPlayerFragment.this.cancelNextVideoTimer();
                if (ExoPlayerFragment.this.getActivity() == null || ExoPlayerFragment.this.getActivity().isFinishing()) {
                    return;
                }
                new ArrayList();
                Section.SectionData sectionData = ExoPlayerFragment.this.mNextVideoObject;
                if (sectionData == null || (cards = sectionData.getCards()) == null || ExoPlayerFragment.this.mNextVideoObject.getCards().size() <= 0) {
                    ExoPlayerFragment.this.showReplayButton(true);
                } else {
                    NavigationUtils.performItemClickNavigation(null, ExoPlayerFragment.this.getActivity(), cards.get(0).getTarget().getPath(), "");
                }
            }
        });
        this.mNextVideoReplay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ExoPlayerFragment.this.updateNextVideoLayoutVisibility(false);
                ExoPlayerFragment.this.cancelNextVideoTimer();
                PlayerControlView playerControlView = ExoPlayerFragment.this.mPlayerControlView;
                if (playerControlView != null) {
                    playerControlView.trackEvents(AnalyticsUtils.EVENT_PLAYER, AnalyticsUtils.ATTRIBUTE_VALUE_REPLAY);
                }
                if (ExoPlayerFragment.this.mc.getCastState() != 4) {
                    ExoPlayerFragment.this.replayVideo();
                    return;
                }
                ExoPlayerFragment.this.isReplayClicked = true;
                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                exoPlayerFragment.startPlay(exoPlayerFragment.itemObject, exoPlayerFragment.seekPosition, ButtonType.NONE);
            }
        });
        this.mNextVideoCloseIcon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (ExoPlayerFragment.this.timer != null) {
                    ExoPlayerFragment.this.timer.cancel();
                }
                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                exoPlayerFragment.showNextVideo = false;
                exoPlayerFragment.hideNextVideo();
                if (ExoPlayerFragment.this.mc == null || ExoPlayerFragment.this.mc.getCastState() != 4) {
                    return;
                }
                ExoPlayerFragment.this.showChromeCast();
                ExoPlayerFragment.this.showReplayButton(true);
            }
        });
        ImageView imageView4 = (ImageView) this.container.findViewById(R.id.player_speed_icon);
        this.playerSpeedSettingsBtn = imageView4;
        imageView4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                PlayerControlView playerControlView = ExoPlayerFragment.this.mPlayerControlView;
                if (playerControlView != null) {
                    playerControlView.trackEvents(AnalyticsUtils.EVENT_PLAYER, AnalyticsUtils.ATTRIBUTE_VALUE_PLAYER_SPEED);
                }
                ExoPlayerFragment.this.showPlaybackSpeedsSelection();
            }
        });
        this.playerCaptionsBtn = (ImageView) this.container.findViewById(R.id.player_captions_icon);
        this.playerMultipleAudioSubtitleTracksBtn = (ImageView) this.container.findViewById(R.id.player_multiple_audio_subtitle_tracks);
        this.subtitleLayout = (LinearLayout) this.container.findViewById(R.id.subtitle_layout);
        this.audioLayout = (LinearLayout) this.container.findViewById(R.id.audio_layout);
        this.nextEpisodeLayout = (LinearLayout) this.container.findViewById(R.id.nextEpisodeLayout);
        this.access_layout = (LinearLayout) this.container.findViewById(R.id.access_layout);
        this.parent_access_layout = (RelativeLayout) this.container.findViewById(R.id.parent_access_layout);
        this.access_TV = (TextView) this.container.findViewById(R.id.getAccess_TV);
        LinearLayout linearLayout3 = (LinearLayout) this.container.findViewById(R.id.videoQuality_layout);
        this.videoQualitySettingsLayout = linearLayout3;
        linearLayout3.setVisibility(0);
        this.videoQualitySettingsLayout.setOnClickListener(this.onclick);
        this.playerLockBtn = (ImageView) this.container.findViewById(R.id.player_lock);
        this.playerUnLock = (ImageView) this.container.findViewById(R.id.player_unlock);
        ImageView imageView5 = (ImageView) this.container.findViewById(R.id.player_settings_icon);
        this.playerSettingsBtn = imageView5;
        imageView5.setVisibility(0);
        this.videoQualitySettingsLayout.setVisibility(0);
        this.playerFavouriteBtn = (ImageView) this.container.findViewById(R.id.favourite_icon);
        this.playerChatBtn = (ImageView) this.container.findViewById(R.id.chat_icon);
        this.playerRecordBtn = (ImageView) this.container.findViewById(R.id.player_record_icon);
        this.playerInfoBtn = (ImageView) this.container.findViewById(R.id.player_info_icon);
        this.takeTestButton = this.container.findViewById(R.id.takeTest_button);
        Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(getContext().getApplicationContext());
        this.takeTestButtonText = utilAppConfigurations.getTakeAtestButtonText() != null ? utilAppConfigurations.getTakeAtestButtonText() : "Take a Test";
        this.takeTestButton.setOnClickListener(this.onclick);
        this.playerRecordBtn.setOnClickListener(this.onclick);
        this.playerInfoBtn.setOnClickListener(this.onclick);
        this.playerSettingsBtn.setOnClickListener(this.onclick);
        this.playerFavouriteBtn.setOnClickListener(this.onclick);
        this.playerChatBtn.setOnClickListener(this.onclick);
        this.nextEpisodeLayout.setOnClickListener(this.onclick);
        this.playerLockBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                ExoPlayerFragment.this.lambda$onCreateView$1(view);
            }
        });
        this.playerUnLock.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                ExoPlayerFragment.this.lambda$onCreateView$2(view);
            }
        });
        this.playerCaptionsBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ExoPlayerFragment.this.eventCTPlayerAction("subtitles and audio");
                String contentTitle = MyRecoManager.getInstance().getContentTitle();
                StreamResponse streamResponse = ExoPlayerFragment.this.streamResponseObject;
                String contentType = (streamResponse == null || streamResponse.getAnalyticsInfo() == null) ? "" : ExoPlayerFragment.this.streamResponseObject.getAnalyticsInfo().getContentType();
                ExoPlayerFragment.this.trackEvent(AnalyticsV2.EVENT_PLAYER_CAPTIONS);
                if (ExoPlayerFragment.this.trackSelector != null) {
                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                    if (exoPlayerFragment.isCloseCaptionsAvailable) {
                        try {
                            if (exoPlayerFragment.trackSelector.getCurrentMappedTrackInfo() != null) {
                                ExoPlayerFragment.this.trackSelectionHelper.setDefaultCaptionsLanguage(ExoPlayerFragment.this.defaultCaptions);
                                ExoPlayerFragment.this.trackSelectionHelper.setDefaultAudioLanguage("en");
                                return;
                            }
                            return;
                        } catch (Exception unused2) {
                            return;
                        }
                    }
                    if (exoPlayerFragment.CCEnabled) {
                        Preferences.instance(exoPlayerFragment.getActivity()).enableCC("enableCC", false);
                        ExoPlayerFragment.this.trackSelectionHelper.disableCC();
                        ExoPlayerFragment.this.CCEnabled = false;
                        CleverTap.moviesEventSubtitleOnOff("Off", contentTitle, contentType);
                        PlayerControlView playerControlView = ExoPlayerFragment.this.mPlayerControlView;
                        if (playerControlView != null) {
                            playerControlView.trackEvents(AnalyticsUtils.EVENT_PLAYER, AnalyticsUtils.ATTRIBUTE_VALUE_SUBTITLES_OFF);
                        }
                        ExoPlayerFragment.this.playerCaptionsBtn.setImageDrawable(ExoPlayerFragment.this.getResources().getDrawable(R.drawable.ic_player_cc_off));
                        return;
                    }
                    exoPlayerFragment.trackSelectionHelper.setDefaultCaptionsLanguage(ExoPlayerFragment.this.defaultCaptions);
                    if (ExoPlayerFragment.this.trackSelectionHelper.enableCC(ExoPlayerFragment.this.trackSelector.getCurrentMappedTrackInfo(), ExoPlayerFragment.this)) {
                        Preferences.instance(ExoPlayerFragment.this.getActivity()).enableCC("enableCC", true);
                        ExoPlayerFragment.this.CCEnabled = true;
                        CleverTap.moviesEventSubtitleOnOff("On", contentTitle, contentType);
                        PlayerControlView playerControlView2 = ExoPlayerFragment.this.mPlayerControlView;
                        if (playerControlView2 != null) {
                            playerControlView2.trackEvents(AnalyticsUtils.EVENT_PLAYER, AnalyticsUtils.ATTRIBUTE_VALUE_SUBTITLES_ON);
                        }
                        ExoPlayerFragment.this.playerCaptionsBtn.setImageDrawable(ExoPlayerFragment.this.getResources().getDrawable(R.drawable.ic_player_cc_on));
                        TrackSelectionHelper trackSelectionHelper = ExoPlayerFragment.this.trackSelectionHelper;
                        FragmentActivity activity = ExoPlayerFragment.this.getActivity();
                        ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                        trackSelectionHelper.showSelectionDialog(activity, exoPlayerFragment2, "text", exoPlayerFragment2.trackSelector, 2, true);
                    }
                    ExoPlayerFragment.this.trackSelectionHelper.setDefaultAudioLanguage("en");
                }
            }
        });
        this.subtitleLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ExoPlayerFragment.this.mPlayerControlView.hide();
                ExoPlayerFragment.this.eventCTPlayerAction("subtitles");
                ExoPlayerFragment.this.trackEvent(AnalyticsV2.EVENT_PLAYER_CAPTIONS);
                if (ExoPlayerFragment.this.trackSelectionHelper != null) {
                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                    if (exoPlayerFragment.isCloseCaptionsAvailable) {
                        TrackSelectionHelper trackSelectionHelper = exoPlayerFragment.trackSelectionHelper;
                        FragmentActivity activity = ExoPlayerFragment.this.getActivity();
                        ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                        trackSelectionHelper.showSelectionDialog(activity, exoPlayerFragment2, "text", exoPlayerFragment2.trackSelector, 2, true);
                    }
                }
            }
        });
        this.audioLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                ExoPlayerFragment.this.lambda$onCreateView$3(view);
            }
        });
        ImageView imageView6 = (ImageView) this.container.findViewById(R.id.player_recommendations_icon);
        this.mPlayerRecommendationsIcon = imageView6;
        imageView6.setVisibility(8);
        this.mPlayerRecommendationsIcon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                if (exoPlayerFragment.relatedVideos_layout != null) {
                    Constants.is_playerRecommendationsIcon_clicked = false;
                    exoPlayerFragment.lastIndex = -1;
                    if (ExoPlayerFragment.this.relatedVideos_layout.getVisibility() == 0) {
                        ExoPlayerFragment.this.relatedVideos_layout.setVisibility(8);
                    } else {
                        ExoPlayerFragment.this.relatedVideos_layout.setVisibility(0);
                    }
                }
            }
        });
        ImageView imageView7 = (ImageView) this.container.findViewById(R.id.player_share_icon);
        this.playerShareBtn = imageView7;
        imageView7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (ExoPlayerFragment.this.getActivity() != null) {
                    FusionViliteMainActivity activity = ExoPlayerFragment.this.getActivity();
                    if (activity.isClicked()) {
                        return;
                    }
                    activity.setClicked(true);
                    activity.clickHandler.postDelayed(activity.isClickedRunnable, 1000L);
                    ExoPlayerFragment.this.share();
                }
            }
        });
        AppCompatButton findViewById2 = this.container.findViewById(R.id.verifyButton);
        this.verify_button = findViewById2;
        findViewById2.setVisibility(8);
        this.verify_button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AnalyticsV2.getInstance().trackEvent(AnalyticsV2.EVENT_PLAYER_OTP);
                if (ExoPlayerFragment.this.getActivity() != null) {
                    NavigationUtils.loadScreenActivityForResult(ExoPlayerFragment.this.getActivity(), ScreenType.OTP_VERIFY, NavigationConstants.NAV_FROM_PLAYER, (String) null, 9, "", "");
                }
            }
        });
        View findViewById3 = this.container.findViewById(R.id.mini_controls_container);
        this.mMiniControlsContainer = findViewById3;
        ImageView imageView8 = (ImageView) findViewById3.findViewById(R.id.play_button);
        this.mPlayButton = imageView8;
        imageView8.setOnClickListener(this.onclick);
        ImageView imageView9 = (ImageView) this.mMiniControlsContainer.findViewById(R.id.pause_button);
        this.mPauseButton = imageView9;
        imageView9.setOnClickListener(this.onclick);
        ImageView imageView10 = (ImageView) this.mMiniControlsContainer.findViewById(R.id.maximise_button);
        this.mMaximiseButton = imageView10;
        imageView10.setOnClickListener(this.onclick);
        ImageView imageView11 = (ImageView) this.mMiniControlsContainer.findViewById(R.id.replay_button);
        this.mReplayButton = imageView11;
        imageView11.setOnClickListener(this.onclick);
        ImageView imageView12 = (ImageView) this.mMiniControlsContainer.findViewById(R.id.close_button);
        this.mCloseButton = imageView12;
        imageView12.setOnClickListener(this.onclick);
        this.mPlayerHeaderLayout = (RelativeLayout) this.container.findViewById(R.id.player_header_layout);
        this.mPlayerHeaderBackIcon = (ImageView) this.container.findViewById(R.id.player_back_button);
        this.mPlayerHeaderIcon = (ImageView) this.container.findViewById(R.id.player_header_content_icon);
        this.mPlayerHeaderTitle = (TextView) this.container.findViewById(R.id.player_header_title);
        this.playerPortraitHeaderTitle = (TextView) this.container.findViewById(R.id.player_header_title_pot);
        this.playerPortraitHeaderSubTitle = (TextView) this.container.findViewById(R.id.player_header_subtitle_pot);
        this.mPlayerHeaderSubTitle = (TextView) this.container.findViewById(R.id.player_header_subtitle);
        LinearLayout linearLayout4 = (LinearLayout) this.container.findViewById(R.id.relatedvideos_layout);
        this.relatedVideos_layout = linearLayout4;
        linearLayout4.setVisibility(8);
        this.relatedVideos_layout_seasons = (LinearLayout) this.container.findViewById(R.id.relatedvideos_layout_episodes);
        this.relatedVideos_layout.setVisibility(8);
        if (!this.isLive) {
            this.relatedVideos_layout_seasons.setVisibility(8);
        }
        RecyclerView findViewById4 = this.container.findViewById(R.id.relatedvideosrecyclerview_episodes);
        this.relatedvideosrecyclerview_episodes = findViewById4;
        findViewById4.setHasFixedSize(false);
        this.relatedvideosrecyclerview_episodes.setRecycledViewPool(this.recycledViewPool);
        this.relatedvideosrecyclerview_episodes.addItemDecoration(new RowSpacingItemDecoration(0, 0, 25, 0, false));
        this.relatedvideosrecyclerview_episodes.setNestedScrollingEnabled(false);
        this.channel_suggestions = (LinearLayout) this.container.findViewById(R.id.landscape_recommendations);
        this.backLiveBottomCarousel = (LinearLayout) this.container.findViewById(R.id.back_live_bottom_carousel);
        this.mPlayerHeaderMarker = (TextView) this.container.findViewById(R.id.player_marker_tag);
        this.mPlayerHeaderBackIcon.setOnClickListener(this.onclick);
        this.mPlayerRecommendationsRightArrow = (ImageView) this.container.findViewById(R.id.player_recommendations_right_arrow);
        RecyclerView findViewById5 = this.container.findViewById(R.id.relatedvideosrecyclerview);
        this.relatedVideosRecyclerView = findViewById5;
        findViewById5.setHasFixedSize(false);
        this.relatedVideosRecyclerView.setRecycledViewPool(this.recycledViewPool);
        this.relatedVideosRecyclerView.addItemDecoration(new RowSpacingItemDecoration(0, 0, 25, 0, false));
        this.relatedVideosRecyclerView.setNestedScrollingEnabled(false);
        if (getActivity() != null) {
            this.linearLayoutManager = new LinearLayoutManager(getActivity(), 0, false);
        }
        if (getActivity() != null) {
            this.linearLayoutManager_seasons = new LinearLayoutManager(getActivity(), 0, false);
        }
        this.relatedVideosRecyclerView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
            @Override
            public void onScrollChange(View view, int i3, int i4, int i5, int i6) {
            }
        });
        this.relatedVideosRecyclerView.addOnScrollListener(new PaginationScrollListener(this.linearLayoutManager) {
            @Override
            public void onLoadMore(int i3, RecyclerView recyclerView) {
                if (ExoPlayerFragment.this.hasMoreData) {
                    int i4 = ExoPlayerFragment.this.lastIndex != -1 ? ExoPlayerFragment.this.lastIndex : i3 - 1;
                    ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                    exoPlayerFragment.loadMoreDataAPI(i4, exoPlayerFragment.sectionInfo.getSectionInfo().getCode());
                }
            }
        });
        RecyclerView recyclerView = this.relatedvideosrecyclerview_episodes;
        if (recyclerView != null) {
            recyclerView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
                @Override
                public void onScrollChange(View view, int i3, int i4, int i5, int i6) {
                }
            });
        }
        RecyclerView recyclerView2 = this.relatedvideosrecyclerview_episodes;
        if (recyclerView2 != null) {
            recyclerView2.addOnScrollListener(new PaginationScrollListener(this.linearLayoutManager_seasons) {
                @Override
                public void onLoadMore(int i3, RecyclerView recyclerView3) {
                    if (ExoPlayerFragment.this.hasMoreData) {
                        int i4 = ExoPlayerFragment.this.lastIndex != -1 ? ExoPlayerFragment.this.lastIndex : i3 - 1;
                        ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                        exoPlayerFragment.loadMoreDataAPI(i4, exoPlayerFragment.sectionInfo.getSectionInfo().getCode());
                    }
                }
            });
        }
        this.recommendationText = (TextView) this.container.findViewById(R.id.recommendations);
        this.relatedVideosRecyclerView.setLayoutManager(this.linearLayoutManager);
        if (!this.isLive && this.relatedVideos_layout_seasons != null) {
            this.relatedvideosrecyclerview_episodes.setLayoutManager(this.linearLayoutManager_seasons);
        }
        this.relatedVideosRecyclerView.setLayoutManager(this.linearLayoutManager);
        GridController gridController = new GridController(this, "Recommended for you", "Details");
        this.mGridAdapter = gridController;
        gridController.setFilterDuplicates(false);
        AppCompatButton findViewById6 = this.container.findViewById(R.id.player_replay);
        this.player_replay = findViewById6;
        findViewById6.setVisibility(8);
        this.player_replay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                exoPlayerFragment.isRelay = true;
                PlayerControlView playerControlView = exoPlayerFragment.mPlayerControlView;
                if (playerControlView != null) {
                    playerControlView.trackEvents(AnalyticsUtils.EVENT_PLAYER, AnalyticsUtils.ATTRIBUTE_VALUE_REPLAY);
                }
                if (ExoPlayerFragment.this.mc == null || !ExoPlayerFragment.this.isAdded()) {
                    if (UiUtils.isNetworkConnected(ExoPlayerFragment.this.getActivity())) {
                        ExoPlayerFragment.this.updateNextVideoLayoutVisibility(false);
                        ExoPlayerFragment.this.cancelNextVideoTimer();
                        ExoPlayerFragment.this.replayVideo();
                        return;
                    } else {
                        AppCompatButton appCompatButton = ExoPlayerFragment.this.player_replay;
                        if (appCompatButton != null) {
                            appCompatButton.setVisibility(8);
                        }
                        ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                        exoPlayerFragment2.initializePlayer(exoPlayerFragment2.mPlayerBundle);
                        return;
                    }
                }
                if (ExoPlayerFragment.this.mc.getCastState() == 4) {
                    ExoPlayerFragment.this.isReplayClicked = true;
                    ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                    exoPlayerFragment3.startPlay(exoPlayerFragment3.itemObject, exoPlayerFragment3.seekPosition, ButtonType.NONE);
                    return;
                }
                if (ExoPlayerFragment.this.getActivity() != null && ExoPlayerFragment.this.mc.getCastState() == 2 && !ExoPlayerFragment.this.getActivity().isSessionEnding) {
                    ExoPlayerFragment.this.getActivity().updateLocalPlayer();
                    return;
                }
                if (UiUtils.isNetworkConnected(ExoPlayerFragment.this.getActivity())) {
                    ExoPlayerFragment.this.updateNextVideoLayoutVisibility(false);
                    ExoPlayerFragment.this.cancelNextVideoTimer();
                    ExoPlayerFragment.this.replayVideo();
                } else {
                    AppCompatButton appCompatButton2 = ExoPlayerFragment.this.player_replay;
                    if (appCompatButton2 != null) {
                        appCompatButton2.setVisibility(8);
                    }
                    ExoPlayerFragment exoPlayerFragment4 = ExoPlayerFragment.this;
                    exoPlayerFragment4.initializePlayer(exoPlayerFragment4.mPlayerBundle);
                }
            }
        });
        if (getActivity() != null) {
            this.mPlayerControlView = new PlayerControlView(getActivity(), this.playerController, this);
        }
        this.mPlayerControlView.setListener(this);
        this.mPlayerControlView.hide();
        this.mPlayerControlView.setVisibilityListener(new PlayerControlView.VisibilityListener() {
            @Override
            public void onVisibilityChange(int i3) {
                ExoPlayerFragment.this.toggleCastButton();
            }
        });
        this.mTitleView = (TextView) this.container.findViewById(R.id.li_title);
        View view = this.container;
        int i3 = R.id.btn_next_startover;
        this.startOverBtn = view.findViewById(i3);
        this.live = (ImageView) this.container.findViewById(R.id.liveText);
        this.totalTime = (TextView) this.container.findViewById(R.id.total);
        View view2 = this.container;
        int i4 = R.id.current;
        TextView textView = (TextView) view2.findViewById(i4);
        this.currentTime = textView;
        RelativeLayout.LayoutParams layoutParams4 = (RelativeLayout.LayoutParams) textView.getLayoutParams();
        layoutParams4.removeRule(21);
        layoutParams4.removeRule(16);
        layoutParams4.removeRule(21);
        layoutParams4.addRule(20);
        layoutParams4.setMargins((int) this.totalTime.getResources().getDimension(R.dimen._15sdp), 0, 0, 0);
        this.currentTime.setLayoutParams(layoutParams4);
        RelativeLayout.LayoutParams layoutParams5 = (RelativeLayout.LayoutParams) this.totalTime.getLayoutParams();
        layoutParams5.removeRule(21);
        layoutParams5.removeRule(17);
        layoutParams5.removeRule(16);
        layoutParams5.removeRule(20);
        layoutParams5.addRule(17, i4);
        layoutParams5.setMargins(0, 0, 0, 0);
        this.totalTime.setLayoutParams(layoutParams5);
        this.mSubTitleView = (TextView) this.container.findViewById(R.id.li_subtitle);
        this.mBottomButton1 = this.container.findViewById(R.id.btn_last_ch);
        this.mBottomButton2 = this.container.findViewById(i3);
        this.skipIntroButton = this.container.findViewById(R.id.skipIntroButton);
        AppCompatButton findViewById7 = this.container.findViewById(R.id.nextEpisodeButton);
        this.nextEpisodeButton = findViewById7;
        findViewById7.setVisibility(8);
        this.nextEpisodeButton.setOnClickListener(this.onclick);
        this.watchCreditsFrameLayout = (FrameLayout) this.container.findViewById(R.id.watchCreditsFrameLayout);
        this.watchCreditsTv = (TextView) this.container.findViewById(R.id.watchCreditsTv);
        this.maturityRatingLayout = (RelativeLayout) this.container.findViewById(R.id.maturity_rating_layout);
        this.maturityRatingTitle = (TextView) this.container.findViewById(R.id.content_rating_title);
        this.maturityRatingDesc = (TextView) this.container.findViewById(R.id.content_rating_desc);
        this.nextEpisodeText = (TextView) this.container.findViewById(R.id.nextEpisodeText);
        this.btnZoomin = this.container.findViewById(R.id.btnZoomin);
        this.mBottomButton1.setOnClickListener(this.onclick);
        this.mBottomButton2.setOnClickListener(this.onclick);
        this.skipIntroButton.setOnClickListener(this.onclick);
        this.watchCreditsFrameLayout.setOnClickListener(this.onclick);
        this.btnZoomin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view3) {
                ExoPlayerFragment.this.eventCTPlayerAction("zoom in/out");
                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                if (exoPlayerFragment.isFill) {
                    exoPlayerFragment.isFill = false;
                    exoPlayerFragment.simpleExoPlayerView.setResizeMode(4);
                    ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                    exoPlayerFragment2.btnZoomin.setImageDrawable(exoPlayerFragment2.getActivity().getResources().getDrawable(R.drawable.pc_video_zoomout_icon));
                    return;
                }
                exoPlayerFragment.isFill = true;
                exoPlayerFragment.simpleExoPlayerView.setResizeMode(0);
                ExoPlayerFragment exoPlayerFragment3 = ExoPlayerFragment.this;
                exoPlayerFragment3.btnZoomin.setImageDrawable(exoPlayerFragment3.getActivity().getResources().getDrawable(R.drawable.pc_video_zoomin_icon));
            }
        });
        this.container.setVisibility(4);
        this.playerSpeedsList = getResources().getStringArray(R.array.player_speeds);
        this.playerSpeeds = getResources().getStringArray(R.array.player_speed_values);
        this.isKlikVideoViewSent = false;
        this.isKlikVideoImpressionSent = false;
        return this.container;
    }

    public void onCues(CueGroup cueGroup) {
        u2.d(this, cueGroup);
    }

    public void onCues(List list) {
        u2.e(this, list);
    }

    public void onDestroy() {
        releaseAdsLoader();
        super.onDestroy();
        unRegisterAudioFocus();
        removedStreamActiveSession();
    }

    public void onDestroyView() {
        super.onDestroyView();
        releasePlayer();
    }

    public void onDetach() {
        super.onDetach();
    }

    public void onDeviceInfoChanged(DeviceInfo deviceInfo) {
        u2.f(this, deviceInfo);
    }

    public void onDeviceVolumeChanged(int i2, boolean z) {
        u2.g(this, i2, z);
    }

    public void onDismissChromeCast() {
        if (getActivity() == null || !isAdded() || this.mCastLayout.getVisibility() != 0 || !isVisible() || this.isPlayerInitiated) {
            CustomLog.e("TAG", "onDismissChromeCast else: " + this.isPlayerInitiated);
            return;
        }
        AppCompatButton appCompatButton = this.player_replay;
        if (appCompatButton == null || appCompatButton.getVisibility() != 0) {
            removedStreamActiveSession();
            CustomLog.e("TAG", "onDismissChromeCast if: " + this.isPlayerInitiated);
            hideChromeCast();
            this.mMediaRouteButton.setRemoteIndicatorDrawable(getResources().getDrawable(R.drawable.quantum_ic_cast_connected_white_24));
            this.shouldAutoPlay = true;
            tooglePlayer(true);
            startPlay(this.itemObject, this.seekPosition, ButtonType.NONE);
        }
    }

    public void onDownstreamFormatChanged(int i2, @Nullable MediaSource.MediaPeriodId mediaPeriodId, MediaLoadData mediaLoadData) {
        CustomLog.e("Ads ::", "onDownstreamFormatChanged");
    }

    public void onEvents(Player player, Player.Events events) {
        u2.h(this, player, events);
    }

    @Override
    public void onHeaderClicked(Object obj, int i2) {
    }

    public void onIsLoadingChanged(boolean z) {
        u2.i(this, z);
    }

    public void onIsPlayingChanged(boolean z) {
        ExoPlayer exoPlayer;
        if (z && (exoPlayer = this.player) != null && exoPlayer.getVideoFormat() != null) {
            int round = Math.round((this.player.getVideoFormat().bitrate / 1000000.0f) * 1024.0f);
            YuppAnalytics yuppAnalytics = this.mOttAnalytics;
            if (yuppAnalytics != null) {
                yuppAnalytics.setBitrate(round);
            }
            YuppPlayerExoAnalyticsInterface yuppPlayerExoAnalyticsInterface = this.mYuppPlayerExoAnalyticsInterface;
            if (yuppPlayerExoAnalyticsInterface != null) {
                yuppPlayerExoAnalyticsInterface.updateBitrate(round);
            }
        }
        YuppPlayerExoAnalyticsInterface yuppPlayerExoAnalyticsInterface2 = this.mYuppPlayerExoAnalyticsInterface;
        if (yuppPlayerExoAnalyticsInterface2 != null) {
            yuppPlayerExoAnalyticsInterface2.onPlayWhenReadyChanged(z, this.playBackState);
        }
    }

    @Override
    public void onItemClicked(String str, Object obj, int i2) {
        Card card;
        BottomSheetBehavior<LinearLayout> bottomSheetBehavior;
        BottomSheetBehavior<LinearLayout> bottomSheetBehavior2;
        if (obj instanceof Card) {
            card = (Card) obj;
            if (card != null) {
                if (card.getTarget().getPath().equalsIgnoreCase(getActivity().currentItemtargerPath)) {
                    if (this.relatedVideos_layout.getVisibility() == 0 && this.isLive && (bottomSheetBehavior2 = this.bottomSheetBehavior) != null) {
                        bottomSheetBehavior2.setState(4);
                        this.relatedVideos_layout.setVisibility(8);
                        return;
                    } else if (this.relatedVideos_layout_seasons.getVisibility() == 0 && !this.isLive) {
                        this.relatedVideos_layout_seasons.setVisibility(8);
                        return;
                    }
                }
                if (this.relatedVideos_layout.getVisibility() == 0 && this.isLive && (bottomSheetBehavior = this.bottomSheetBehavior) != null) {
                    bottomSheetBehavior.setState(4);
                }
                if (card.getTarget().getPageType().equalsIgnoreCase("details")) {
                    this.navigatoToDetailsPage = true;
                }
            }
        } else {
            card = null;
        }
        this.mPlayerControlView.trackEvents(AnalyticsUtils.EVENT_PLAYER_RECOMMENDATIONS, AnalyticsUtils.ATTRIBUTE_VALUE_RECOMMENDATIONS, obj);
        if (!this.navigatoToDetailsPage) {
            this.mPlayerControlView.showProgress(true);
        }
        if (getActivity() instanceof FusionViliteMainActivity) {
            getActivity().setPlayerScreenSource(AnalyticsUtils.ATTRIBUTE_VALUE_RECOMMENDATIONS);
            OTTApplication.item = obj;
            getActivity().setButtonType(ButtonType.NONE);
            getActivity().goToDetail(obj);
        }
        MyRecoManager.getInstance().setSourceForAnalytics("player recommendations");
        MyRecoManager.getInstance().setSubSourceDetailsForAnalytics("recommendations");
        if (card == null || card.getTarget() == null || card.getTarget().getPath() == null || !card.getTarget().getPath().contains("show")) {
            MyRecoManager.getInstance().setSourceDetailsForAnalytics("browse more");
        } else {
            MyRecoManager.getInstance().setSourceDetailsForAnalytics("browse episodes");
        }
        if (getActivity() != null) {
            CleverTap.moviesEventCTItemClick("", getActivity(), obj, "thumbnail", "na", "na");
        }
        if (this.relatedVideos_layout.getVisibility() == 0 && this.isLive) {
            this.relatedVideos_layout.setVisibility(8);
        }
        if (this.relatedVideos_layout_seasons.getVisibility() == 0 && !this.isLive) {
            this.relatedVideos_layout_seasons.setVisibility(8);
        }
        this.relative_seasonui.setVisibility(8);
        this.recommendation_control_backbutton.setVisibility(8);
    }

    public void onLoadCanceled(int i2, @Nullable MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) {
        CustomLog.e("Ads ::", "onLoadCanceled");
    }

    public void onLoadCompleted(int i2, @Nullable MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) {
        CustomLog.e("Ads ::", "onLoadCompleted");
    }

    public void onLoadError(int i2, @Nullable MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData, IOException iOException, boolean z) {
        CustomLog.e("Ads ::", "onLoadError");
    }

    public void onLoadStarted(int i2, @Nullable MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) {
        CustomLog.e("Ads ::", "onLoadStarted");
    }

    public void onLoadingChanged(boolean z) {
    }

    public void onMaxSeekToPreviousPositionChanged(long j) {
        u2.l(this, j);
    }

    public void onMediaItemTransition(MediaItem mediaItem, int i2) {
        u2.m(this, mediaItem, i2);
    }

    public void onMediaMetadataChanged(MediaMetadata mediaMetadata) {
        u2.n(this, mediaMetadata);
    }

    public void onMetadata(Metadata metadata) {
        u2.o(this, metadata);
    }

    public void onPause() {
        super.onPause();
        if (!isAdded() || Util.SDK_INT > 23 || getActivity() == null || getActivity().getPlayerCurrentState() <= 0) {
            return;
        }
        this.isComingFromBackground = false;
        this.isPauseByUser = false;
        if (this.player != null) {
            if (getActivity() != null && this.isvolumeChangeReceiverRegistered) {
                getActivity().unregisterReceiver(this.volumeChangeReceiver);
                this.isvolumeChangeReceiverRegistered = false;
            }
            ExoPlayer exoPlayer = this.player;
            if (exoPlayer == null || !exoPlayer.getPlayWhenReady()) {
                this.isPauseByUser = true;
            }
        }
        this.isPlayerAutoPaused = true;
        tooglePlayer(false);
        releaseAnalytics();
        CountDownTimer countDownTimer = this.timer;
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
        this.timer = null;
    }

    public void onPlayWhenReadyChanged(boolean z, int i2) {
        VideoListener videoListener;
        this.isPlayerReady = z;
        this.reason = i2;
        if (z) {
            registerAudioFocus();
        }
        if (this.playBackState == 3) {
            if (z) {
                CustomLog.d("sravani", "onPlayWhenReadyChanged " + z);
                this.sessionStartTime = System.currentTimeMillis();
                CustomLog.d("sravani", "play " + TimeUnit.MILLISECONDS.toSeconds(this.totalPlaytime));
            } else {
                CustomLog.d("sravani", "onPlayWhenReadyChanged " + z);
                if (this.sessionStartTime > 0) {
                    long currentTimeMillis = this.totalPlaytime + (System.currentTimeMillis() - this.sessionStartTime);
                    this.totalPlaytime = currentTimeMillis;
                    this.sessionStartTime = 0L;
                    CustomLog.d("sravani", "pause " + TimeUnit.MILLISECONDS.toSeconds(currentTimeMillis));
                }
            }
        }
        YuppPlayerExoAnalyticsInterface yuppPlayerExoAnalyticsInterface = this.mYuppPlayerExoAnalyticsInterface;
        if (yuppPlayerExoAnalyticsInterface != null) {
            yuppPlayerExoAnalyticsInterface.onPlayWhenReadyChanged(z, this.playBackState);
            this.mYuppPlayerExoAnalyticsInterface.onPlaybackStateChanged(this.playBackState);
        }
        if (FusionViliteMainActivity.enterPIPMode && !z && (videoListener = this.mVideoListener) != null) {
            videoListener.onVideoStopped();
        }
        if (i2 == 4) {
            if (FusionViliteMainActivity.enterPIPMode && MyRecoManager.getInstance().getContentType().equalsIgnoreCase("movies")) {
                ((FusionViliteMainActivity) getActivity()).moveTaskToBack(false);
                this.shouldRemainUnPIPMode = true;
                OTTApplication.IS_PLAYER_SCREEN_LOCKED = false;
            }
            if (this.showNextVideo) {
                this.isAutoPlay = "true";
                playNextVideo();
            } else {
                showReplayLayout();
            }
        }
        if (i2 == 3) {
            if (this.player != null) {
                CustomLog.e(TAG, "Max dvr time " + this.player.getDuration());
            }
            Constants.IS_LAST_CHANNEL = Boolean.FALSE;
            this.isAutoPlay = "false";
            if (this.isStartOverClicked) {
                this.isStartOverClicked = false;
            }
            ButtonType buttonType = this.mButtonType;
            if (buttonType != null && buttonType == ButtonType.START_OVER && this.isOverlayStartOver) {
                this.isOverlayStartOver = false;
                showStartOverDialog();
            }
            if (this.isInitPlay) {
                this.isInitPlay = false;
                OttLog.error("isInitPlay", "++++++" + this.isLive);
                this.mPlayerControlView.showLiveText(this.isLive);
            }
            this.waterMark.setVisibility(8);
            TrackSelectionHelper trackSelectionHelper = this.trackSelectionHelper;
            if (trackSelectionHelper != null) {
                if (this.CCEnabled) {
                    trackSelectionHelper.setDefaultCaptionsLanguage(this.defaultCaptions);
                    if (this.trackSelectionHelper.enableCC(this.trackSelector.getCurrentMappedTrackInfo(), this)) {
                        this.CCEnabled = true;
                        if (getActivity() != null && !getActivity().isFinishing()) {
                            this.playerCaptionsBtn.setImageDrawable(getActivity().getResources().getDrawable(R.drawable.ic_player_cc_on));
                        }
                    }
                } else {
                    trackSelectionHelper.disableCC();
                    this.CCEnabled = false;
                    this.playerCaptionsBtn.setImageDrawable(this.mActivity.getResources().getDrawable(R.drawable.ic_player_cc_off));
                }
                this.trackSelectionHelper.setDefaultAudioLanguage("en");
            }
            if (this.sessionInfo != null) {
                if (this.navigationToPackage) {
                    this.navigationToPackage = false;
                    sendStreamPlayerStatus(ConcurrentStreamStatus.POLL);
                }
                intiateStreamPollHandler();
            }
            if (getActivity() == null || !getActivity().signinPopupVisible) {
                return;
            }
            tooglePlayer(false);
        }
    }

    public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
    }

    public void onPlaybackStateChanged(int i2) {
        YuppAnalytics yuppAnalytics;
        YuppPlayerExoAnalyticsInterface yuppPlayerExoAnalyticsInterface;
        YuppPlayerExoAnalyticsInterface yuppPlayerExoAnalyticsInterface2;
        this.playBackState = i2;
        this.klikkAnalyticsSessionId = generateRandomStringByUUID();
        if (!this.isPlayingAd && !this.isKlikVideoImpressionSent) {
            handleKlikkAnalytics("video_impression");
        }
        if (this.player != null && (yuppPlayerExoAnalyticsInterface2 = this.mYuppPlayerExoAnalyticsInterface) != null) {
            yuppPlayerExoAnalyticsInterface2.onPlayWhenReadyChanged(this.isPlayerReady, this.reason);
            this.mYuppPlayerExoAnalyticsInterface.onPlaybackStateChanged(i2);
        }
        if (i2 == 4) {
            this.totalTime.setVisibility(8);
            this.currentTime.setVisibility(8);
            Constants.IS_STATE_END = true;
            Constants.IS_READY = false;
            getActivity().mWatchWhileLayout.isPlayerInStateReady = false;
            callRecoEvent();
            if (this.player != null && (yuppPlayerExoAnalyticsInterface = this.mYuppPlayerExoAnalyticsInterface) != null) {
                yuppPlayerExoAnalyticsInterface.onPlaybackStateChanged(i2);
            }
            if (FusionViliteMainActivity.enterPIPMode && !TextUtils.isEmpty(MyRecoManager.getInstance().getContentType()) && MyRecoManager.getInstance().getContentType().equalsIgnoreCase("movies")) {
                ((FusionViliteMainActivity) getActivity()).moveTaskToBack(false);
                this.shouldRemainUnPIPMode = true;
                OTTApplication.IS_PLAYER_SCREEN_LOCKED = false;
            }
            if (this.isTrailer) {
                ContentPage contentPage = this.contentPageItem;
                if (contentPage == null || contentPage.getPageInfo() == null || this.contentPageItem.getPageInfo().getAttributes() == null || this.contentPageItem.getPageInfo().getAttributes().getContentAccessible()) {
                    this.isTrailer = false;
                } else {
                    Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(requireContext());
                    if (utilAppConfigurations != null && !TextUtils.isEmpty(utilAppConfigurations.getTrailerSubscriptionOverlay())) {
                        this.dialogType = utilAppConfigurations.getTrailerSubscriptionOverlay();
                    }
                    if (!TextUtils.isEmpty(this.contentPageItem.getPageInfo().getPath())) {
                        this.path = this.contentPageItem.getPageInfo().getPath();
                    }
                    this.imgBackIV.setVisibility(8);
                    this.iV_Gradient_top.setVisibility(8);
                    this.trailer_back_layout.setVisibility(8);
                    this.trailer_muteButton.setVisibility(8);
                    ShowFreeEpisodeError(this.dialogType, this.path, "trailer subscription overlay");
                    eventCTVideoStopped();
                }
                this.bg_image = this.contentPageItem.getPageData().get(0).getContent().getBackgroundImage();
                this.background_image.setImageResource(R.drawable.default_banner);
                setBackgroundImage(this.bg_image, true);
                if (getActivity().getResources().getConfiguration().orientation != 1) {
                    this.mOrientationUtils.shrinkToPotraitMode();
                }
            } else if (this.showNextVideo) {
                this.isAutoPlay = "true";
                playNextVideo();
            } else {
                showReplayLayout();
            }
        }
        if (i2 == 3) {
            if (this.isTrailer && this.player != null) {
                this.trailer_muteButton.setVisibility(0);
            }
            if (!this.isTrailer) {
                getActivity().mWatchWhileLayout.isPlayerInStateReady = true;
            }
            AudioManager audioManager = getActivity() != null ? (AudioManager) getActivity().getSystemService("audio") : null;
            if (audioManager != null) {
                int streamVolume = audioManager.getStreamVolume(3);
                int streamMaxVolume = audioManager.getStreamMaxVolume(3);
                if (this.mMaxVolume == 0) {
                    this.mMaxVolume = streamMaxVolume;
                }
                updateVolumeUI(streamVolume);
            }
            if (this.isLive) {
                this.totalTime.setVisibility(8);
                this.currentTime.setVisibility(8);
            } else {
                this.totalTime.setVisibility(0);
                this.currentTime.setVisibility(0);
                OTTApplication.is_refresh_continue_watching = true;
            }
            if (!this.isTrailer && !OTTApplication.isContentPlayed) {
                OTTApplication.isContentPlayed = true;
            }
            if (!this.isDistroVideoImpressionSent && !TextUtils.isEmpty(this.streamType) && this.streamType.equalsIgnoreCase("distro")) {
                this.isDistroVideoImpressionSent = true;
                handleDistroPixelAnalytics("vplay");
            }
            ExoPlayer exoPlayer = this.player;
            if (exoPlayer != null && !exoPlayer.isPlayingAd() && (yuppAnalytics = this.mOttAnalytics) != null && !this.isLive) {
                yuppAnalytics.setTotalDuration(this.player.getDuration() > 0 ? this.player.getDuration() : -1L);
            }
            if (this.player != null) {
                CustomLog.e(TAG, "Max dvr time " + this.player.getDuration());
            }
            ExoPlayer exoPlayer2 = this.player;
            boolean z = exoPlayer2 != null && exoPlayer2.getPlayWhenReady();
            this.carousalName = MyRecoManager.getInstance().getCarouselTitle();
            this.carousalPosition = MyRecoManager.getInstance().getCarouselPosition();
            this.contentPosition = MyRecoManager.getInstance().getContentPosition();
            this.playTargetPath = MyRecoManager.getInstance().getTargetPath();
            this.tabName = getActivity().bottomTabSelected;
            this.trackingId = MyRecoManager.getInstance().getTRACKING_ID();
            this.originSource = (MyRecoManager.getInstance().getOriginSource() == null || MyRecoManager.getInstance().getOriginSource().isEmpty()) ? "AppOpen" : MyRecoManager.getInstance().getOriginSource();
            this.originMedium = (MyRecoManager.getInstance().getOriginMedium() == null || MyRecoManager.getInstance().getOriginMedium().isEmpty()) ? "carousel" : MyRecoManager.getInstance().getOriginMedium();
            if (MyRecoManager.getInstance().getRecommendationTabName() != null && !MyRecoManager.getInstance().getRecommendationTabName().isEmpty()) {
                this.tabName = MyRecoManager.getInstance().getRecommendationTabName();
            }
            Constants.IS_LAST_CHANNEL = Boolean.FALSE;
            this.isAutoPlay = "false";
            if (z) {
                CustomLog.e("sravani", "isplaying");
                this.sessionStartTime = System.currentTimeMillis();
            }
            if (this.isStartOverClicked) {
                this.isStartOverClicked = false;
            }
            ButtonType buttonType = this.mButtonType;
            if (buttonType != null && buttonType == ButtonType.START_OVER && this.isOverlayStartOver) {
                this.isOverlayStartOver = false;
                showStartOverDialog();
            }
            this.waterMark.setVisibility(8);
            TrackSelectionHelper trackSelectionHelper = this.trackSelectionHelper;
            if (trackSelectionHelper == null) {
                trackSelectionHelper.disableCC();
                this.CCEnabled = false;
                this.playerCaptionsBtn.setImageDrawable(this.mActivity.getResources().getDrawable(R.drawable.ic_player_cc_off));
            } else if (this.CCEnabled) {
                trackSelectionHelper.setDefaultCaptionsLanguage(this.defaultCaptions);
                if (this.trackSelectionHelper.enableCC(this.trackSelector.getCurrentMappedTrackInfo(), this)) {
                    if (TextUtils.isEmpty(this.defaultCaptions)) {
                        TrackGroupArray trackGroups = this.trackSelector.getCurrentMappedTrackInfo().getTrackGroups(2);
                        for (int i3 = 0; i3 < trackGroups.length; i3++) {
                            TrackGroup trackGroup = trackGroups.get(i3);
                            for (int i4 = 0; i4 < trackGroup.length; i4++) {
                                Format format = trackGroup.getFormat(i4);
                                if (format != null && format.language != null) {
                                    this.trackSelectionHelper.getLangugagesList();
                                    this.defaultCaptions = this.trackSelectionHelper.getLanguageFullName(format.language);
                                }
                            }
                        }
                    }
                    this.CCEnabled = true;
                    if (getActivity() != null && !getActivity().isFinishing()) {
                        this.playerCaptionsBtn.setImageDrawable(getActivity().getResources().getDrawable(R.drawable.ic_player_cc_on));
                    }
                } else if (!this.isAudioTrackAvailable && !this.isCloseCaptionsAvailable) {
                    this.subtitleLayout.setVisibility(8);
                    this.audioLayout.setVisibility(8);
                }
                if (this.isAudioTrackAvailable) {
                    this.trackSelectionHelper.setDefaultAudioLanguage(this.preference.getDefaultLanguageCode());
                } else {
                    MyRecoManager.getInstance().setSelectedAudioLanguage("");
                }
            }
            if (this.isInitPlay) {
                this.isInitPlay = false;
                OttLog.error("isInitPlay", "++++++" + this.isLive);
                this.mPlayerControlView.showLiveText(this.isLive);
                startShowingContentRating();
                eventCTVideoStarted();
            }
            if (this.sessionInfo != null) {
                if (this.navigationToPackage) {
                    this.navigationToPackage = false;
                    sendStreamPlayerStatus(ConcurrentStreamStatus.POLL);
                }
                intiateStreamPollHandler();
            }
            if (getActivity() != null && getActivity().signinPopupVisible) {
                tooglePlayer(false);
            }
            if (!this.isPlayingAd && !this.isKlikVideoViewSent) {
                handleKlikkAnalytics("video_view");
            }
        }
        if (i2 == 2) {
            CustomLog.d("sravani", "buffering " + TimeUnit.MILLISECONDS.toSeconds(this.totalPlaytime));
            ExoPlayer exoPlayer3 = this.player;
            boolean z2 = exoPlayer3 != null && exoPlayer3.getPlayWhenReady();
            if (this.sessionStartTime > 0 && z2) {
                this.totalPlaytime += System.currentTimeMillis() - this.sessionStartTime;
                this.sessionStartTime = 0L;
            }
        }
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                if (exoPlayerFragment.isAudioTrackAvailable) {
                    exoPlayerFragment.trackSelectionHelper.setDefaultAudioLanguage(ExoPlayerFragment.this.preference.getDefaultLanguageCode());
                } else {
                    MyRecoManager.getInstance().setSelectedAudioLanguage("");
                }
            }
        }, 1000L);
    }

    public void onPlaybackSuppressionReasonChanged(int i2) {
        u2.s(this, i2);
    }

    @SuppressLint({"StringFormatInvalid"})
    public void onPlayerError(PlaybackException playbackException) {
        int i2;
        YuppPlayerExoAnalyticsInterface yuppPlayerExoAnalyticsInterface = this.mYuppPlayerExoAnalyticsInterface;
        if (yuppPlayerExoAnalyticsInterface != null) {
            yuppPlayerExoAnalyticsInterface.updateError(playbackException.getCause().getMessage());
        }
        ExoPlayer exoPlayer = this.player;
        if (exoPlayer != null) {
            exoPlayer.isPlayingAd();
        }
        callRecoEvent();
        ExoPlaybackException exoPlaybackException = (ExoPlaybackException) playbackException;
        if (isBehindLiveWindow(exoPlaybackException)) {
            this.player.seekToDefaultPosition();
            this.player.prepare();
            return;
        }
        if (exoPlaybackException.type == 1) {
            MediaCodecRenderer.DecoderInitializationException rendererException = exoPlaybackException.getRendererException();
            if (rendererException instanceof MediaCodecRenderer.DecoderInitializationException) {
                MediaCodecRenderer.DecoderInitializationException decoderInitializationException = rendererException;
                if (getActivity() != null && isAdded()) {
                    if (decoderInitializationException.diagnosticInfo != null) {
                        getActivity().getResources().getString(R.string.error_instantiating_decoder, decoderInitializationException.diagnosticInfo);
                    } else if (decoderInitializationException.getCause() instanceof MediaCodecUtil.DecoderQueryException) {
                        getActivity().getResources().getString(R.string.error_querying_decoders);
                    } else if (decoderInitializationException.secureDecoderRequired) {
                        getActivity().getResources().getString(R.string.error_no_secure_decoder, decoderInitializationException.mimeType);
                    } else {
                        getActivity().getResources().getString(R.string.error_no_decoder, decoderInitializationException.mimeType);
                        if (Build.VERSION.SDK_INT >= 30) {
                            this.playAdsError = true;
                            this.shouldRestorePosition = true;
                            this.playerPosition = this.mPlayerControlView.playerPosition;
                            Bundle bundle = this.mPlayerBundle;
                            if (bundle == null || (i2 = this.count_of_retry) > 0) {
                                return;
                            }
                            this.count_of_retry = i2 + 1;
                            this.playAds = false;
                            initializePlayer(bundle);
                            return;
                        }
                    }
                }
            }
        }
        PlayerControlView playerControlView = this.mPlayerControlView;
        if (playerControlView != null) {
            playerControlView.resetSeekbar();
            this.mPlayerControlView.removeCallbacks();
        }
        updateResumePosition();
        this.player = null;
        this.needRetrySource = true;
        this.isTrailer = false;
        if (getActivity() != null && playbackException.getCause() != null && playbackException.getCause().getMessage() != null && isAdded()) {
            if (!NetworkUtils.isConnected(getActivity())) {
                showError(true, getActivity().getResources().getString(R.string.unable_to_connect_to_internet));
            } else if (playbackException.getCause().getMessage().contains("http") || playbackException.getCause().getMessage().contains("NullPointerException")) {
                showError(true, getActivity().getResources().getString(R.string.unable_to_connect_stream));
            } else {
                showError(true, playbackException.getCause().getMessage());
            }
        }
        try {
            if (this.mCastLayout != null) {
                hideChromeCast();
                this.mCastLayout.setVisibility(4);
            }
        } catch (Exception unused) {
        }
    }

    public void onPlayerErrorChanged(@Nullable PlaybackException playbackException) {
        releasePlayerAtUnknownException();
    }

    public void onPlayerStateChanged(boolean z, int i2) {
        u2.v(this, z, i2);
    }

    public void onPlaylistMetadataChanged(MediaMetadata mediaMetadata) {
        u2.w(this, mediaMetadata);
    }

    public void onPositionDiscontinuity(int i2) {
        if (this.needRetrySource) {
            updateResumePosition();
        }
        if (i2 == 1) {
            CustomLog.e("Seek proccesed", "++++++++++++++++");
            ExoPlayer exoPlayer = this.player;
            if (exoPlayer != null) {
                int currentPosition = (int) exoPlayer.getCurrentPosition();
                YuppAnalytics yuppAnalytics = this.mOttAnalytics;
                if (yuppAnalytics != null) {
                    yuppAnalytics.handleSeekStart(currentPosition);
                    this.mOttAnalytics.handleSeekEnd((int) this.player.getCurrentPosition(), currentPosition, this.isPauseByUser);
                }
            }
        }
    }

    public void onPositionDiscontinuity(Player.PositionInfo positionInfo, Player.PositionInfo positionInfo2, int i2) {
        u2.y(this, positionInfo, positionInfo2, i2);
    }

    public void onRenderedFirstFrame() {
        u2.z(this);
    }

    public void onRepeatModeChanged(int i2) {
    }

    public void onResume() {
        ExoPlayer exoPlayer;
        super.onResume();
        if (this.proPopup || OTTApplication.isActivityPaused || !isAdded()) {
            return;
        }
        if (this.mOttAnalytics == null) {
            this.mOttAnalytics = YuppAnalytics.getInstance(getActivity());
        }
        if ((Util.SDK_INT <= 23 || this.player == null) && getActivity() != null && getActivity().getPlayerCurrentState() > 0) {
            this.isComingFromBackground = true;
            this.isPlayerAutoPaused = false;
            if (this.isPauseByUser) {
                tooglePlayer(false);
            } else {
                tooglePlayer(true);
            }
            PlayerControlView playerControlView = this.mPlayerControlView;
            if (playerControlView != null) {
                playerControlView.updateGoLiveButtonOnResume();
            }
            if (getActivity() != null) {
                this.volumeChangeReceiver = new VolumeChangeReceiver(this);
                getActivity().registerReceiver(this.volumeChangeReceiver, new IntentFilter("android.media.VOLUME_CHANGED_ACTION"));
                this.isvolumeChangeReceiverRegistered = true;
            }
            initAnalytics(this.player, true);
            updateNextVideo();
            if (this.player == null && getActivity() != null && !this.isFromBackground && !this.isPlayerError) {
                this.isFromBackground = true;
                if (s.a() == null) {
                    return;
                }
                if (OTTApplication.IS_FROM_ACTIVE_SCREEN_PAGE) {
                    OTTApplication.IS_FROM_ACTIVE_SCREEN_PAGE = false;
                    return;
                } else if (!this.isDetailsPage) {
                    Intent intent = new Intent((Context) getActivity(), (Class<?>) SplashScreenActivity.class);
                    intent.setFlags(67108864);
                    intent.setFlags(268468224);
                    startActivity(intent);
                    getActivity().finish();
                }
            }
        }
        if (OTTApplication.IS_PLAYER_SCREEN_LOCKED) {
            getActivity().hideSystemUI();
        }
        if (!OTTApplication.SHOW_APP_OPEN_POPUP) {
            this.mFragmentHost.updateSliderMenu();
        }
        if (Constants.IS_MAX_WWL.booleanValue() || (exoPlayer = this.player) == null || exoPlayer.getPlayWhenReady() || !OTTApplication.isPlayerResume) {
            return;
        }
        this.player.setPlayWhenReady(true);
        OTTApplication.isPlayerResume = false;
    }

    public void onSeekBackIncrementChanged(long j) {
        u2.B(this, j);
    }

    public void onSeekForwardIncrementChanged(long j) {
        u2.C(this, j);
    }

    public void onSeekProcessed() {
    }

    public void onShuffleModeEnabledChanged(boolean z) {
    }

    public void onSkipSilenceEnabledChanged(boolean z) {
        u2.F(this, z);
    }

    public void onStart() {
        super.onStart();
        if (!OTTApplication.isActivityPaused && isAdded() && Util.SDK_INT > 23 && getActivity() != null && getActivity().getPlayerCurrentState() > 0) {
            this.isComingFromBackground = true;
            this.isPlayerAutoPaused = false;
            if (this.isPauseByUser) {
                tooglePlayer(false);
            } else {
                tooglePlayer(true);
                ExoPlayer exoPlayer = this.player;
                if (exoPlayer != null && exoPlayer.isPlaying()) {
                    eventCTVideoStarted();
                }
            }
            PlayerControlView playerControlView = this.mPlayerControlView;
            if (playerControlView != null) {
                playerControlView.updateGoLiveButtonOnResume();
            }
            if (this.mOttAnalytics == null) {
                this.mOttAnalytics = YuppAnalytics.getInstance(getActivity());
            }
            initAnalytics(this.player, true);
            updateNextVideo();
            if (this.player != null || getActivity() == null || this.isFromBackground || this.isPlayerError) {
                return;
            }
            this.isFromBackground = true;
            if (s.a() == null) {
                return;
            }
            if (OTTApplication.IS_FROM_ACTIVE_SCREEN_PAGE) {
                OTTApplication.IS_FROM_ACTIVE_SCREEN_PAGE = false;
                return;
            }
            if (this.proPopup || this.isDetailsPage) {
                return;
            }
            Intent intent = new Intent((Context) getActivity(), (Class<?>) SplashScreenActivity.class);
            intent.setFlags(67108864);
            intent.setFlags(268468224);
            startActivity(intent);
            getActivity().finish();
        }
    }

    public void onStop() {
        StreamResponse streamResponse;
        super.onStop();
        if (isAdded()) {
            if (Util.SDK_INT > 23 && getActivity() != null && getActivity().getPlayerCurrentState() > 0) {
                if (this.player != null && this.mouTracker != null) {
                    eventCTVideoStopped();
                    this.mouTracker = null;
                }
                this.isComingFromBackground = false;
                this.isPauseByUser = false;
                ExoPlayer exoPlayer = this.player;
                if (exoPlayer != null && !exoPlayer.getPlayWhenReady()) {
                    this.isPauseByUser = true;
                }
                this.isPlayerAutoPaused = true;
                tooglePlayer(false);
                releaseAnalytics();
                CountDownTimer countDownTimer = this.timer;
                if (countDownTimer != null) {
                    countDownTimer.cancel();
                }
                this.timer = null;
            }
            if (this.lastItemObject == null || (streamResponse = this.lastStreamResponse) == null) {
                this.mBottomButton1.setVisibility(8);
            } else if (streamResponse.getAnalyticsInfo().getContentType() != null && this.lastStreamResponse.getAnalyticsInfo().getContentType().equalsIgnoreCase("live")) {
                Preferences.instance(getActivity()).setStringPreference("lastchannel", this.lastItemObject.getPageInfo().getPath());
            }
            if (Build.VERSION.SDK_INT < 24 || !FusionViliteMainActivity.enterPIPMode) {
                return;
            }
            new Handler().postDelayed(new Runnable() {
                @Override
                public final void run() {
                    ExoPlayerFragment.this.lambda$onStop$5();
                }
            }, 500L);
        }
    }

    public void onSurfaceSizeChanged(int i2, int i3) {
        u2.G(this, i2, i3);
    }

    public void onTimelineChanged(Timeline timeline, int i2) {
        u2.H(this, timeline, i2);
    }

    public void onTrackSelectionParametersChanged(TrackSelectionParameters trackSelectionParameters) {
        u2.I(this, trackSelectionParameters);
    }

    public void onTracksChanged(Tracks tracks) {
        UnmodifiableIterator it = tracks.getGroups().iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            Tracks.Group group = (Tracks.Group) it.next();
            for (int i2 = 0; i2 < group.length; i2++) {
                boolean isTrackSupported = group.isTrackSupported(i2);
                Format trackFormat = group.getTrackFormat(i2);
                if (!isTrackSupported) {
                    this.list_bitrates.add(Integer.valueOf(trackFormat.bitrate));
                }
            }
        }
        ImmutableList<Tracks.Group> groups = tracks.getGroups();
        if (groups != this.lastSeenTrackGroupArray) {
            MappingTrackSelector.MappedTrackInfo currentMappedTrackInfo = this.trackSelector.getCurrentMappedTrackInfo();
            if (currentMappedTrackInfo != null) {
                if (currentMappedTrackInfo.getTypeSupport(2) == 1) {
                    showToast(R.string.error_unsupported_video);
                }
                if (currentMappedTrackInfo.getTypeSupport(1) == 1) {
                    showToast(R.string.error_unsupported_audio);
                }
                DefaultTrackSelector defaultTrackSelector = this.trackSelector;
                if (defaultTrackSelector != null && defaultTrackSelector.getCurrentMappedTrackInfo() != null && this.trackSelector.getCurrentMappedTrackInfo().getTrackGroups(1) != null && this.trackSelector.getCurrentMappedTrackInfo().getTrackGroups(1).length > 1) {
                    this.isAudioTrackAvailable = true;
                    this.audioLayout.setVisibility(0);
                }
                DefaultTrackSelector defaultTrackSelector2 = this.trackSelector;
                if (defaultTrackSelector2 != null && defaultTrackSelector2.getCurrentMappedTrackInfo() != null && this.trackSelector.getCurrentMappedTrackInfo().getTrackGroups(2) != null && this.trackSelector.getCurrentMappedTrackInfo().getTrackGroups(2).length > 0) {
                    TrackGroupArray trackGroups = currentMappedTrackInfo.getTrackGroups(2);
                    for (int i3 = 0; i3 < trackGroups.length; i3++) {
                        TrackGroup trackGroup = trackGroups.get(i3);
                        for (int i4 = 0; i4 < trackGroup.length; i4++) {
                            if (!TextUtils.isEmpty(trackGroup.getFormat(i4).language)) {
                                this.isCloseCaptionsAvailable = true;
                            }
                        }
                    }
                    if (this.isCloseCaptionsAvailable) {
                        this.subtitleLayout.setVisibility(0);
                        this.playerMultipleAudioSubtitleTracksBtn.setVisibility(0);
                        SubtitleView subtitleView = this.subtitleView;
                        if (subtitleView != null) {
                            subtitleView.setVisibility(0);
                        }
                    }
                }
            }
            this.lastSeenTrackGroupArray = groups;
        }
    }

    @Override
    public void onTriggerAutoPlay(int i2) {
    }

    public void onUpstreamDiscarded(int i2, MediaSource.MediaPeriodId mediaPeriodId, MediaLoadData mediaLoadData) {
        CustomLog.e("Ads ::", "onUpstreamDiscarded");
    }

    public void onVideoSizeChanged(VideoSize videoSize) {
        u2.K(this, videoSize);
    }

    public void onVisibilityChange(int i2) {
    }

    public void onVolumeChanged(float f2) {
        u2.L(this, f2);
    }

    public void pausePlayer() {
        ExoPlayer exoPlayer = this.player;
        if (exoPlayer == null || !exoPlayer.getPlayWhenReady()) {
            return;
        }
        pauseMOUTracker();
        this.player.setPlayWhenReady(false);
        VideoListener videoListener = this.mVideoListener;
        if (videoListener != null) {
            videoListener.onVideoStopped();
        }
    }

    public void playNextVideo() {
        List<Card> cards;
        if (this.isNextVideoFetchInProgress) {
            return;
        }
        this.isNextVideoFetchInProgress = true;
        if (getActivity() == null || getActivity().isFinishing()) {
            return;
        }
        new ArrayList();
        Section.SectionData sectionData = this.mNextVideoObject;
        if (sectionData == null || (cards = sectionData.getCards()) == null || this.mNextVideoObject.getCards().size() <= 0) {
            this.isNextVideoFetchInProgress = false;
            showReplayButton(true);
            return;
        }
        if (cards.get(0).getTarget() != null && cards.get(0).getTarget().getPageAttributes() != null && y.a(cards.get(0)) != null) {
            MyRecoManager.getInstance().setContentTitle(cards.get(0).getTarget().getPageAttributes().getContentName());
        }
        MyRecoManager.getInstance().setTAB_NAME("player");
        this.clickdedOnCard = true;
        NavigationUtils.performItemClickNavigation(cards.get(0), getActivity(), cards.get(0).getTarget().getPath(), "");
    }

    public void releasePlayer() {
        Runnable runnable;
        BottomSheetBehavior<LinearLayout> bottomSheetBehavior;
        AdsLoader adsLoader = this.adsLoader;
        if (adsLoader != null) {
            adsLoader.setPlayer((Player) null);
        }
        this.mPlayerControlView.forwardRewind = false;
        this.isTrailer = false;
        this.isFill = true;
        this.palNonce = "";
        this.palStreamUrl = "";
        this.palSessionID = "";
        this.palBoxID = "";
        this.isDistroVideoImpressionSent = false;
        this.macroReplacedURL = "";
        this.streamSessionId = "";
        this.isShowNextEpisodeButtonShowing = false;
        OTTApplication.isPlayerResume = false;
        stopAnimatorTime();
        ImaServerSideAdInsertionMediaSource.AdsLoader adsLoader2 = this.imaDaiAdsLoader;
        if (adsLoader2 != null && this.imaDaiAdsLoaderState != null) {
            this.imaDaiAdsLoaderState = adsLoader2.release();
        }
        ExoPlayer exoPlayer = this.player;
        if (exoPlayer != null) {
            this.shouldAutoPlay = exoPlayer.getPlayWhenReady();
            eventCTVideoStopped();
            if (!this.playAdsError) {
                this.shouldRestorePosition = false;
            }
            releaseAdsLoader();
            this.player.seekTo(0L);
            this.player.clearVideoSurface();
            updateResumePosition();
            ExoPlayer exoPlayer2 = this.player;
            if (exoPlayer2 != null) {
                exoPlayer2.release();
            }
            this.player = null;
            this.trackSelector = null;
            this.trackSelectionHelper = null;
            this.defaultCaptions = "";
            this.renderersFactory = null;
            this.eventLogger = null;
            Preferences preferences = this.preference;
            if (preferences != null) {
                preferences.setTargetPath("");
            }
            changeBgColorAnimate(this.relatedVideos_layout, false);
            changeBgColorAnimate(this.relatedVideos_layout_seasons, false);
            if (this.isLive && (bottomSheetBehavior = this.bottomSheetBehavior) != null) {
                bottomSheetBehavior.setState(4);
            }
            this.backLiveBottomCarousel.setVisibility(4);
        }
        removedStreamActiveSession();
        PlayerControlView playerControlView = this.mPlayerControlView;
        if (playerControlView != null) {
            playerControlView.removeCallbacks();
            this.mPlayerControlView.isShowControls = false;
        }
        Handler handler = this.nextEpisodeHandler;
        if (handler != null && (runnable = this.nextEpisodeRunnable) != null) {
            handler.removeCallbacks(runnable);
        }
        this.isPauseByUser = false;
        this.isAudioTrackAvailable = false;
        this.isSubtitleAvailable = false;
        OTTApplication.SUBTITLE_STATE = false;
        OTTApplication.IS_PLAYER_SCREEN_LOCKED = false;
        setContentRating("", "");
    }

    public void resetFlags() {
        this.showGoLive = false;
        this.showNextVideo = false;
        showReplayButton(false);
    }

    public void resumePlayer() {
        if (OTTApplication.IS_EXIT_PIP_MODE && !this.isShowNextEpisodeButtonShowing) {
            OTTApplication.IS_EXIT_PIP_MODE = false;
            return;
        }
        if (this.player != null) {
            resumeMOUTracker();
            this.player.setPlayWhenReady(true);
            VideoListener videoListener = this.mVideoListener;
            if (videoListener != null) {
                videoListener.onVideoStarted();
            }
        }
    }

    public void setBackgroundImage(String str, boolean z) {
        if (z) {
            PlayerControlView playerControlView = this.mPlayerControlView;
            if (playerControlView != null) {
                playerControlView.setIsErrorShown(true);
            }
            if (getActivity() != null) {
                getActivity().mWatchWhileLayout.isErrorShown(true);
            }
            this.bgFixedAspectRL.setVisibility(0);
        } else {
            PlayerControlView playerControlView2 = this.mPlayerControlView;
            if (playerControlView2 != null) {
                playerControlView2.setIsErrorShown(false);
            }
            if (getActivity() != null) {
                getActivity().mWatchWhileLayout.isErrorShown(true);
            }
            this.imageBackIV.setVisibility(8);
            this.bgFixedAspectRL.setVisibility(8);
        }
        if (getActivity() == null || TextUtils.isEmpty(str)) {
            return;
        }
        RequestBuilder load = Glide.with(getActivity().getApplicationContext()).load(APIUtils.getAbsoluteImagePath(getActivity().getApplicationContext(), str));
        int i2 = R.drawable.default_banner;
        load.placeholder(i2).error(i2).into(this.background_image);
    }

    public void setBrightnessSlide(float f2) {
        if (this.mBrightness < 0.0f) {
            float f3 = this.mActivity.getWindow().getAttributes().screenBrightness;
            this.mBrightness = f3;
            if (f3 <= 0.0f) {
                this.mBrightness = 0.5f;
            } else if (f3 < 0.01f) {
                this.mBrightness = 0.01f;
            }
        }
        WindowManager.LayoutParams attributes = this.mActivity.getWindow().getAttributes();
        float f4 = this.mBrightness + f2;
        attributes.screenBrightness = f4;
        if (f4 > 1.0f) {
            attributes.screenBrightness = 1.0f;
        } else if (f4 < 0.01f) {
            attributes.screenBrightness = 0.01f;
        }
        this.mActivity.getWindow().setAttributes(attributes);
        this.brightnessSeekbar = (VerticalSeekBar) getActivity().findViewById(R.id.brightness_seek_bar);
        FragmentActivity activity = getActivity();
        int i2 = R.id.app_video_brightness;
        this.brightnessLevelText = (TextView) activity.findViewById(i2);
        if (Build.VERSION.SDK_INT >= 26) {
            this.brightnessSeekbar.setMin(0);
            this.brightnessSeekbar.setMax(100);
        }
        if ((getActivity() != null ? getActivity().getResources().getConfiguration().orientation : 1) != 1) {
            PlayerControlView playerControlView = this.mPlayerControlView;
            if (!playerControlView.controlVisible) {
                playerControlView.volBar.setVisibility(8);
            }
            setViewVisibility(R.id.forward_layout, false);
            setViewVisibility(R.id.rewind_layout, false);
            setViewVisibility(R.id.app_video_center_box, true);
            setViewVisibility(R.id.app_video_brightness_box, true);
            this.mPlayerControlView.brightBar.setVisibility(0);
            setViewVisibility(R.id.app_video_brightness_icon, true);
            setViewVisibility(i2, false);
        }
        this.brightnessSeekbar.setProgress((int) (attributes.screenBrightness * 15.0f * 10.0f));
        this.brightnessLevelText.setText(" " + ((int) (attributes.screenBrightness * 15.0f * 10.0f)));
    }

    public void setContentRatingVisibility(int i2) {
        RelativeLayout relativeLayout = this.maturityRatingLayout;
        if (relativeLayout != null) {
            relativeLayout.setVisibility(i2);
            if (i2 == 0) {
                this.maturityRatingLayout.setAlpha(0.0f);
                this.maturityRatingLayout.setX(-50.0f);
                this.maturityRatingLayout.animate().translationX(0.0f).alpha(1.0f).setDuration(500L);
            }
        }
    }

    public MediaSourceFactory setDrmSessionManagerProvider(@Nullable DrmSessionManagerProvider drmSessionManagerProvider) {
        return null;
    }

    public void setExoplayerSubtitleBottomPadding(int i2) {
        PlayerView playerView = this.simpleExoPlayerView;
        SubtitleView subtitleView = playerView != null ? playerView.getSubtitleView() : null;
        if (subtitleView != null) {
            subtitleView.setApplyEmbeddedFontSizes(false);
            subtitleView.setApplyEmbeddedStyles(false);
            subtitleView.setPadding(0, 0, 0, i2);
        }
    }

    public MediaSourceFactory setLoadErrorHandlingPolicy(@Nullable LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
        return null;
    }

    public void setVideoListener(@Nullable VideoListener videoListener) {
        this.mVideoListener = videoListener;
    }

    public void setVolumeSlide(float f2) {
        AudioManager audioManager = (AudioManager) this.mActivity.getSystemService("audio");
        this.mMaxVolume = audioManager.getStreamMaxVolume(3);
        if (this.mVolume == -1.0f) {
            float streamVolume = audioManager.getStreamVolume(3);
            this.mVolume = streamVolume;
            if (streamVolume < 0.0f) {
                this.mVolume = 0.0f;
            }
        }
        int i2 = this.mMaxVolume;
        int i3 = (int) (((int) (f2 * i2)) + this.mVolume);
        if (i3 <= i2) {
            i2 = i3 < 0 ? 0 : i3;
        }
        try {
            audioManager.setStreamVolume(3, i2, 0);
        } catch (Throwable unused) {
        }
        int i4 = (int) ((i2 * 100.0d) / this.mMaxVolume);
        if ((getActivity() != null ? getActivity().getResources().getConfiguration().orientation : 1) != 1) {
            PlayerControlView playerControlView = this.mPlayerControlView;
            if (!playerControlView.controlVisible) {
                playerControlView.brightBar.setVisibility(8);
            }
            setViewVisibility(R.id.forward_layout, false);
            setViewVisibility(R.id.rewind_layout, false);
            setViewVisibility(R.id.app_video_center_box, true);
            this.mPlayerControlView.volBar.setVisibility(0);
            setViewVisibility(R.id.app_video_volume, false);
            getImageView(R.id.app_video_volume_icon).setImageResource(R.drawable.volume_img);
        }
        this.volumeLevelText.setText(" " + i4);
        this.volumeSeekbar.setProgress(i4);
    }

    public void showBlocker(String str, String str2, String str3) {
        DialogType dialogType;
        if (this.mActivity != null) {
            HashMap hashMap = new HashMap();
            str.getClass();
            switch (str) {
                case "Suspended_popup":
                    dialogType = DialogType.USER_SUSPENDED_SHEET_DIALOG;
                    break;
                case "plans_overlay":
                    dialogType = DialogType.SUBSCRIBE_SHEET_DIALOG;
                    break;
                case "COCP_popup":
                    dialogType = DialogType.USER_COCP_SHEET_DIALOG;
                    break;
                case "lsdk_pro":
                    dialogType = DialogType.PRO_USER_POPUP_DIALOG;
                    if (Utils.isVimtvAppInstalledOrNot(this.mActivity, "com.vodafone.vodafoneplay")) {
                        str = str.concat("_installed");
                        String showvimtvappinstalledpopup = OttSDK.getInstance().getApplicationManager().getAppConfigurations().getShowvimtvappinstalledpopup();
                        if (!TextUtils.isEmpty(showvimtvappinstalledpopup) && showvimtvappinstalledpopup.equalsIgnoreCase("false")) {
                            String vimtvdeeplinkbaseurl = OttSDK.getInstance().getApplicationManager().getAppConfigurations().getVimtvdeeplinkbaseurl();
                            if (!TextUtils.isEmpty(vimtvdeeplinkbaseurl)) {
                                NavigationUtils.eventCTAppInAppClick(this.mActivity, this.contentPageItem, this.targetPath, "", null);
                                OTTApplication.isDrawerOpen = false;
                                StringBuilder a = com.yupptv.ott.a.a(vimtvdeeplinkbaseurl);
                                a.append(this.targetPath);
                                this.mActivity.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(a.toString())));
                                return;
                            }
                        }
                    }
                    break;
                case "lsdk_secondepisode_overlay":
                    dialogType = DialogType.LSDK_SECONDEPISODE_OVERLAY;
                    break;
                default:
                    dialogType = null;
                    break;
            }
            hashMap.put("dialog_template_code", str);
            hashMap.put("dialog_key_target_path", str2);
            if (TextUtils.isEmpty(str2) || TextUtils.isEmpty(str) || dialogType == null) {
                return;
            }
            getActivity().setRequestedOrientation(1);
            this.background_image.setImageResource(R.drawable.default_banner);
            setBackgroundImage(str3, true);
            NavigationUtils.showDialog("", getActivity(), dialogType, hashMap, this.itemObject, new BottomButtonsActionListener() {
                @Override
                public void onButtonClicked(AppCompatButton appCompatButton, Object obj, ButtonType buttonType) {
                }

                @Override
                public void onDismiss() {
                }
            });
        }
    }

    public void showError(boolean z, String str) {
        if (z && Constants.IS_LAST_CHANNEL.booleanValue()) {
            Constants.IS_LAST_CHANNEL = Boolean.FALSE;
            launchActivity();
            return;
        }
        TextView textView = this.error_text_view;
        if (textView != null) {
            textView.setText(str);
            this.mIsError = z;
            if (z) {
                PlayerControlView playerControlView = this.mPlayerControlView;
                if (playerControlView != null) {
                    playerControlView.setIsErrorShown(true);
                }
                if (getActivity() != null) {
                    getActivity().mWatchWhileLayout.isErrorShown(true);
                }
                ContentPage contentPage = (ContentPage) this.itemObject;
                if (contentPage == null || contentPage.getPageData() == null || ((ContentPage) this.itemObject).getPageData().size() <= 0 || ((ContentPage) this.itemObject).getPageData().get(0).getContent() == null) {
                    setBackgroundImage("", true);
                } else {
                    setBackgroundImage(((ContentPage) this.itemObject).getPageData().get(0).getContent().getBackgroundImage(), true);
                }
            } else {
                PlayerControlView playerControlView2 = this.mPlayerControlView;
                if (playerControlView2 != null) {
                    playerControlView2.setIsErrorShown(false);
                }
                if (getActivity() != null) {
                    getActivity().mWatchWhileLayout.isErrorShown(false);
                }
            }
            if (z && getActivity().getPlayerCurrentState() == 2 && this.playBackState != 4) {
                this.errorWarningImg.setVisibility(0);
            }
        }
        PlayerControlView playerControlView3 = this.mPlayerControlView;
        if (playerControlView3 != null && z) {
            playerControlView3.hideLoadingBar();
        }
        if (getResources().getConfiguration().orientation == 2 && (z || !TextUtils.isEmpty(str))) {
            this.mOrientationUtils.shrinkToPotraitMode();
            this.relative_seasonui.setVisibility(8);
            this.recommendation_control_backbutton.setVisibility(8);
        }
        ImageView imageView = this.waterMark;
        if (imageView != null) {
            imageView.setVisibility(8);
        }
    }

    public void showHideForwardRewindLayout(boolean z) {
        PlayerControlView playerControlView = this.mPlayerControlView;
        if (playerControlView != null) {
            playerControlView.showHideForwardRewindLayout(z);
        }
    }

    public void showMiniControls() {
        Handler handler = this.miniControlsHandler;
        if (handler != null) {
            handler.removeCallbacks(this.miniControlsHideRunnable);
        }
        View view = this.mMiniControlsContainer;
        if (view != null) {
            view.setVisibility(0);
        }
        this.mPlayerControlView.volBar.setVisibility(8);
        this.mPlayerControlView.brightBar.setVisibility(8);
        this.iV_Gradient_top.setVisibility(8);
        this.trailer_back_layout.setVisibility(8);
        this.trailer_muteButton.setVisibility(8);
        this.parent_access_layout.setVisibility(8);
        this.miniControlsHandler.postDelayed(this.miniControlsHideRunnable, 1000L);
    }

    @Override
    public void showNextVideo() {
        if (this.isTrailer) {
            return;
        }
        if (this.isaccessible && this.access_layout.getVisibility() == 0 && getActivity().getResources().getConfiguration().orientation == 2) {
            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.mNextVideoLayout.getLayoutParams();
            layoutParams.setMargins(10, 130, 10, 10);
            this.mNextVideoLayout.setLayoutParams(layoutParams);
        }
        StreamResponse streamResponse = this.streamResponseObject;
        if (streamResponse == null || streamResponse.getPageAttributes() == null || this.streamResponseObject.getPageAttributes().getCreditsLabel() == null || this.streamResponseObject.getPageAttributes().getCreditsLabel().trim().length() <= 0 || this.streamResponseObject.getPageAttributes().getCreditsStartTime() == null || this.streamResponseObject.getPageAttributes().getCreditsStartTime().trim().length() <= 0 || this.streamResponseObject.getPageAttributes().getCreditsDuration() == null || this.streamResponseObject.getPageAttributes().getCreditsDuration().trim().length() <= 0 || Long.parseLong(this.streamResponseObject.getPageAttributes().getCreditsStartTime()) * 1000 <= 0) {
            RelativeLayout relativeLayout = this.mNextVideoLayout;
            if (relativeLayout != null) {
                relativeLayout.setVisibility(8);
                AppCompatButton appCompatButton = this.nextEpisodeButton;
                if (appCompatButton != null) {
                    appCompatButton.setVisibility(8);
                }
                APIUtils.getUtilAppConfigurations(getContext().getApplicationContext());
                if (this.isLive || this.mNextVideoObject == null || this.isPlayingAd) {
                    return;
                }
                ExoPlayer exoPlayer = this.player;
                if (exoPlayer == null || !exoPlayer.isPlayingAd()) {
                    if (getActivity() != null && getActivity().getPlayerCurrentState() == 2) {
                        this.mNextVideoLayout.setVisibility(8);
                        this.nextEpisodeButton.setVisibility(8);
                        return;
                    } else if (!this.showNextEpisodeButton || FusionViliteMainActivity.enterPIPMode) {
                        this.mNextVideoLayout.setVisibility(0);
                        return;
                    } else {
                        this.nextEpisodeButton.setVisibility(0);
                        this.imageBackIV.setVisibility(0);
                        return;
                    }
                }
                return;
            }
            return;
        }
        if (((FusionViliteMainActivity) getContext()).getPlayerCurrentState() != 1 || FusionViliteMainActivity.enterPIPMode) {
            return;
        }
        ExoPlayer exoPlayer2 = this.player;
        long duration = exoPlayer2 == null ? 0L : exoPlayer2.getDuration();
        ExoPlayer exoPlayer3 = this.player;
        long currentPosition = exoPlayer3 == null ? 0L : exoPlayer3.getCurrentPosition();
        String creditsLabel = this.streamResponseObject.getPageAttributes().getCreditsLabel();
        long parseLong = Long.parseLong(this.streamResponseObject.getPageAttributes().getCreditsStartTime()) * 1000;
        if (parseLong <= 0 || parseLong > currentPosition || currentPosition > duration) {
            this.isShowNextEpisodeButtonShowing = false;
            stopAnimatorTime();
            hideNextVideo();
            this.watchCreditsFrameLayout.setVisibility(8);
            this.mNextVideoLayout.setVisibility(8);
            this.nextEpisodeButton.setVisibility(8);
            return;
        }
        this.watchCreditsFrameLayout.setVisibility(8);
        this.watchCreditsTv.setText(creditsLabel);
        if (!this.showNextEpisodeButton || FusionViliteMainActivity.enterPIPMode) {
            this.mNextVideoLayout.setVisibility(0);
        } else {
            startTimer(this.mPlayerControlView.nextContentButtonAnimation);
            this.nextEpisodeButton.setVisibility(0);
            this.imageBackIV.setVisibility(0);
        }
        this.mComingUpTextTitle.setText(getActivity().getResources().getString(R.string.upnext_in) + " " + ((duration - currentPosition) / 1000) + " sec");
        if (this.mNextVideoObject != null) {
            this.mComingUpText.setText(this.mNextVideoObject.getCards().get(0).getDisplay().getSubtitle1() + "");
        }
        RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.watchCreditsFrameLayout.getLayoutParams();
        PlayerControlView playerControlView = this.mPlayerControlView;
        if (playerControlView == null || !playerControlView.isVisible()) {
            layoutParams2.setMargins(0, 0, 20, (int) getActivity().getResources().getDimension(R.dimen.margin_default_5));
        } else {
            layoutParams2.setMargins(0, 0, 20, (int) getActivity().getResources().getDimension(R.dimen.skip_intro_bottom_margin));
        }
        this.watchCreditsFrameLayout.setLayoutParams(layoutParams2);
    }

    public void showOverLayLayoutIfAny() {
        OttLog.error("showOverLayLayoutIfAny", "showOverLayLayoutIfAny");
        if (this.streamResponseObject == null) {
            return;
        }
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                ExoPlayer exoPlayer = ExoPlayerFragment.this.player;
                if (exoPlayer != null && (exoPlayer.isPlayingAd() || ExoPlayerFragment.this.isFANAdPlaying)) {
                    try {
                        ExoPlayerFragment.this.simpleExoPlayerView.getOverlayFrameLayout().setVisibility(0);
                    } catch (Exception e2) {
                        e2.getMessage();
                    }
                }
                if (ExoPlayerFragment.this.mc == null || ExoPlayerFragment.this.mc.getCastState() != 4) {
                    return;
                }
                try {
                    ExoPlayerFragment.this.stateChangedOnCastConnected();
                    ExoPlayerFragment.this.mMediaRouteButton.setRemoteIndicatorDrawable(ExoPlayerFragment.this.getResources().getDrawable(R.drawable.mr_button_connecting_dark));
                } catch (Exception unused) {
                }
            }
        }, 0L);
    }

    public void showProgress(boolean z) {
        LineSpinFadeLoaderView lineSpinFadeLoaderView = this.miniPlayerLoader;
        if (lineSpinFadeLoaderView != null) {
            lineSpinFadeLoaderView.setVisibility(z ? 0 : 8);
        }
        LineSpinFadeLoaderView lineSpinFadeLoaderView2 = this.miniPlayerLoader;
        if (lineSpinFadeLoaderView2 instanceof LineSpinFadeLoaderView) {
            if (z) {
                lineSpinFadeLoaderView2.startAnimation();
            } else {
                lineSpinFadeLoaderView2.stopAnimation();
            }
        }
    }

    public void startPlay(final java.lang.Object r30, long r31, com.yupptv.ott.enums.ButtonType r33) {
        throw new UnsupportedOperationException("Method not decompiled: com.yupptv.ott.player.ExoPlayerFragment.startPlay(java.lang.Object, long, com.yupptv.ott.enums.ButtonType):void");
    }

    public void startTimer(int i2) {
        Handler handler;
        Runnable runnable;
        if (this.nextEpisodeButton != null && this.showNextEpisodeButton && !this.isShowNextEpisodeButtonShowing && getActivity() != null && !this.isPlayingAd) {
            this.isShowNextEpisodeButtonShowing = true;
            this.nextEpisodeButton.setTextColor(getActivity().getResources().getColor(R.color.white));
            StreamResponse streamResponse = this.streamResponseObject;
            if (streamResponse == null || streamResponse.getPageAttributes() == null || this.streamResponseObject.getPageAttributes().getContentType() == null || this.streamResponseObject.getPageAttributes().getContentType().isEmpty() || !this.streamResponseObject.getPageAttributes().getContentType().equalsIgnoreCase("movie")) {
                this.nextEpisodeButton.setText(getActivity().getResources().getText(R.string.next_episode));
            } else {
                this.nextEpisodeButton.setText(getActivity().getResources().getText(R.string.ccl_mini_upnext));
            }
            ClipDrawable clipDrawable = (ClipDrawable) ((LayerDrawable) this.nextEpisodeButton.getBackground()).findDrawableByLayerId(R.id.clip_drawable);
            this.clipDrawable = clipDrawable;
            long j = i2 * 1000;
            ObjectAnimator ofInt = ObjectAnimator.ofInt(clipDrawable, "level", 0, 10000);
            this.animator = ofInt;
            ofInt.setDuration(j);
            this.animator.setInterpolator(new LinearInterpolator());
            this.animator.start();
            Integer[] numArr = {-16777216, -16777216, -16777216, -16777216};
            Handler handler2 = this.nextEpisodeHandler;
            if (handler2 != null && (runnable = this.nextEpisodeRunnable) != null) {
                handler2.removeCallbacks(runnable);
            }
            changeButtonTextColorSequentially(this.nextEpisodeButton, Arrays.asList(numArr), j / (this.nextEpisodeButton.getText().toString().length() + 2));
            hideControls();
            this.playerUnLock.setVisibility(8);
            OTTApplication.IS_PLAYER_SCREEN_LOCKED = false;
        }
        ClipDrawable clipDrawable2 = this.clipDrawable;
        if (clipDrawable2 != null && clipDrawable2.getLevel() == 10000) {
            playNextVideo();
            Runnable runnable2 = this.nextEpisodeRunnable;
            if (runnable2 != null && (handler = this.nextEpisodeHandler) != null) {
                handler.removeCallbacks(runnable2);
            }
        }
        AppCompatButton appCompatButton = this.nextEpisodeButton;
        if (appCompatButton == null || appCompatButton.getVisibility() != 0 || getActivity() == null) {
            return;
        }
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.nextEpisodeButton.getLayoutParams();
        if (getActivity().getResources().getConfiguration().orientation == 1) {
            layoutParams.setMargins(0, 0, (int) getActivity().getResources().getDimension(R.dimen._37sdp), (int) getActivity().getResources().getDimension(R.dimen._32sdp));
        } else {
            layoutParams.setMargins(0, 0, (int) getActivity().getResources().getDimension(R.dimen._11sdp), (int) getActivity().getResources().getDimension(R.dimen._17sdp));
        }
        this.nextEpisodeButton.setLayoutParams(layoutParams);
    }

    public void stopAnimatorTime() {
        ObjectAnimator objectAnimator = this.animator;
        if (objectAnimator != null) {
            objectAnimator.cancel();
            this.animator.setDuration(0L);
            this.clipDrawable.clearColorFilter();
            this.animator = null;
            this.clipDrawable = null;
        }
        Handler handler = this.nextEpisodeHandler;
        if (handler != null) {
            handler.removeCallbacks(this.nextEpisodeRunnable);
        }
        if (this.nextEpisodeButton == null || getActivity() == null) {
            return;
        }
        this.nextEpisodeButton.setTextColor(getActivity().getResources().getColor(R.color.white));
        this.nextEpisodeButton.setBackground(getActivity().getResources().getDrawable(R.drawable.us_action_background_nextepisode));
    }

    public void stopPlayback() {
        ExoPlayer exoPlayer = this.player;
        if (exoPlayer != null) {
            exoPlayer.setPlayWhenReady(false);
            this.player.stop();
            this.player.release();
        }
    }

    public void stopPlayer() {
        Handler handler;
        OttLog.error("stopPlayer", "stopPlayer");
        CastContext castContext = this.mc;
        if (castContext == null || castContext.getCastState() != 4) {
            this.mPath = "";
            this.mForeground = false;
            PlayerControlView playerControlView = this.mPlayerControlView;
            if (playerControlView != null) {
                playerControlView.resetSeekbar();
                this.mPlayerControlView.removeCallbacks();
            }
            getActivity().setButtonType(ButtonType.NONE);
            View view = this.container;
            if (view != null) {
                view.setVisibility(4);
            }
            if (this.isAutoPlay.equalsIgnoreCase("true")) {
                releaseAnalyticsAuto();
            } else {
                releaseAnalytics();
            }
            releasePlayer();
            PlayerView playerView = this.simpleExoPlayerView;
            if (playerView != null && playerView.getVideoSurfaceView() != null) {
                this.simpleExoPlayerView.getVideoSurfaceView().setVisibility(4);
                this.simpleExoPlayerView.setVisibility(4);
            }
            this.showNextVideo = false;
            this.showGoLive = false;
        } else {
            this.mc.removeCastStateListener(this.mCastStateListener);
            this.showNextVideo = true;
            PlayerView playerView2 = this.simpleExoPlayerView;
            if (playerView2 != null && playerView2.getVideoSurfaceView() != null) {
                this.simpleExoPlayerView.getVideoSurfaceView().setVisibility(4);
                this.simpleExoPlayerView.setVisibility(4);
            }
        }
        Handler handler2 = this.epgCheckHandler;
        if (handler2 != null) {
            handler2.removeCallbacks(this.epgCheckRunnable);
        }
        if (getActivity() instanceof FusionViliteMainActivity) {
            getActivity().clearPlayerData();
        }
        AppCompatButton appCompatButton = this.takeTestButton;
        if (appCompatButton != null) {
            appCompatButton.setVisibility(8);
        }
        CastContext castContext2 = this.mc;
        if ((castContext2 == null || castContext2.getCastState() != 4) && (handler = this.streamPollHandler) != null) {
            handler.removeCallbacks(this.streamPollRunnable);
        }
    }

    public void switchFullscreen(boolean z) {
        PlayerControlView playerControlView = this.mPlayerControlView;
        if (playerControlView != null) {
            playerControlView.switchFullscreen(z);
        }
    }

    public void toggleControls() {
        PlayerControlView playerControlView;
        if (this.player_replay.getVisibility() == 0 || (playerControlView = this.mPlayerControlView) == null) {
            return;
        }
        if (this.isPlayingAd) {
            playerControlView.toggleAdControls();
        } else {
            playerControlView.toggleControls();
        }
    }

    public void tooglePlayer(boolean z) {
        if (this.player != null && isAdded() && getActivity() != null && getActivity().getPlayerCurrentState() != 0) {
            CastContext castContext = this.mc;
            if (castContext == null || castContext.getCastState() != 4) {
                this.player.setPlayWhenReady(z);
            } else {
                this.player.setPlayWhenReady(false);
            }
        }
        hideChromeCast();
    }

    public void updateFavouritesIcon() {
        ContentPage contentPage = this.contentPageItem;
        if (contentPage == null || contentPage.getPageButtons() == null || !this.contentPageItem.getPageButtons().getIsFavourite().booleanValue()) {
            this.playerFavouriteBtn.setImageDrawable(getResources().getDrawable(R.drawable.ic_favourite_inactive));
        } else {
            this.playerFavouriteBtn.setImageDrawable(getResources().getDrawable(R.drawable.ic_favourite_active));
        }
    }

    public void updateNextVideo() {
        if (this.mNextVideoLayout != null && this.playBackState == 4 && this.showNextVideo) {
            AppCompatButton appCompatButton = this.player_replay;
            if (appCompatButton != null && appCompatButton.getVisibility() == 0) {
                this.timer = null;
            }
            showReplayButton(false);
            showNextVideo();
        }
    }

    public void updatePlayerControls() {
        if (this.mIsError) {
            this.mIsError = false;
            setBackgroundImage("", true);
        }
        ImageView imageView = this.errorWarningImg;
        if (imageView != null) {
            imageView.setVisibility(8);
        }
        ImageView imageView2 = this.waterMark;
        if (imageView2 == null || imageView2.getVisibility() != 8) {
            return;
        }
        this.waterMark.setVisibility(0);
    }

    private void showToast(String str) {
        Toast.makeText((Context) getActivity(), (CharSequence) str, 1).show();
    }

    class AnonymousClass56 implements DialogListener {
        public final ExoPlayerFragment this$0;

        @Override
        public void itemClicked(boolean z, int i2, HashMap hashMap) {
            this.this$0.getActivity().signinPopupVisible = false;
            if (i2 == 0) {
                return;
            }
            if (i2 == 1) {
                NavigationUtils.loadScreenActivityForResult(this.this$0.getActivity(), ScreenType.SIGNIN, NavigationConstants.NAV_FROM_PLAYER, this.this$0.pagePath, 9, "", "");
            } else if (i2 == 2) {
                NavigationUtils.loadScreenActivityForResult(this.this$0.getActivity(), ScreenType.SIGNUP2, NavigationConstants.NAV_FROM_PLAYER, this.this$0.pagePath, 9, "", "");
            }
        }

        @Override
        public void itemClicked(boolean z, int i2, int i3) {
            this.this$0.getActivity().signinPopupVisible = false;
        }
    }

    public void onAttach(Activity activity) {
        super.onAttach(activity);
        this.mFragmentHost = (FragmentHost) activity;
    }

    private void startTimer(Long l) {
        if (l.longValue() < 1000) {
            return;
        }
        this.countDownTimer = new CountDownTimer(l.longValue(), 1000L) {
            @Override
            public void onFinish() {
                ExoPlayerFragment exoPlayerFragment = ExoPlayerFragment.this;
                exoPlayerFragment.takeTestButton.setText(exoPlayerFragment.takeTestButtonText);
                ExoPlayerFragment exoPlayerFragment2 = ExoPlayerFragment.this;
                exoPlayerFragment2.takeTestButton.setBackground(exoPlayerFragment2.getResources().getDrawable(R.drawable.action_background_onfocus));
            }

            @Override
            public void onTick(long j) {
                Object obj;
                Object obj2;
                int i2 = (int) (j / 60000);
                int i3 = ((int) (j % 60000)) / 1000;
                if (i2 > 9) {
                    AppCompatButton appCompatButton = ExoPlayerFragment.this.takeTestButton;
                    StringBuilder sb = new StringBuilder("Test will be enabled in ");
                    sb.append(i2);
                    sb.append(":");
                    if (i3 > 9) {
                        obj2 = Integer.valueOf(i3);
                    } else {
                        obj2 = "0" + i3;
                    }
                    sb.append(obj2);
                    appCompatButton.setText(sb.toString());
                    return;
                }
                AppCompatButton appCompatButton2 = ExoPlayerFragment.this.takeTestButton;
                StringBuilder sb2 = new StringBuilder("Test will be enabled in 0");
                sb2.append(i2);
                sb2.append(":");
                if (i3 > 9) {
                    obj = Integer.valueOf(i3);
                } else {
                    obj = "0" + i3;
                }
                sb2.append(obj);
                appCompatButton2.setText(sb2.toString());
            }
        }.start();
    }
}