QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

以下内容为反编译后的 H5VideoPlayer.java 源代码,内容仅作参考


package com.tencent.mtt.video.internal.player;

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.OrientationEventListener;
import android.view.Surface;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.FrameLayout;
import androidx.core.app.NotificationCompat;
import com.facebook.common.util.UriUtil;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.common.http.QueenConfig;
import com.tencent.common.manifest.EventEmiter;
import com.tencent.common.manifest.EventMessage;
import com.tencent.common.plugin.exports.QBPluginItemInfo;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.CpuInfoUtils;
import com.tencent.common.utils.FileUtils;
import com.tencent.common.utils.FileUtilsF;
import com.tencent.common.utils.StringUtils;
import com.tencent.common.utils.ThreadUtils;
import com.tencent.common.utils.UrlUtils;
import com.tencent.ilive.opensdk.params.SystemDictionary;
import com.tencent.mm.opensdk.modelmsg.WXVideoFileObject;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.utils.PlatformStatUtils;
import com.tencent.mtt.browser.download.engine.BaseDownloadServiceManager;
import com.tencent.mtt.browser.download.engine.DownloadTask;
import com.tencent.mtt.browser.file.facade.IFileStatService;
import com.tencent.mtt.browser.jsextension.open.IOpenJsApis;
import com.tencent.mtt.browser.setting.manager.UserSettingManager;
import com.tencent.mtt.hippy.dom.node.NodeProps;
import com.tencent.mtt.hippy.qb.modules.HippyQBLongVideoViewController;
import com.tencent.mtt.hippy.qb.modules.base.ICircleModule;
import com.tencent.mtt.hippy.qb.views.video.HippyQBVideoViewController;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.video.browser.export.constant.StatVideoConsts;
import com.tencent.mtt.video.browser.export.data.H5VideoEpisodeInfo;
import com.tencent.mtt.video.browser.export.data.VideoDefinition;
import com.tencent.mtt.video.browser.export.data.VideoWatermarkInfo;
import com.tencent.mtt.video.browser.export.db.VideoDbUtils;
import com.tencent.mtt.video.browser.export.db.VideoFileUtils;
import com.tencent.mtt.video.browser.export.engine.IPluginPrepareListener;
import com.tencent.mtt.video.browser.export.media.IMediaPlayer;
import com.tencent.mtt.video.browser.export.player.IPlayConfirmController;
import com.tencent.mtt.video.browser.export.player.IVideoWebViewProxy;
import com.tencent.mtt.video.browser.export.player.OnPlayConfirmListener;
import com.tencent.mtt.video.browser.export.player.ui.IPlayerControl;
import com.tencent.mtt.video.browser.export.player.ui.IVideoDownloadProxy;
import com.tencent.mtt.video.browser.export.player.ui.IVideoExtraAbilityControllerHolder;
import com.tencent.mtt.video.browser.export.player.ui.ext.IVideoViewExtCreator;
import com.tencent.mtt.video.browser.export.wc.WonderErrorCode;
import com.tencent.mtt.video.export.FeatureSupport;
import com.tencent.mtt.video.export.H5VideoInfo;
import com.tencent.mtt.video.export.IH5VideoPlayer;
import com.tencent.mtt.video.export.IMSEMediaPlayer;
import com.tencent.mtt.video.export.IMTTVideoPlayer;
import com.tencent.mtt.video.export.IPlayerEnvListener;
import com.tencent.mtt.video.export.IX5VideoPlayer;
import com.tencent.mtt.video.export.PlayerEnv;
import com.tencent.mtt.video.export.VideoHost;
import com.tencent.mtt.video.export.VideoProxyDefault;
import com.tencent.mtt.video.internal.adapter.PlayerSwitchController;
import com.tencent.mtt.video.internal.adapter.SuperPlayerPreloadManager;
import com.tencent.mtt.video.internal.adapter.VideoInfoParser;
import com.tencent.mtt.video.internal.data.H5VideoDataManager;
import com.tencent.mtt.video.internal.engine.RotateManager;
import com.tencent.mtt.video.internal.engine.ScreenBrightnessManager;
import com.tencent.mtt.video.internal.engine.VideoAsyncExecutor;
import com.tencent.mtt.video.internal.engine.VideoConcurrentMgr;
import com.tencent.mtt.video.internal.engine.VideoManager;
import com.tencent.mtt.video.internal.engine.VideoNetworkStatus;
import com.tencent.mtt.video.internal.engine.VideoPrefDefine;
import com.tencent.mtt.video.internal.engine.VideoSettingManager;
import com.tencent.mtt.video.internal.facade.IVideoService;
import com.tencent.mtt.video.internal.facade.inner.IVideoServiceInner;
import com.tencent.mtt.video.internal.facade.tvideo.TVideoUserInfo;
import com.tencent.mtt.video.internal.media.IHWDecodeAvailableListenter;
import com.tencent.mtt.video.internal.media.IMediaPlayerInter;
import com.tencent.mtt.video.internal.media.MSEMediaPlayer;
import com.tencent.mtt.video.internal.media.MediaPlayerImpl;
import com.tencent.mtt.video.internal.media.MediaPlayerSelector;
import com.tencent.mtt.video.internal.media.SuperPlayerInitializer;
import com.tencent.mtt.video.internal.media.SuperPlayerSdkLoader;
import com.tencent.mtt.video.internal.media.WonderPlayer;
import com.tencent.mtt.video.internal.media.WonderPlayerSoSession;
import com.tencent.mtt.video.internal.player.definition.VideoDefinitionController;
import com.tencent.mtt.video.internal.player.ui.H5VideoMediaController;
import com.tencent.mtt.video.internal.player.ui.SubtitleController;
import com.tencent.mtt.video.internal.player.ui.VideoGestureDispatcher;
import com.tencent.mtt.video.internal.player.ui.WonderVideoView;
import com.tencent.mtt.video.internal.player.ui.guide.H5VideoGuideConstantsKt;
import com.tencent.mtt.video.internal.player.ui.panel.VideoMediaControllerStatusBtn;
import com.tencent.mtt.video.internal.player.ui.panel.VideoMediaControllerView;
import com.tencent.mtt.video.internal.player.ui.render.QBVideoRenderer;
import com.tencent.mtt.video.internal.player.ui.render.QBVideoRendererErrorListener;
import com.tencent.mtt.video.internal.player.ui.settings.H5VideoSettingCenter;
import com.tencent.mtt.video.internal.resource.VideoResources;
import com.tencent.mtt.video.internal.restore.VideoPlayRestoreKt;
import com.tencent.mtt.video.internal.stat.LiteWindowStat;
import com.tencent.mtt.video.internal.stat.SuperPlayerCoverageStat;
import com.tencent.mtt.video.internal.stat.TimingStat;
import com.tencent.mtt.video.internal.stat.VideoErrorStatSession;
import com.tencent.mtt.video.internal.stat.VideoLiveStatData;
import com.tencent.mtt.video.internal.stat.VideoPlayTimeStat;
import com.tencent.mtt.video.internal.stat.VideoPluginLoadStatSession;
import com.tencent.mtt.video.internal.stat.VideoStatData;
import com.tencent.mtt.video.internal.tvideo.TVideoCreatePlayerCallback;
import com.tencent.mtt.video.internal.tvideo.TVideoProxy;
import com.tencent.mtt.video.internal.tvideo.TVideoStatHelperKt;
import com.tencent.mtt.video.internal.tvideo.TVideoSurfaceCreator;
import com.tencent.mtt.video.internal.tvideo.TVideoUserInfoCallback;
import com.tencent.mtt.video.internal.utils.CommonUtils;
import com.tencent.mtt.video.internal.utils.DeviceUtils;
import com.tencent.mtt.video.internal.utils.LogUploadUtil;
import com.tencent.mtt.video.internal.utils.PackageUtils;
import com.tencent.mtt.video.internal.utils.PlayerLogGather;
import com.tencent.mtt.video.internal.utils.QueenGuideFeature;
import com.tencent.mtt.video.internal.utils.SafeBundleUtil;
import com.tencent.mtt.video.internal.utils.TaskUtils;
import com.tencent.mtt.video.internal.utils.VideoDebugTool;
import com.tencent.mtt.video.internal.utils.VideoLogHelper;
import com.tencent.mtt.video.internal.utils.VideoNetworkToastStrategy;
import com.tencent.mtt.video.internal.vr.interfaces.IPlayer;
import com.tencent.mtt.video.internal.vr.interfaces.IVREventListener;
import com.tencent.mtt.video.internal.vr.interfaces.VideoSurfaceCreatorBase;
import com.tencent.mtt.video.internal.wc.IWonderCacheTaskInter;
import com.tencent.mtt.video.internal.wc.PreloadManager;
import com.tencent.mtt.video.internal.wc.PreloadStat;
import com.tencent.mtt.video.internal.wc.WonderCacheManager;
import com.tencent.qqlive.tvkplayer.api.TVKPlayerVideoInfo;
import com.tencent.qqlive.tvkplayer.api.TVKUserInfo;
import com.tencent.thumbplayer.api.TPOptionalID;
import com.tencent.thumbplayer.core.common.TPDecoderType;
import com.tencent.thumbplayer.tplayer.plugins.report.TPReportKeys;
import com.xiaomi.mipush.sdk.Constants;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import qb.videosdk.forqb.BuildConfig;
import tmsdk.common.gourd.vine.IActionReportService;

public class H5VideoPlayer extends VideoPlayerBase implements IPluginPrepareListener, OnPlayConfirmListener, IPlayerControl, IMTTVideoPlayer, IPlayerEnvListener, IX5VideoPlayer, SuperPlayerPreloadManager.PreDownloadListener, IHWDecodeAvailableListenter, IMediaPlayerInter.IOnCacheStatusInfoListener, IMediaPlayerInter.ITvkAdvListener, IMediaPlayerInter.OnBufferingUpdateListener, IMediaPlayerInter.OnDepInfoListener, IMediaPlayerInter.OnTimedTextListener, IMediaPlayerInter.OnUpdateSurfaceListener, IMediaPlayerInter.OnVideoSizeChangedListener, IMediaPlayerInter.PlayerListener, WonderVideoView.OnViewInWindowChangedListener, PreloadStat.IPreloadListener {
    public static final boolean Q;
    boolean A;
    boolean B;
    int C;
    public boolean D;
    public int E;
    public boolean F;
    boolean G;
    public boolean H;
    boolean I;
    IVideoScreenControl J;
    public boolean K;
    public boolean L;
    int M;
    H5VideoSurfaceCreator N;
    int O;
    boolean P;
    VideoErrorStatSession R;
    public final VideoDefinitionController S;
    public final TVideoProxy T;
    H5VideoInfo U;
    int V;

    public H5VideoMediaController f72678a;
    private int aF;
    private Object aG;
    private int aH;
    private int aI;
    private byte aJ;
    private IPlayConfirmController aK;
    private String aL;
    private boolean aM;
    private boolean aN;
    private boolean aO;
    private int aP;
    private IVideoExtraAbilityControllerHolder aQ;
    private IVideoViewExtCreator aR;
    private SubtitleController aS;
    private int aT;
    private int aU;
    private int aV;
    private int aW;
    private boolean aX;
    private boolean aY;
    private boolean aZ;

    PreloadStat f72679b;
    private int bA;
    private int bB;
    private Throwable bC;
    private float bD;
    private float bE;
    private boolean bF;
    private Object bG;
    private Object bH;
    private Object bI;
    private boolean bJ;
    private boolean bK;
    private String bL;
    private VideoWindowManager bM;
    private List<IPlayer.IPlayerCallback> bN;
    private boolean bO;
    private Bundle bP;
    private boolean bQ;
    private boolean bR;
    private boolean bS;
    private boolean bT;
    private Boolean bU;
    private boolean bV;
    private boolean bW;
    private boolean bX;
    private boolean bY;
    private int bZ;
    private boolean ba;
    private int bb;
    private boolean bc;
    private boolean bd;
    private IVideoDownloadProxy be;
    private boolean bf;
    private boolean bg;
    private boolean bh;
    private boolean bi;
    private boolean bj;
    private int bk;
    private boolean bl;
    private boolean bm;
    private String bn;
    private long bo;
    private long bp;
    private long bq;
    private long br;
    private long bs;
    private int bt;
    private boolean bu;
    private int bv;
    private int bw;
    private String bx;
    private boolean by;
    private boolean bz;

    boolean f72680c;
    private boolean cA;
    private boolean cB;
    private boolean cC;
    private boolean cD;
    private boolean cE;
    private boolean cF;
    private String cG;
    private final PlayerLogGather cH;
    private String cI;
    private final QueenGuideFeature cJ;
    private boolean cK;
    private TimingStat cL;
    private final PlayerStage cM;
    private VideoPluginLoadStatSession cN;
    private int cO;
    private final H5VideoSettingCenter cP;
    private long cQ;
    private final VideoPlayTimeStat cR;
    private SuperPlayerSdkLoader.SuperPlayerSdkLoadCallback cS;
    private VideoNetworkToastStrategy cT;
    private final AtomicBoolean cU;
    private final Bundle cV;
    private int cW;
    private Bundle cX;
    private WindowManager cY;
    private OrientationEventListener cZ;
    private boolean ca;
    private PlayerClientEnv cb;
    private String cc;
    private String cd;
    private boolean ce;
    private int cf;
    private HashMap<String, String> cg;
    private boolean ch;
    private boolean ci;
    private String cj;
    private boolean ck;
    private boolean cl;
    private boolean cm;

    private boolean f72681cn;
    private boolean co;
    private String cp;
    private boolean cq;
    private boolean cr;
    private boolean cs;
    private PerformanceData ct;
    private int cu;
    private float cv;
    private boolean cw;
    private VideoWatermarkInfo cx;
    private String cy;
    private boolean cz;

    public String f72682d;
    String e;
    String f;
    WonderPlayerSoSession g;
    public int h;
    protected int i;
    protected int j;
    boolean k;
    boolean l;
    public H5VideoEpisoder m;
    FeatureSupport n;
    int o;
    VideoStatData p;
    VideoLiveStatData q;
    Handler r;
    protected boolean s;
    int t;
    public int u;
    public boolean v;
    boolean w;
    int x;
    int y;
    boolean z;

    public class AnonymousClass17 implements Runnable {

        final boolean f72699a;

        AnonymousClass17(boolean z) {
            this.f72699a = z;
        }

        @Override
        public void run() {
            final AtomicReference atomicReference = new AtomicReference();
            SuperPlayerSdkLoader.SuperPlayerSdkLoadCallback superPlayerSdkLoadCallback = new SuperPlayerSdkLoader.SuperPlayerSdkLoadCallback() {
                @Override
                public void a() {
                    if (H5VideoPlayer.this.B && AnonymousClass17.this.f72699a) {
                        H5VideoPlayer.this.r.sendMessage(H5VideoPlayer.this.r.obtainMessage(110, 0, 0));
                        H5VideoPlayer.this.Y.invokeWebViewClientMiscCallBackMethod("onVideoPluginDownloadStart", null);
                    }
                }

                @Override
                public void a(int i) {
                    if (H5VideoPlayer.this.B && AnonymousClass17.this.f72699a) {
                        H5VideoPlayer.this.r.sendMessage(H5VideoPlayer.this.r.obtainMessage(110, i, 0));
                        Bundle bundle = new Bundle();
                        bundle.putInt(NotificationCompat.CATEGORY_PROGRESS, i);
                        H5VideoPlayer.this.Y.invokeWebViewClientMiscCallBackMethod("onVideoPluginDownloadStart", bundle);
                    }
                }

                @Override
                public void a(final boolean z) {
                    TaskUtils.a(new Runnable() {
                        @Override
                        public void run() {
                            if (H5VideoPlayer.this.G || H5VideoPlayer.this.cS != atomicReference.get()) {
                                return;
                            }
                            if (z) {
                                H5VideoPlayer.this.cO();
                            } else {
                                H5VideoPlayer.this.G(SuperPlayerInitializer.a());
                            }
                        }
                    });
                }
            };
            atomicReference.set(superPlayerSdkLoadCallback);
            H5VideoPlayer.this.cS = superPlayerSdkLoadCallback;
            SuperPlayerSdkLoader.d().a(new SuperPlayerSdkLoader.WeakSuperPlayerSdkLoadCallback(superPlayerSdkLoadCallback), this.f72699a);
        }
    }

    public static class PerformanceData {

        String f72728a;

        long f72729b;

        String f72730c;

        long f72731d;

        private PerformanceData() {
        }
    }

    public static class PlayerClientEnv {

        public VideoProxyDefault f72732a;

        public PlayerEnv f72733b;

        public FeatureSupport f72734c;

        public H5VideoInfo f72735d;
        public boolean e;

        private PlayerClientEnv() {
        }
    }

    static {
        Q = VideoPrefDefine.a("ENABLE_PRELOAD_TO_FIRST_FRAME", 1) == 1;
    }

    public H5VideoPlayer(Context context) {
        super(context, null);
        this.f72679b = null;
        this.f72680c = false;
        this.f72682d = null;
        this.e = "";
        this.g = null;
        this.aG = new Object();
        this.h = -1;
        this.i = -1;
        this.j = -1;
        this.k = false;
        this.l = false;
        this.m = null;
        this.n = null;
        this.o = 1;
        this.aH = 0;
        this.aI = 99;
        this.aJ = (byte) 0;
        this.s = false;
        this.aK = null;
        this.t = 0;
        this.u = 3;
        this.v = false;
        this.w = true;
        this.x = -1;
        this.y = 0;
        this.z = false;
        this.A = false;
        this.aL = null;
        this.aM = false;
        this.aN = false;
        this.aP = -1;
        this.C = 0;
        this.D = false;
        this.E = 0;
        this.G = false;
        this.I = true;
        this.J = null;
        this.K = false;
        this.aS = null;
        this.aT = -1;
        this.aU = 0;
        this.aV = 0;
        this.aW = 2;
        this.aX = false;
        this.L = false;
        this.M = 0;
        this.aZ = false;
        this.ba = true;
        this.bb = 105;
        this.bc = false;
        this.bf = false;
        this.bg = false;
        this.bh = false;
        this.bi = false;
        this.bj = false;
        this.bk = 1;
        this.bl = false;
        this.bm = false;
        this.bn = "";
        this.bo = 0L;
        this.bp = 0L;
        this.bq = 0L;
        this.br = 0L;
        this.bs = 0L;
        this.bt = -8888;
        this.bv = 0;
        this.bw = 0;
        this.by = false;
        this.bB = 0;
        this.bD = 1.0f;
        this.bE = 1.0f;
        this.bK = false;
        this.bN = null;
        this.bP = null;
        this.bQ = true;
        this.bR = false;
        this.bU = null;
        this.bY = false;
        this.bZ = 24;
        this.ce = false;
        this.ch = false;
        this.ci = false;
        this.ck = false;
        this.cl = false;
        this.cm = false;
        this.f72681cn = true;
        this.co = false;
        this.cp = null;
        this.O = 1;
        this.cq = false;
        this.cr = false;
        this.cs = true;
        this.ct = null;
        this.cu = -1;
        this.cv = 1.0f;
        this.cw = false;
        this.cx = null;
        this.cy = "";
        this.cz = false;
        this.cA = false;
        this.cB = false;
        this.cC = false;
        this.cD = false;
        this.cE = false;
        this.cF = false;
        this.cG = "";
        this.P = false;
        this.cH = new PlayerLogGather(this);
        this.cJ = new QueenGuideFeature(this);
        this.cK = false;
        this.cL = new TimingStat(this);
        this.cM = new PlayerStage();
        this.R = new VideoErrorStatSession();
        this.cO = 0;
        this.cQ = 0L;
        this.cR = new VideoPlayTimeStat();
        this.cU = new AtomicBoolean();
        this.cV = new Bundle(9);
        this.cW = -1;
        this.cY = null;
        this.cZ = null;
        this.V = 0;
        this.f72678a = new H5VideoMediaController(context, this);
        this.J = new VideoScreenControl(this.Y, this);
        this.p = new VideoStatData(this.ab, this);
        this.av = new VideoSurfaceManager(this, this.Y);
        this.bM = new VideoWindowManager(context, this);
        this.N = new H5VideoSurfaceCreator(this.Y, this);
        this.q = new VideoLiveStatData(this.ab, this);
        this.m = new H5VideoEpisoder(this, this.n);
        this.cP = new H5VideoSettingCenter(this);
        this.S = new VideoDefinitionController(this);
        IVideoServiceInner iVideoServiceInner = (IVideoServiceInner) VideoManager.getInstance().getVideoHost().getVideoService();
        if (iVideoServiceInner != null) {
            this.aR = iVideoServiceInner.createVideoViewExtCreator(context);
            this.f72678a.setVideoViewExtCreator(this.aR);
        }
        this.T = new TVideoProxy(this, this.f72678a);
        this.S.a(this.T);
    }

    public H5VideoPlayer(Context context, VideoProxyDefault videoProxyDefault, PlayerEnv playerEnv, FeatureSupport featureSupport) {
        super(context, videoProxyDefault);
        this.f72679b = null;
        this.f72680c = false;
        this.f72682d = null;
        this.e = "";
        this.g = null;
        this.aG = new Object();
        this.h = -1;
        this.i = -1;
        this.j = -1;
        this.k = false;
        this.l = false;
        this.m = null;
        this.n = null;
        this.o = 1;
        this.aH = 0;
        this.aI = 99;
        this.aJ = (byte) 0;
        this.s = false;
        this.aK = null;
        this.t = 0;
        this.u = 3;
        this.v = false;
        this.w = true;
        this.x = -1;
        this.y = 0;
        this.z = false;
        this.A = false;
        this.aL = null;
        this.aM = false;
        this.aN = false;
        this.aP = -1;
        this.C = 0;
        this.D = false;
        this.E = 0;
        this.G = false;
        this.I = true;
        this.J = null;
        this.K = false;
        this.aS = null;
        this.aT = -1;
        this.aU = 0;
        this.aV = 0;
        this.aW = 2;
        this.aX = false;
        this.L = false;
        this.M = 0;
        this.aZ = false;
        this.ba = true;
        this.bb = 105;
        this.bc = false;
        this.bf = false;
        this.bg = false;
        this.bh = false;
        this.bi = false;
        this.bj = false;
        this.bk = 1;
        this.bl = false;
        this.bm = false;
        this.bn = "";
        this.bo = 0L;
        this.bp = 0L;
        this.bq = 0L;
        this.br = 0L;
        this.bs = 0L;
        this.bt = -8888;
        this.bv = 0;
        this.bw = 0;
        this.by = false;
        this.bB = 0;
        this.bD = 1.0f;
        this.bE = 1.0f;
        this.bK = false;
        this.bN = null;
        this.bP = null;
        this.bQ = true;
        this.bR = false;
        this.bU = null;
        this.bY = false;
        this.bZ = 24;
        this.ce = false;
        this.ch = false;
        this.ci = false;
        this.ck = false;
        this.cl = false;
        this.cm = false;
        this.f72681cn = true;
        this.co = false;
        this.cp = null;
        this.O = 1;
        this.cq = false;
        this.cr = false;
        this.cs = true;
        this.ct = null;
        this.cu = -1;
        this.cv = 1.0f;
        this.cw = false;
        this.cx = null;
        this.cy = "";
        this.cz = false;
        this.cA = false;
        this.cB = false;
        this.cC = false;
        this.cD = false;
        this.cE = false;
        this.cF = false;
        this.cG = "";
        this.P = false;
        this.cH = new PlayerLogGather(this);
        this.cJ = new QueenGuideFeature(this);
        this.cK = false;
        this.cL = new TimingStat(this);
        this.cM = new PlayerStage();
        this.R = new VideoErrorStatSession();
        this.cO = 0;
        this.cQ = 0L;
        this.cR = new VideoPlayTimeStat();
        this.cU = new AtomicBoolean();
        this.cV = new Bundle(9);
        this.cW = -1;
        this.cY = null;
        this.cZ = null;
        this.V = 0;
        this.ax = playerEnv;
        this.Y = videoProxyDefault;
        PlayerStatKt.a(this, "H5VideoPlayer.init2");
        if (r(this.Y.getProxyType())) {
            this.N = new H5VideoSurfaceCreator(this.Y, this);
        }
        this.n = featureSupport;
        this.p = new VideoStatData(this.ab, this);
        this.q = new VideoLiveStatData(this.ab, this);
        this.p.z = 0;
        this.m = new H5VideoEpisoder(this, this.n);
        this.av = new VideoSurfaceManager(this, this.Y);
        this.bM = new VideoWindowManager(context, this);
        this.J = new VideoScreenControl(this.Y, this);
        this.bN = new ArrayList();
        this.f72678a = new H5VideoMediaController(context, this);
        this.cP = new H5VideoSettingCenter(this);
        this.S = new VideoDefinitionController(this);
        this.T = new TVideoProxy(this, this.f72678a);
        this.S.a(this.T);
        IVideoServiceInner iVideoServiceInner = (IVideoServiceInner) VideoManager.getInstance().getVideoHost().getVideoService();
        if (iVideoServiceInner != null) {
            this.aR = iVideoServiceInner.createVideoViewExtCreator(context);
            this.f72678a.setVideoViewExtCreator(this.aR);
        }
        if (videoProxyDefault != null && r(videoProxyDefault.getProxyType())) {
            Object invokeWebViewClientMiscCallBackMethod = videoProxyDefault.invokeWebViewClientMiscCallBackMethod("getWebViewStatData", null);
            if (invokeWebViewClientMiscCallBackMethod instanceof Bundle) {
                this.cX = (Bundle) invokeWebViewClientMiscCallBackMethod;
            }
        }
        this.r = new Handler(Looper.getMainLooper()) {
            @Override
            public void handleMessage(Message message) {
                if (H5VideoPlayer.this.G) {
                    return;
                }
                int i = message.what;
                if (i == 114) {
                    if (H5VideoPlayer.this.O != 5) {
                        VideoManager.getInstance().requestActive(H5VideoPlayer.this);
                        return;
                    }
                    return;
                }
                if (i == 122) {
                    boolean z = message.obj instanceof String;
                    return;
                }
                if (i == 211) {
                    H5VideoPlayer.this.dt();
                    return;
                }
                if (i == 213) {
                    Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,H5VideoPlayer::handleMessage(SHOWPLAYERERROR)");
                    if (H5VideoPlayer.this.X == null || H5VideoPlayer.this.o != 1 || H5VideoPlayer.this.A) {
                        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer," + String.format("H5VideoPlayer::handleMessage(SHOWPLAYERERROR) 2...", new Object[0]));
                        H5VideoPlayer h5VideoPlayer = H5VideoPlayer.this;
                        h5VideoPlayer.s = true;
                        if (h5VideoPlayer.aN && message.arg2 == 3014) {
                            H5VideoPlayer.this.aN = false;
                            H5VideoPlayer.this.p.a(H5VideoPlayer.this.getCurrentPosition(), IMediaPlayer.ERROR_DATADIR_NO_SPACE, -1, "");
                        }
                        H5VideoPlayer.this.sendErrorToUI(message.arg1, message.arg2);
                        return;
                    }
                    H5VideoPlayer.this.y = IMediaPlayer.ERROR_NO_WONDER_SO_BASE;
                    if (message.arg2 >= 1 && message.arg2 <= 16) {
                        H5VideoPlayer.this.y = IMediaPlayer.ERROR_NO_WONDER_SO_BASE - message.arg2;
                    }
                    if (message.arg2 == -10299) {
                        H5VideoPlayer.this.y = IMediaPlayer.ERROR_UNZIP_SO_FAILED;
                    }
                    if (!VideoNetworkStatus.a().f()) {
                        H5VideoPlayer h5VideoPlayer2 = H5VideoPlayer.this;
                        if (!h5VideoPlayer2.c(h5VideoPlayer2.as)) {
                            H5VideoPlayer h5VideoPlayer3 = H5VideoPlayer.this;
                            h5VideoPlayer3.s = true;
                            h5VideoPlayer3.y = -10110;
                            h5VideoPlayer3.p.a(0L, WonderErrorCode.ERROR_SYS_NO_WDP_PLUGIN, 0, null);
                            H5VideoPlayer.this.sendErrorToUI(message.arg1, 3012);
                            H5VideoPlayer.super.onError(null, WonderErrorCode.ERROR_SYS_NO_WDP_PLUGIN, 3012, null);
                            return;
                        }
                    }
                    H5VideoPlayer.this.ac = IMediaPlayer.PlayerType.SYSTEM_PLAYER;
                    H5VideoPlayer.this.K();
                    H5VideoPlayer.this.a(IMediaPlayer.DecodeType.UNKNOW, true);
                    return;
                }
                if (i == 216) {
                    if (H5VideoPlayer.this.X != null) {
                        H5VideoPlayer.this.X.d();
                    }
                    H5VideoPlayer.this.sendErrorToUI(201, 1);
                    H5VideoPlayer.this.s = true;
                    return;
                }
                if (i == 300) {
                    if (H5VideoPlayer.this.p.J) {
                        Bundle data = message.getData();
                        String string = data.getString("key_get_ip_url");
                        String string2 = data.getString("key_url_ip");
                        if (TextUtils.equals(string, H5VideoPlayer.this.L())) {
                            H5VideoPlayer.this.p.B = string2;
                            H5VideoPlayer.this.q.v = string2;
                            return;
                        }
                        return;
                    }
                    return;
                }
                if (i == 302) {
                    H5VideoPlayer.this.a((String) message.obj);
                    return;
                }
                if (i == 128) {
                    if (H5VideoPlayer.this.aS == null || message.obj == null || !(message.obj instanceof String)) {
                        return;
                    }
                    H5VideoPlayer.this.aS.showTextSubtitle((String) message.obj);
                    return;
                }
                if (i == 129) {
                    H5VideoMediaController h5VideoMediaController = H5VideoPlayer.this.f72678a;
                    return;
                }
                switch (i) {
                    case 109:
                        H5VideoPlayer h5VideoPlayer4 = H5VideoPlayer.this;
                        h5VideoPlayer4.E = 1;
                        h5VideoPlayer4.p.a("PlayerStateDepr", 1);
                        H5VideoPlayer.this.updateControlView();
                        H5VideoPlayer.this.f72678a.m(0);
                        return;
                    case 110:
                        if (H5VideoPlayer.this.E != 1) {
                            H5VideoPlayer h5VideoPlayer5 = H5VideoPlayer.this;
                            h5VideoPlayer5.E = 1;
                            h5VideoPlayer5.p.a("PlayerStateDepr", 1);
                            H5VideoPlayer.this.updateControlView();
                        }
                        H5VideoPlayer.this.f72678a.m(message.arg1);
                        return;
                    case 111:
                        H5VideoPlayer h5VideoPlayer6 = H5VideoPlayer.this;
                        h5VideoPlayer6.E = 7;
                        h5VideoPlayer6.p.a("PlayerStateDepr", 7);
                        H5VideoPlayer.this.bo = SystemClock.elapsedRealtime();
                        H5VideoPlayer.this.updateControlView();
                        return;
                    default:
                        switch (i) {
                            case 124:
                                H5VideoPlayer.this.b(message.arg1, message.arg2 == 1);
                                return;
                            case 125:
                                if (message.obj == null || !(message.obj instanceof String)) {
                                    return;
                                }
                                H5VideoPlayer.this.m.d((String) message.obj);
                                return;
                            case 126:
                                int i2 = message.arg1;
                                int i3 = message.arg2;
                                if (H5VideoPlayer.this.cr()) {
                                    H5VideoPlayer.this.f72678a.a(i2, i3, message.obj instanceof Throwable ? (Throwable) message.obj : null);
                                } else {
                                    if (!H5VideoPlayer.this.aN) {
                                        if (CpuInfoUtils.isSupportedCPU() && H5VideoPlayer.this.bh() != null && !H5VideoPlayer.this.bh().a() && H5VideoPlayer.this.ac == IMediaPlayer.PlayerType.SYSTEM_PLAYER) {
                                            H5VideoPlayer h5VideoPlayer7 = H5VideoPlayer.this;
                                            break;
                                        }
                                        H5VideoPlayer.this.f72678a.a(i2, i3, H5VideoPlayer.a(i3));
                                    }
                                    H5VideoPlayer.this.A = true;
                                    i2 = 207;
                                    H5VideoPlayer.this.f72678a.a(i2, i3, H5VideoPlayer.a(i3));
                                }
                                H5VideoPlayer.this.a(i3, i2, (String) null);
                                return;
                            default:
                                switch (i) {
                                    case 132:
                                        if (H5VideoPlayer.this.aS != null) {
                                            H5VideoPlayer.this.aS.addSubtitleView();
                                            return;
                                        }
                                        return;
                                    case 133:
                                        if (H5VideoPlayer.this.isPlaying() && !H5VideoPlayer.this.f() && H5VideoPlayer.this.cO < 2) {
                                            H5VideoPlayer.b(H5VideoPlayer.this);
                                            H5VideoPlayer.this.cH.a("real show no data tips, current frequency=" + H5VideoPlayer.this.cO);
                                            H5VideoPlayer.this.f72678a.an();
                                        }
                                        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,MSG_SHOW_NO_DATA_TIPS");
                                        H5VideoPlayer.this.x(6000);
                                        return;
                                    case 134:
                                        H5VideoPlayer.this.b(message.arg1, false);
                                        return;
                                    case TPOptionalID.OPTION_ID_BEFORE_BOOL_ENABLE_PLAYER_TIMER_THREAD:
                                        try {
                                            Process.setThreadPriority(-4);
                                            return;
                                        } catch (Exception unused) {
                                            return;
                                        }
                                    case TPOptionalID.OPTION_ID_BEFORE_LONG_DEMXUER_TYPE:
                                        H5VideoPlayer.this.aO();
                                        return;
                                    default:
                                        return;
                                }
                        }
                }
            }
        };
        this.ax.setPlayerEnvLisenter(this);
        ScreenBrightnessManager.c(VideoManager.getInstance().getApplicationContext());
        if (Looper.getMainLooper() == Looper.myLooper()) {
            try {
                Process.setThreadPriority(-4);
            } catch (Exception unused) {
            }
        } else {
            this.r.sendMessage(this.r.obtainMessage(TPOptionalID.OPTION_ID_BEFORE_BOOL_ENABLE_PLAYER_TIMER_THREAD));
        }
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,h5videoplayer create");
    }

    private void A(int i) {
        if (i == 102) {
            d(aB());
            b(aB(), 2);
            if (!this.F) {
                return;
            }
        } else if (i == 104) {
            d(aB());
            b(aB(), 3);
            if (!this.F) {
                return;
            }
        } else {
            if (i != 105) {
                if (i == 107) {
                    d(aB());
                    dm();
                    return;
                }
                return;
            }
            d(aB());
            b(aB(), 4);
            if (!this.F) {
                return;
            }
        }
        VideoManager.getInstance().requestActive(this);
    }

    private void B(int i) {
        if (i == 102) {
            d(aB());
            b(aB(), 2);
            if (!this.F) {
                return;
            }
        } else {
            if (i != 104) {
                if (i == 105) {
                    b(aB(), 4);
                    return;
                } else {
                    if (i == 107) {
                        d(aB());
                        dm();
                        return;
                    }
                    return;
                }
            }
            d(aB());
            b(aB(), 3);
            if (!this.F) {
                return;
            }
        }
        VideoManager.getInstance().requestActive(this);
    }

    private void C(int i) {
        String aB;
        int i2;
        if (i == 102) {
            aB = aB();
            i2 = 2;
        } else {
            if (i != 104) {
                if (i == 105) {
                    return;
                }
                if (i != 101 && i != 103 && i != 109 && i == 107) {
                    dm();
                    return;
                } else {
                    e(aB());
                    x();
                    return;
                }
            }
            aB = aB();
            i2 = 3;
        }
        b(aB, i2);
    }

    private void D(int i) {
        String aB;
        int i2;
        if (i == 102) {
            aB = aB();
            i2 = 2;
        } else {
            if (i == 104) {
                return;
            }
            if (i != 105) {
                if (i != 101 && i != 103 && i != 109 && i == 107) {
                    dm();
                    return;
                } else {
                    e(aB());
                    x();
                    return;
                }
            }
            aB = aB();
            i2 = 4;
        }
        b(aB, i2);
    }

    private void E(int i) {
        String aB;
        int i2;
        if (i == 102) {
            return;
        }
        if (i == 104) {
            aB = aB();
            i2 = 3;
        } else {
            if (i != 105) {
                if (i != 101 && i != 103 && i != 109 && i != 111 && i == 107) {
                    dm();
                    return;
                } else {
                    e(aB());
                    x();
                    return;
                }
            }
            aB = aB();
            i2 = 4;
        }
        b(aB, i2);
    }

    private boolean F(int i) {
        return s(getProxyType()) && i != 100 && getScreenMode() != i && p();
    }

    public void G(int i) {
        if (this.O == 5) {
            this.B = false;
            return;
        }
        if (i == 3014) {
            this.aN = true;
        }
        Message obtainMessage = this.r.obtainMessage(213);
        obtainMessage.arg1 = 201;
        obtainMessage.arg2 = i;
        this.r.sendMessage(obtainMessage);
    }

    private void H(int i) {
        if (!this.T.t() || this.T.c(i)) {
            if (i >= getDuration()) {
                i = 0;
            }
            if (this.H && this.T.t()) {
                this.T.a(this.H, i);
            }
            a(i, false);
        }
    }

    private int a(IMediaPlayerInter iMediaPlayerInter, int i, int i2) {
        if (this.X != null) {
            this.X.a(i, i2);
        }
        if (this.ah <= 0 || this.ai <= 0) {
            return -1;
        }
        int i3 = this.ah > this.ai ? 102 : -1;
        if (this.ah < this.ai) {
            return 104;
        }
        return i3;
    }

    private Bitmap a(Bitmap bitmap) {
        TextureView ck = ck();
        if (ck != null) {
            return ck.getBitmap(bitmap);
        }
        return null;
    }

    public void a(int i, int i2, String str) {
        if (this.R.d()) {
            String str2 = this.as;
            if (TextUtils.isEmpty(str2)) {
                return;
            }
            String str3 = this.am;
            if (TextUtils.isEmpty(str3)) {
                str3 = this.cI;
            }
            if (TextUtils.isEmpty(str3)) {
                str3 = CommonUtils.a();
            }
            VideoErrorStatSession a2 = this.R.a();
            if (a2 == null) {
                return;
            }
            if (i != 0 && FileUtils.l(str2) && !new File(str2).exists()) {
                i = -500404;
            }
            a2.a(i).b(i2).a(str).b(this.Z == null ? null : String.valueOf(this.Z.getPlayerType())).c(str2).d(str3).c(Q()).a(this.Y).a(isLiveStreaming()).a(this.cL).b(this.cL).a(this.aq);
        }
    }

    private void a(Bundle bundle) {
        if (bundle.containsKey("videoMarkInfo_url")) {
            try {
                this.cx = new VideoWatermarkInfo(bundle.getString("videoMarkInfo_url"), Integer.parseInt(bundle.getString("videoMarkInfo_anchor", String.valueOf(1))), Integer.parseInt(bundle.getString("videoMarkInfo_x", "0")), Integer.parseInt(bundle.getString("videoMarkInfo_y", "0")), Integer.parseInt(bundle.getString("videoMarkInfo_w", "0")), Integer.parseInt(bundle.getString("videoMarkInfo_h", "0")), Integer.parseInt(bundle.getString("videoMarkInfo_alpha", "100")));
                if (this.X != null) {
                    this.X.setVideoWatermarkInfo(this.cx);
                }
            } catch (Exception unused) {
            }
        }
    }

    public void a(H5VideoInfo h5VideoInfo, int i) {
        String str;
        int g;
        PreloadStat b2 = PreloadManager.a().b(h5VideoInfo.mVideoUrl);
        if (this.G) {
            if (b2 != null) {
                PreloadManager.a().c(h5VideoInfo.mVideoUrl);
                b2.a((PreloadStat.IPreloadListener) null);
                return;
            }
            return;
        }
        if (b2 != null) {
            b2.a(i);
            b2.a(this);
            return;
        }
        int a2 = PreloadManager.a().a(h5VideoInfo.mVideoUrl);
        if (a2 == 1 || a2 == 2 || a2 == 3) {
            a(h5VideoInfo.mVideoUrl, a2, String.valueOf(a2));
            return;
        }
        if (a2 == 4) {
            IWonderCacheTaskInter c2 = VideoManager.getInstance().getWonderCacheManager().c(h5VideoInfo.mVideoUrl);
            if (c2 == null) {
                return;
            }
            str = h5VideoInfo.mVideoUrl;
            g = c2.g();
        } else {
            if (a2 != 6) {
                return;
            }
            str = h5VideoInfo.mVideoUrl;
            g = 100;
        }
        a(str, g);
    }

    private void a(IMediaPlayerInter iMediaPlayerInter) {
        super.onPrepared(iMediaPlayerInter);
        PlayerStatKt.a(this, "H5VideoPlayer.doOnPrepared");
        dw();
        this.s = false;
        IMediaPlayer.DecodeType decodeType = IMediaPlayer.DecodeType.UNKNOW;
        if (this.Z != null) {
            decodeType = this.Z.getCurPlayerDecodeType();
        }
        if (decodeType == null) {
            Logs.e(IH5VideoPlayer.TAG, "H5VideoPlayer," + getClass().getName() + " doOnPrepared() mPlayer.getCurPlayerDecodeType() is null");
            decodeType = IMediaPlayer.DecodeType.UNKNOW;
        }
        IMediaPlayer.DecodeType decodeType2 = decodeType;
        this.p.a(this, iMediaPlayerInter, this.ah, this.ai, decodeType2);
        this.q.a(this, iMediaPlayerInter, this.ah, this.ai, decodeType2);
        this.aP = -1;
        int i = this.h;
        if (i > 0) {
            H(i);
        } else {
            this.T.G();
        }
        if (this.ag) {
            if (cr() && this.Z != null) {
                this.Z.misCallMothed(208, this.T.i());
            }
            if (getScreenMode() != 101 || S()) {
                H5VideoInfo a2 = a(this.aq);
                if (this.x == 0 || a2 != null) {
                    if (this.O != 5 || this.P) {
                        cP();
                    }
                    if (!VideoManager.getInstance().isActivityActived()) {
                        d(2);
                    }
                    this.cH.a("Try to autoPause for onPrepared");
                    cU();
                    if (!r(this.Y.getProxyType()) || cr()) {
                        this.f72678a.q();
                    }
                    if (this.T.t()) {
                        this.f72678a.U();
                    }
                    a("preparedOver", (Bundle) null);
                }
            }
            a(false, true);
            if (!VideoManager.getInstance().isActivityActived()) {
            }
            this.cH.a("Try to autoPause for onPrepared");
            cU();
            if (!r(this.Y.getProxyType())) {
            }
            this.f72678a.q();
            if (this.T.t()) {
            }
            a("preparedOver", (Bundle) null);
        }
    }

    private void a(IMediaPlayerInter iMediaPlayerInter, int i, int i2, Throwable th) {
        int i3;
        String str;
        int i4;
        if (this.ac != IMediaPlayer.PlayerType.SYSTEM_PLAYER || (i3 = this.y) == 0) {
            i3 = i;
        } else {
            Throwable th2 = this.bC;
            if (th2 != null) {
                th = th2;
            }
        }
        if (iMediaPlayerInter == null || !(iMediaPlayerInter instanceof WonderPlayer)) {
            if (th != null) {
                this.p.a("javaLog", CommonUtils.a(th));
            }
            str = "";
            i4 = 0;
        } else {
            WonderPlayer wonderPlayer = (WonderPlayer) iMediaPlayerInter;
            int httpStatus = wonderPlayer.getHttpStatus();
            String jumpUrl = wonderPlayer.getJumpUrl((String) null);
            int i5 = httpStatus != -1 ? httpStatus : 0;
            this.p.a("javaLog", th != null ? CommonUtils.a(th) : wonderPlayer.getConnException());
            i4 = i5;
            str = jumpUrl;
        }
        this.p.a(getCurrentPosition(), i3, i4, str);
        this.q.o = i3;
    }

    public void a(IMediaPlayerInter iMediaPlayerInter, Throwable th, Object obj, int i, int i2) {
        PlayerStatKt.a(this, "H5VideoPlayer.doPlayerCreated");
        this.cM.a(50);
        if (!this.G && obj == this.bG) {
            this.aP = -1;
            if (iMediaPlayerInter == null) {
                onError(null, i2, 1, th);
                return;
            }
            this.Z = iMediaPlayerInter;
            this.aa = iMediaPlayerInter.getPlayerType();
            int i3 = this.W;
            this.W = 0;
            VideoDebugTool.a(this);
            if (this.T.t()) {
                this.bJ = false;
                bK();
                da();
                if (i3 >= 1) {
                    try {
                        this.Z.stop();
                        this.Z.reset();
                    } catch (Exception e) {
                        onError(null, WonderErrorCode.ERROR_SET_DATA_SOURCE_ERROR, 1, e);
                        return;
                    }
                }
                l("preparein");
                t();
                String b2 = this.S.b();
                if (b2 == null) {
                    b2 = TVideoProxy.A();
                }
                String str = b2;
                this.T.r();
                TVideoProxy.s();
                l("openTVKPlayer");
                IMediaPlayerInter iMediaPlayerInter2 = this.Z;
                Context context = this.ab;
                TVKUserInfo n = this.T.n();
                TVKPlayerVideoInfo m = this.T.m();
                int i4 = this.h;
                iMediaPlayerInter2.openTVKPlayer(context, n, m, str, i4 < 0 ? 0L : i4, 0L);
            } else {
                if (m(this.as)) {
                    Bundle a2 = SafeBundleUtil.a();
                    boolean z = CommonUtils.n(this.am) || this.bS;
                    PlatformStatUtils.a(r(getProxyType()) ? z ? "TVK_ADV_ON_WEB" : "TVK_ADV_OFF_WEB" : z ? "TVK_ADV_ON_OTHER" : "TVK_ADV_OFF_OTHER");
                    a2.putBoolean("advOn", z);
                    if (z) {
                        this.Z.setTvkAdvViewContainer(this.f72678a.bd());
                        a2.putString(NodeProps.STYLE, this.bj ? "1" : "0");
                    }
                    if (!TextUtils.isEmpty(this.cd)) {
                        a2.putString("bucketId", this.cd);
                        this.p.d(this.cd);
                    }
                    this.Z.misCallMothed(202, a2);
                    Bundle a3 = SafeBundleUtil.a();
                    VideoManager.getInstance().getVideoHost().callHostFunction("getNetInfo", a3);
                    this.Z.misCallMothed(204, a3);
                    if (VideoNetworkStatus.a().e() && m(this.bL) && this.Z != null) {
                        Bundle a4 = SafeBundleUtil.a();
                        a4.putString("url", this.bL);
                        this.Z.misCallMothed(201, a4);
                        this.bL = null;
                    }
                }
                this.bJ = false;
                bK();
                da();
                try {
                    t();
                    l("preparein");
                } catch (Exception e2) {
                    onError(null, WonderErrorCode.ERROR_SET_DATA_SOURCE_ERROR, 1, e2);
                    return;
                }
            }
            SuperPlayerCoverageStat.a(this);
            this.E = 2;
            b(1000L);
            this.p.a("PlayerStateDepr", 2);
            this.p.b("isMidPlfPlayer", cZ());
            Bundle bundle = new Bundle();
            bundle.putString("playerType", cZ());
            this.Y.invokeWebViewClientMiscCallBackMethod("onPlayerCreated", bundle);
            PlayerStatKt.a(this, "H5VideoPlayer.doPlayerCreated2");
        }
    }

    private void a(VideoStatData videoStatData) {
        String str = this.e;
        if (TextUtils.isEmpty(str)) {
            return;
        }
        String replaceAll = str.replace(HiAnalyticsConstant.REPORT_VAL_SEPARATOR, "").replaceAll(" ", "");
        if (TextUtils.isEmpty(replaceAll)) {
            return;
        }
        try {
            videoStatData.o = replaceAll.getBytes("UTF-8");
        } catch (UnsupportedEncodingException unused) {
            videoStatData.o = replaceAll.getBytes();
        }
    }

    private static void a(VideoStatData videoStatData, ArrayList<IMTTVideoPlayer> arrayList) {
        Iterator<IMTTVideoPlayer> it = VideoManager.getInstance().getVideoPlayerList().iterator();
        while (it.hasNext()) {
            H5VideoPlayer h5VideoPlayer = (H5VideoPlayer) it.next();
            if (h5VideoPlayer.p.l == 5 || h5VideoPlayer.p.l == 2) {
                videoStatData.af++;
            } else if (h5VideoPlayer.p.l == 1) {
                videoStatData.ag++;
            }
        }
    }

    private void a(boolean z, boolean z2) {
        PlayerStatKt.a(this, "H5VideoPlayer.pause2");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,H5VideoPlayer::pause(),isStopDownload:" + z + ", pausedByUser:" + z2);
        if (isPlaying()) {
            this.q.a();
        }
        if (this.Z != null && this.W == 2) {
            SubtitleController subtitleController = this.aS;
            if (subtitleController != null) {
                subtitleController.setPause();
            }
            if (z || !this.F) {
                g(bb());
            }
            r();
            if (l(z)) {
                g(bb());
            }
            if (z2 || this.ac == IMediaPlayer.PlayerType.SYSTEM_PLAYER) {
                this.E = 4;
                this.p.a("PlayerStateDepr", 4);
                this.M = 100;
            }
            if (this.O != 5) {
                updateControlView();
            }
        }
        this.Y.onPaused();
        h();
        this.f72678a.ah();
        P();
        this.p.b(this.bO);
        Iterator<IPlayer.IPlayerCallback> it = this.bN.iterator();
        while (it.hasNext()) {
            it.next().onPause();
        }
        this.cR.b();
    }

    public static boolean a(int i) {
        return i == -10202 || i == -10205 || i == -10206 || i == -10110 || i == -21058 || i == -22040;
    }

    public static boolean a(int i, Bundle bundle) {
        return !(bundle != null ? bundle.getBoolean("maybe_retry", false) : false) && t(i) && i != -20999 && i < -20399;
    }

    private boolean a(H5VideoPlayer h5VideoPlayer, String str) {
        return cu() || (h5VideoPlayer != null && str.equals(h5VideoPlayer.getVideoUrl()));
    }

    static int b(H5VideoPlayer h5VideoPlayer) {
        int i = h5VideoPlayer.cO;
        h5VideoPlayer.cO = i + 1;
        return i;
    }

    private void b(Bundle bundle) {
        if (bundle != null) {
            this.cl = bundle.getBoolean("fullyControl", this.cl);
        }
    }

    private void b(IMediaPlayerInter iMediaPlayerInter, int i, int i2) {
        int a2;
        if (this.bg) {
            return;
        }
        this.bg = true;
        if (!bz() || (a2 = a(iMediaPlayerInter, i, i2)) == -1 || a2 == getScreenMode()) {
            return;
        }
        switchScreen(a2);
    }

    private void b(VideoStatData videoStatData) {
        int i;
        int i2 = this.cu;
        if (i2 != -1) {
            videoStatData.D = i2;
            return;
        }
        if (this.bV) {
            i = 9;
        } else if (this.bh) {
            i = this.bj ? 8 : 7;
        } else if (this.ax.getPlayerEnvType() == 4) {
            i = 6;
        } else if (this.ax.getPlayerEnvType() == 5) {
            videoStatData.D = 5;
            return;
        } else {
            if (isSdkMode()) {
                videoStatData.D = 4;
                return;
            }
            i = bx() ? 2 : FileUtils.l(this.as) ? 1 : 3;
        }
        videoStatData.D = i;
    }

    public void b(String str, Bundle bundle) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        Bundle a2 = SafeBundleUtil.a();
        a2.putString("url", getVideoUrl());
        if (bundle != null) {
            a2.putAll(bundle);
        }
        EventEmiter.getDefault().emit(new EventMessage(str, a2));
    }

    private boolean b(float f) {
        if (!ce() || f < 0.125f || f > 8.0f) {
            return false;
        }
        this.Z.setPlaySpeed(f);
        return true;
    }

    private boolean b(H5VideoInfo h5VideoInfo, int i) {
        if (!r(this.Y.getProxyType())) {
            return false;
        }
        if (!CommonUtils.d(h5VideoInfo.mWebUrl)) {
            if (this.B) {
                return false;
            }
            ad();
            return false;
        }
        if (!o(h5VideoInfo.mScreenMode) && h5VideoInfo.mScreenMode != 109 && h5VideoInfo.mScreenMode != 103) {
            h5VideoInfo.mScreenMode = 105;
        }
        if (this.B) {
            return true;
        }
        ad();
        return true;
    }

    private boolean b(String str, String str2, int i) {
        return VideoManager.getInstance().getVideoHost().isUrlInBlackList(str, str2, i);
    }

    private void c(String str, int i) {
        final Bundle a2 = SafeBundleUtil.a();
        a2.putString("url", str);
        a2.putInt("percent", i);
        BrowserExecutorSupplier.getInstance().getMainThreadExecutor().execute(new Runnable() {
            @Override
            public void run() {
                H5VideoPlayer.this.a("onPreloadEnd", a2);
            }
        });
    }

    private boolean c(int i, int i2) {
        return (i == 106 || (i == 101 && !isSupportHardwareMode())) && o(i2) && getViewContainer() != null;
    }

    private boolean c(Context context) {
        return (this.X != null && this.X.a(context)) || this.Y.getContext() == context;
    }

    private void cA() {
        PlayerStatKt.a(this, "H5VideoPlayer.prepareSoIfNeed");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,H5VideoPlayer.prepareSoIfNeed()");
        if (this.o == 1 && this.ac == IMediaPlayer.PlayerType.WONDER_PLAYER) {
            cB();
        }
    }

    private void cB() {
        PlayerStatKt.a(this, "H5VideoPlayer.doPrepareSo");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,PlayerSession, doPrepareSo");
        boolean z = c(this.as) && (bv() || !VideoNetworkStatus.a().f()) && !this.aM;
        VideoPluginLoadStatSession videoPluginLoadStatSession = PlayerSwitchController.a().c() ? new VideoPluginLoadStatSession("SUPER_PLAYER_PLUGIN") : new VideoPluginLoadStatSession("WONDER_PLAYER_PLUGIN");
        videoPluginLoadStatSession.a();
        this.cN = videoPluginLoadStatSession;
        bh().b(this, z);
    }

    private void cC() {
        if (this.X != null) {
            int i = this.aW;
            if (this.bV) {
                i = 5;
            } else {
                Boolean bool = this.bU;
                if (bool != null) {
                    i = bool.booleanValue() ? 4 : 2;
                }
            }
            if (i != this.aW) {
                this.X.a(i);
            }
        }
    }

    private void cD() {
        this.J.d();
    }

    private void cE() {
        int i;
        VideoStatData videoStatData;
        int i2;
        long currentPosition = getCurrentPosition();
        VideoStatData videoStatData2 = this.p;
        videoStatData2.f73696c = currentPosition;
        videoStatData2.f73695b = R();
        if (!cu() || this.O == 5) {
            this.p.e("pluginStatus", this.bt + "");
        } else {
            this.p.q = this.Z.getDownloadedSize();
            this.p.r = this.Z.getDownloadCostTime();
            this.p.t = this.Z.getHttpStatus();
            this.p.a("errorstate", this.Z.getErrorState());
            if (TextUtils.isEmpty(this.p.f)) {
                this.p.f = this.Z.getData(2);
                this.p.al = this.Z.getData(15);
                this.p.am = this.Z.getData(16);
            }
            if (this.p.u == 3000000 && !isLocalVideo()) {
                this.p.e("cacheStatus", this.bv + "");
                this.p.e("cacheErrorCode", this.bw + "");
                long realTimeDownloadedLen = this.Z.getRealTimeDownloadedLen();
                this.p.e("dowloadLen", realTimeDownloadedLen + "");
                if (this.bv == -21023) {
                    this.p.e(TPReportKeys.Common.COMMON_MEDIA_RATE, aN() + "");
                }
                this.p.a("cacheError", this.bx);
                int i3 = this.bv;
                if (i3 == -21022) {
                    i = this.bw;
                    if (i == 0) {
                        videoStatData = this.p;
                        i2 = 3000004;
                        videoStatData.u = i2;
                    }
                    this.p.u = i;
                } else {
                    if (i3 == -21023) {
                        videoStatData = this.p;
                        i2 = 3000005;
                    } else {
                        i = this.bw;
                        if (i == 0) {
                            videoStatData = this.p;
                            i2 = 3000006;
                        }
                        this.p.u = i;
                    }
                    videoStatData.u = i2;
                }
                this.p.t = this.bv;
            }
            if (this.bz) {
                this.bz = false;
                this.p.e("referRetry", this.bA + "");
            }
            if (this.bB != 0) {
                this.p.e("textContent", this.bB + "");
            }
            if (this.p.v == -1) {
                this.p.v = this.Z.getConnTime();
            }
        }
        if (this.Z != null) {
            this.p.f73696c = this.Z.getPlayTime();
        }
    }

    private void cF() {
        if (this.ag && this.bf && this.Z != null) {
            this.bf = false;
            this.p.d("DEN", this.Z.getData(10));
            this.p.d("PLA", "1");
            String data = this.Z.getData(8);
            if (TextUtils.isEmpty(data)) {
                data = "0";
            }
            this.p.d("ADF", data);
            String data2 = this.Z.getData(9);
            if (TextUtils.isEmpty(data2)) {
                data2 = "0";
            }
            this.p.d("SEK", data2);
        }
    }

    private int cG() {
        if (this.ah <= 0 || this.ai <= 0) {
            return -1;
        }
        return this.ah < this.ai ? bN() : this.ah > this.ai ? bM() : -1;
    }

    private void cH() {
        int i;
        int i2 = this.j;
        if (i2 < 0 || i2 > (i = this.aU) || i <= 0) {
            return;
        }
        n(i2);
    }

    private void cI() {
        this.p.g("versionName");
        if (this.p.f("versionName")) {
            return;
        }
        this.p.a("versionName", PackageUtils.a());
    }

    private void cJ() {
        PlayerEnv playerEnv = this.ax;
        if (playerEnv == null) {
            return;
        }
        if (isSdkMode() || playerEnv.getPlayerEnvType() == 2) {
            VideoManager.getInstance().getVideoHost().statThrdCallLogin();
        }
    }

    private void cK() {
        if (getProxyType() != 1) {
            return;
        }
        String str = this.as;
        String str2 = this.am;
        String str3 = this.e;
        SystemClock.elapsedRealtime();
        int i = this.ah;
        int i2 = this.ai;
        Bitmap bitmap = null;
        if (i > 0 && i2 > 0) {
            TextureView ck = ck();
            int min = Math.min(MttResources.s(112), ck != null ? ck.getWidth() : 0);
            int round = Math.round((min / i) * i2);
            if (min > 0 && round > 0) {
                bitmap = a(Bitmap.createBitmap(min, Math.round(round), Bitmap.Config.RGB_565));
            }
        }
        int duration = getDuration();
        final Bundle bundle = new Bundle();
        bundle.putString("videoUrl", str);
        bundle.putString("webUrl", str2);
        bundle.putString("title", str3);
        bundle.putParcelable("frame", bitmap);
        bundle.putInt("duration", duration);
        bundle.putInt("type", getProxyType());
        VideoAsyncExecutor.a().a(new Runnable() {
            @Override
            public void run() {
                H5VideoPlayer.this.b(IVideoService.EVENT_ON_VIDEO_START_SHOWING, bundle);
            }
        });
    }

    private boolean cL() {
        PlayerLogGather playerLogGather;
        String str;
        boolean z = this.P;
        this.P = false;
        if (this.O != 5 || !z) {
            return false;
        }
        pause(5);
        if (this.X != null) {
            this.X.e();
            this.X.i();
            if (this.X.getWidth() > 0 && this.X.getHeight() > 0) {
                this.Y.invokeWebViewClientMiscCallBackMethod("preloadedToFirstFrame", null);
                PlayerStatKt.a(this, "H5VideoPlayer.handlePreloadToFirstFrame");
                return true;
            }
            playerLogGather = this.cH;
            str = "Current videoView is not mounted, do not notify preloadedToFirstFrame.";
        } else {
            playerLogGather = this.cH;
            str = "Current videoView is not created, do not notify preloadedToFirstFrame.";
        }
        playerLogGather.a(str);
        PlayerStatKt.a(this, "H5VideoPlayer.handlePreloadToFirstFrame");
        return true;
    }

    private void cM() {
        VideoNetworkToastStrategy videoNetworkToastStrategy = this.cT;
        if (videoNetworkToastStrategy != null) {
            videoNetworkToastStrategy.b();
        }
    }

    private boolean cN() {
        VideoNetworkToastStrategy videoNetworkToastStrategy = this.cT;
        return videoNetworkToastStrategy == null || videoNetworkToastStrategy.a();
    }

    public void cO() {
        PlayerStatKt.a(this, "H5VideoPlayer.showVideoInMsg");
        if (this.bY || !MediaPlayerImpl.a()) {
            dt();
            return;
        }
        Message obtainMessage = this.r.obtainMessage(211);
        MediaPlayerImpl.a((IHWDecodeAvailableListenter) this);
        this.r.sendMessageDelayed(obtainMessage, 3000L);
    }

    private void cP() {
        PlayerStatKt.a(this, "H5VideoPlayer.start");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,start()");
        if (this.Z != null && p()) {
            if (!this.ag) {
                if (this.x == 0) {
                    this.E = 3;
                    this.p.a("PlayerStateDepr", 3);
                    VideoManager.getInstance().requestActive(this);
                    return;
                }
                return;
            }
            if (this.Y.isInPrefetchPage()) {
                d(1);
                return;
            }
            if (this.W == 2 && !isPlaying()) {
                if (this.ac == IMediaPlayer.PlayerType.SYSTEM_PLAYER && i(true)) {
                    return;
                }
                if (bb()) {
                    a(getCurrentPosition(), false);
                }
                this.Z.setOnVideoStartShowingListener(this);
                if (this.O != 5 && !this.F && !VideoManager.getInstance().requestActive(this)) {
                    VideoLogHelper.c(IH5VideoPlayer.TAG, "Cannot request active on start, ");
                    return;
                }
                PlayerStatKt.a(this, "H5VideoPlayer.start_doStart");
                M();
                this.E = 3;
                this.p.a("PlayerStateDepr", 3);
                if (cu() && (this.Z.getVideoHeight() == 0 || this.Z.getVideoWidth() == 0)) {
                    updateControlView();
                }
                this.k = false;
                this.D = false;
            }
            if (!bJ() && !this.co) {
                this.co = true;
                VideoManager.getInstance().requestAudioFocus();
            } else if (bJ() && this.co) {
                this.co = false;
                VideoManager.getInstance().abandonAudioFocus();
            }
        }
    }

    private boolean cQ() {
        return this.ao == IMediaPlayer.DecodeType.SW_SW;
    }

    private boolean cR() {
        boolean z = getScreenMode() == 103;
        boolean z2 = getScreenMode() == 109;
        boolean z3 = getScreenMode() == 107;
        boolean z4 = getScreenMode() == 106;
        boolean z5 = getScreenMode() == 111;
        boolean z6 = !this.cK && bz();
        this.cK = false;
        return z || z2 || z6 || z4 || z3 || z5;
    }

    private void cS() {
        if (!QBVideoRenderer.h() || cr()) {
            return;
        }
        this.aC.a(new QBVideoRendererErrorListener() {
            @Override
            public void a(final int i, final Throwable th) {
                TaskUtils.a(new Runnable() {
                    @Override
                    public void run() {
                        H5VideoPlayer.this.onError(H5VideoPlayer.this.Z, i, 0, th);
                    }
                });
            }
        });
        this.aC.b();
    }

    private void cT() {
        this.cI = CommonUtils.a();
    }

    private void cU() {
        if (aj()) {
            ah();
        }
    }

    private void cV() {
        PlayerStatKt.a(this, "H5VideoPlayer.notifyPlayerEnvReadyEvent");
        Bundle a2 = SafeBundleUtil.a();
        a2.putBoolean("ready", !aj());
        this.Y.invokeWebViewClientMiscCallBackMethod("onPlayerEnvReady", a2);
    }

    private void cW() {
        this.r.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (H5VideoPlayer.this.X == null || !H5VideoPlayer.this.J.c()) {
                    return;
                }
                H5VideoPlayer.this.X.invalidate();
            }
        }, 500L);
    }

    private boolean cX() {
        return !QueenConfig.isQueenEnable() && bv() && VideoSettingManager.a().m() && this.w && !c(this.as) && (E() || this.aK != null);
    }

    private void cY() {
        int i = this.E;
        if (i == 4 || i == 6 || i == 8 || !this.B || this.cl || this.f72678a.L()) {
            return;
        }
        if (r(getProxyType()) && !isLiveStreaming()) {
            this.cB = true;
        }
        c(2);
    }

    private String cZ() {
        return String.valueOf(al() == IMediaPlayer.PlayerType.SUPER_PLAYER ? 1 : 0);
    }

    private boolean cx() {
        boolean z;
        PreloadStat preloadStat;
        if (this.ac == IMediaPlayer.PlayerType.WONDER_PLAYER && (preloadStat = this.f72679b) != null) {
            long b2 = preloadStat.b();
            if (this.f72679b.e() != 1 ? !(this.f72679b.e() != 0 || b2 <= 1566720) : b2 > 524288) {
                z = true;
                return (z || isLiveStreaming()) ? false : true;
            }
        }
        z = false;
        if (z) {
        }
    }

    private boolean cy() {
        IPlayConfirmController iPlayConfirmController = this.aK;
        return iPlayConfirmController != null && iPlayConfirmController.isAlertDialogShowing();
    }

    private void cz() {
        this.ac = (!(this.n.support(4096L) && this.aq.mVideoUrl.toLowerCase().startsWith("rtsp:")) && !(this.n.support(8192L) && this.aq.mVideoUrl.toLowerCase().startsWith("content:")) && CpuInfoUtils.isSupportedCPU()) ? IMediaPlayer.PlayerType.WONDER_PLAYER : IMediaPlayer.PlayerType.SYSTEM_PLAYER;
        this.o = 1;
    }

    private boolean d(int i, int i2) {
        return (i2 == 106 || (i2 == 101 && !isSupportHardwareMode())) && this.J.n();
    }

    private void dA() {
        IVideoServiceInner iVideoServiceInner;
        if (this.Y == null || !r(this.Y.getProxyType()) || (iVideoServiceInner = (IVideoServiceInner) VideoManager.getInstance().getVideoHost().getVideoService()) == null || ThreadUtils.isMainProcess(ContextHolder.getAppContext())) {
            return;
        }
        iVideoServiceInner.addVideoHistory(this.e, getWebUrl(), VideoFileUtils.getVideoPicFilePath(getWebUrl()), getDuration());
    }

    private void da() {
        IMediaPlayer.DecodeType decodeType = IMediaPlayer.DecodeType.UNKNOW;
        if (cu()) {
            decodeType = this.Z.getCurPlayerDecodeType();
            if (!this.p.f("wdpversion")) {
                this.p.a("wdpversion", WonderPlayer.getVersion());
            }
        }
        if (this.Z != null) {
            if (decodeType == null) {
                Logs.e(IH5VideoPlayer.TAG, "H5VideoPlayer," + getClass().getName() + " statWdpInfo() mPlayer.getCurPlayerDecodeType() is null");
                decodeType = IMediaPlayer.DecodeType.UNKNOW;
            }
            this.p.a(this.Z, decodeType);
            bE();
        }
    }

    private void db() {
        if (!this.p.f("cpuversion")) {
            this.p.a("cpuversion", CpuInfoUtils.getCPUType());
        }
        if (!this.p.f("RON")) {
            this.p.a("RON", DeviceUtils.k());
        }
        this.q.h = DeviceUtils.k();
    }

    private void dc() {
        int i;
        if (this.ca || dd() || this.h > 0) {
            return;
        }
        m(this.aq);
        if (!m(this.as) || this.T.t()) {
            boolean r = r(this.Y.getProxyType());
            if (dl() || r) {
                this.h = 0;
                i = -1;
                this.i = -1;
            } else {
                H5VideoDataManager h5VideoDataManager = VideoManager.getInstance().getH5VideoDataManager();
                int playedTimeFromCache = h5VideoDataManager.getPlayedTimeFromCache(this.f72682d);
                if (playedTimeFromCache == -1000) {
                    H5VideoEpisodeInfo e = this.m.e(this.f72682d);
                    if (e != null) {
                        this.h = e.mPlayedTime;
                        this.i = e.mSelectedAudioIdx;
                        this.j = e.mSelectedSubtitleIdx;
                    }
                    h5VideoDataManager.b();
                    return;
                }
                this.h = playedTimeFromCache;
                this.i = h5VideoDataManager.a(this.f72682d);
                i = h5VideoDataManager.b(this.f72682d);
            }
            this.j = i;
        }
    }

    private boolean dd() {
        int j;
        if (!cr() || (j = this.T.j()) < 0) {
            return false;
        }
        this.cH.a("continuePlayPos=" + j + ", use it directly!");
        this.h = j;
        return true;
    }

    private void de() {
        if (this.X == null || this.L) {
            return;
        }
        this.f72678a.aE();
        this.L = true;
    }

    private void df() {
        PlayerStatKt.a(this, "H5VideoPlayer.showPlayConfirmMttDlg");
        if (this.F) {
            m();
            IPlayConfirmController iPlayConfirmController = this.aK;
            if (iPlayConfirmController != null) {
                iPlayConfirmController.dismiss();
            }
            IPlayConfirmController iPlayConfirmController2 = this.aK;
            if (iPlayConfirmController2 != null) {
                iPlayConfirmController2.showConfirmDlg(3, "");
                dg();
            }
        }
    }

    private void dg() {
        this.Y.invokeWebViewClientMiscCallBackMethod("onPlayStartPending", null);
    }

    private void dh() {
        IPlayConfirmController iPlayConfirmController = this.aK;
        if (iPlayConfirmController == null || !iPlayConfirmController.isShowing(2)) {
            m();
            if (!VideoManager.getInstance().is2g3gConfirmExpired()) {
                this.w = false;
                h(true);
                c(1);
            } else {
                IPlayConfirmController iPlayConfirmController2 = this.aK;
                if (iPlayConfirmController2 == null || iPlayConfirmController2.isShowing(2)) {
                    return;
                }
                this.aK.showConfirmDlg(2, "");
            }
        }
    }

    private boolean di() {
        return VideoManager.getInstance().isMttproxyActive() || bv();
    }

    private boolean dj() {
        return VideoNetworkStatus.a().e() && VideoManager.getInstance().getVideoHost().isEnableLoadImage();
    }

    private void dk() {
        this.r.removeMessages(133);
    }

    private boolean dl() {
        String str;
        return (!s(this.Y.getProxyType()) || (str = this.aL) == null || TextUtils.equals(str, this.as)) ? false : true;
    }

    private void dm() {
        b(aB(), 3);
    }

    private void dn() {
        if (this.bK) {
            return;
        }
        this.bK = true;
    }

    private void m53do() {
        int i;
        if (getScreenMode() == 103) {
            LiteWindowStat.a(this);
            return;
        }
        if (getScreenMode() == 109 || !this.cP.a() || this.cl || !this.B || (i = this.E) == 4 || i == 6) {
            return;
        }
        VideoManager.getInstance().getVideoHost().userBehaviorWithParams(StatVideoConsts.VALUE_EVENT_VIDEO_ACTION162, cg());
    }

    private void dp() {
        this.f72678a.makeText(cr() ? "正在使用流量播放" : VideoResources.b("video_sdk_wifi_to_2g3g_msg"));
        cM();
    }

    private void dq() {
        if (this.bq > 0) {
            this.p.e("nopdd", String.valueOf(SystemClock.elapsedRealtime() - this.bq));
            this.bq = 0L;
        }
    }

    private IMediaPlayer.DecodeType dr() {
        this.ao = IMediaPlayer.DecodeType.UNKNOW;
        if (this.ac == IMediaPlayer.PlayerType.WONDER_PLAYER) {
            this.ao = (this.bV || d() || (Z() && bh().a(this.o))) ? IMediaPlayer.DecodeType.SW_SW : MediaPlayerImpl.a(this.ab, this.bY);
        }
        return this.ao;
    }

    private IMediaPlayer.AudioDecodeType ds() {
        if (this.ac == IMediaPlayer.PlayerType.WONDER_PLAYER) {
            this.ap = MediaPlayerImpl.b(this.ab);
        }
        return this.ap;
    }

    public void dt() {
        PlayerStatKt.a(this, "H5VideoPlayer.showVideo");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,showVideo begin");
        K();
        dr();
        ds();
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,H5VideoPlayer.showVideo mDecodeType = " + this.ao + ",audiodecodetype:" + this.ap.getAllMcDecoderValue());
        a(this.ao, true);
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,showVideo end");
    }

    private void du() {
        IVideoExtraAbilityControllerHolder iVideoExtraAbilityControllerHolder;
        if (this.bu) {
            return;
        }
        this.bu = true;
        this.f72678a.a(this.aQ);
        if (this.be != null || (iVideoExtraAbilityControllerHolder = this.aQ) == null) {
            return;
        }
        this.be = (IVideoDownloadProxy) iVideoExtraAbilityControllerHolder.getExtraAbility(IVideoDownloadProxy.class, null);
    }

    public void dv() {
        boolean z;
        if (!cr()) {
            if (!PlayerSwitchController.a().c()) {
                z = this.aB.b() || G() || m(this.as);
            }
            m(z);
            return;
        }
        cO();
    }

    private void dw() {
        VideoAsyncExecutor a2;
        Runnable runnable;
        if (this.bV) {
            return;
        }
        final int i = 360000;
        final int i2 = 0;
        try {
            String data = this.Z.getData(0);
            r0 = TextUtils.isEmpty(data) ? -1 : Integer.parseInt(data);
            int videoMinBuffSize = VideoManager.getInstance().getVideoMinBuffSize();
            int videoMaxBuffSize = VideoManager.getInstance().getVideoMaxBuffSize();
            if (!VideoNetworkStatus.a().e()) {
                i2 = videoMinBuffSize;
                i = videoMaxBuffSize;
            }
            a2 = VideoAsyncExecutor.a();
            runnable = new Runnable() {
                @Override
                public void run() {
                    IWonderCacheTaskInter c2 = VideoManager.getInstance().getWonderCacheManager().c(H5VideoPlayer.this.as);
                    if (c2 != null) {
                        c2.a(r2, i2, i);
                    }
                }
            };
        } catch (Throwable unused) {
            int videoMinBuffSize2 = VideoManager.getInstance().getVideoMinBuffSize();
            int videoMaxBuffSize2 = VideoManager.getInstance().getVideoMaxBuffSize();
            if (!VideoNetworkStatus.a().e()) {
                i2 = videoMinBuffSize2;
                i = videoMaxBuffSize2;
            }
            a2 = VideoAsyncExecutor.a();
            runnable = new Runnable() {
                @Override
                public void run() {
                    IWonderCacheTaskInter c2 = VideoManager.getInstance().getWonderCacheManager().c(H5VideoPlayer.this.as);
                    if (c2 != null) {
                        c2.a(r2, i2, i);
                    }
                }
            };
        }
        a2.a(runnable);
    }

    private String dx() {
        return this.Z instanceof MSEMediaPlayer ? StatVideoConsts.VALUE_VIDEO_SOURCE_TYPE_MSE : isLocalVideo() ? StatVideoConsts.VALUE_VIDEO_SOURCE_TYPE_FILE : m(this.as) ? isLiveStreaming() ? StatVideoConsts.VALUE_VIDEO_SOURCE_TYPE_TVK_ZB : StatVideoConsts.VALUE_VIDEO_SOURCE_TYPE_TVK_DB : this.Y.getProxyType() == 6 ? "NATIVE" : r(this.Y.getProxyType()) ? isLiveStreaming() ? StatVideoConsts.VALUE_VIDEO_SOURCE_TYPE_WEB_ZB : StatVideoConsts.VALUE_VIDEO_SOURCE_TYPE_WEB_DB : StatVideoConsts.VALUE_VIDEO_SOURCE_TYPE_OTHER;
    }

    private String dy() {
        StringBuffer stringBuffer = new StringBuffer();
        HashMap hashMap = new HashMap();
        hashMap.put("EXP_VIDEO_PAUSE_AD_ID", VideoSettingManager.a().s() + "");
        for (String str : hashMap.keySet()) {
            if (stringBuffer.length() > 0) {
                stringBuffer.append(IActionReportService.COMMON_SEPARATOR);
            }
            stringBuffer.append(str);
            stringBuffer.append(Constants.COLON_SEPARATOR);
            stringBuffer.append(hashMap.get(str) == null ? "" : (String) hashMap.get(str));
        }
        return stringBuffer.toString();
    }

    private synchronized void dz() {
        String str = this.cy;
        this.cy = String.valueOf(System.currentTimeMillis());
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer, generalVideoPlayId, preId:" + str + ",curId:" + this.cy + ",url:" + getVideoUrl() + ",title:" + getVideoTitle());
    }

    private void e(int i, int i2) {
        if (i == 102) {
            E(i2);
        } else if (i == 104) {
            D(i2);
        }
        if (i == 105) {
            C(i2);
            return;
        }
        if (i == 101 || i == 106) {
            B(i2);
            return;
        }
        if (i == 103) {
            A(i2);
        } else if (i == 107) {
            y(i2);
        } else {
            z(i2);
        }
    }

    private static void e(View view) {
        if ((view == null || view.getParent() == null || !(view.getParent() instanceof ViewGroup)) ? false : true) {
            ((ViewGroup) view.getParent()).removeView(view);
        }
    }

    private void k(boolean z) {
        if (QBVideoRenderer.h()) {
            if (z) {
                this.aC.d();
            }
            boolean Z = Z();
            if (this.ah > 0 && this.ai > 0) {
                this.aC.a(this.ah, this.ai);
                if (Z) {
                    this.aC.b(this.ah, this.ai);
                }
            } else if (this.Z != null) {
                int videoWidth = this.Z.getVideoWidth();
                int videoHeight = this.Z.getVideoHeight();
                if (videoWidth > 0 && videoHeight > 0) {
                    this.aC.a(videoWidth, videoHeight);
                    if (Z) {
                        this.aC.b(videoWidth, videoHeight);
                    }
                }
            }
            if (!Z) {
                if (this.aj <= 0 || this.ak <= 0) {
                    int[] cj = cj();
                    if (cj[0] > 0 && cj[1] > 0) {
                        this.aC.b(cj[0], cj[1]);
                    }
                } else {
                    this.aC.b(this.aj, this.ak);
                }
            }
            this.aC.c();
        }
    }

    private static boolean k(H5VideoInfo h5VideoInfo) {
        return (h5VideoInfo.mExtraData == null || TextUtils.isEmpty(h5VideoInfo.mExtraData.getString("videoPageUrl"))) ? false : true;
    }

    private static boolean l(H5VideoInfo h5VideoInfo) {
        return h5VideoInfo.mVideoUrl != null && h5VideoInfo.mVideoUrl.toLowerCase().startsWith(UriUtil.HTTP_SCHEME);
    }

    private boolean l(boolean z) {
        return z || !this.F || (bv() && !c(this.as));
    }

    private void m(H5VideoInfo h5VideoInfo) {
        if (this.T.t() && m(this.as)) {
            this.f72682d = this.as;
            return;
        }
        this.f72682d = h5VideoInfo.mFromWhere == 2 ? h5VideoInfo.mVideoUrl : h5VideoInfo.mWebUrl;
        if (this.f72682d == null) {
            this.f72682d = h5VideoInfo.mVideoUrl;
        }
    }

    private void m(boolean z) {
        TaskUtils.a(new AnonymousClass17(z));
    }

    private synchronized void n(String str) {
        PlayerStatKt.a(this, "H5VideoPlayer.playInternal");
        if (this.aq != null && (!TextUtils.isEmpty(this.aq.mVideoUrl) || this.aw)) {
            Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,important time, playInternal cacheUrl " + str + " this = " + this);
            this.k = false;
            if (this.X != null) {
                this.X.setTranslucentSrc(this.cA);
            }
            cz();
            if (this.aq.mUA != null) {
                this.ad = this.aq.mUA;
            }
            Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,H5videoPlayer set videoUrl = " + this.aq.mVideoUrl);
            this.h = e(this.aq);
            if (!p()) {
                I();
                if (this.cJ.c()) {
                    this.w = false;
                    this.bc = true;
                }
                return;
            }
            this.as = this.aq.mVideoUrl;
            this.f72680c = true;
            String be = be();
            if (!TextUtils.isEmpty(be)) {
                if (TextUtils.equals(be, this.as)) {
                    if (this.f72679b != null && this.f72679b.c() && System.currentTimeMillis() - this.f72679b.f73921c > 3000) {
                        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,important time H5VideoPlayer.playInternal() cancel preloaded 3s ago");
                    }
                }
                bI();
            }
            i(this.aq);
            F();
        }
    }

    private boolean n(H5VideoInfo h5VideoInfo) {
        return h5VideoInfo != null && r(this.Y.getProxyType()) && CommonUtils.d(h5VideoInfo.mWebUrl);
    }

    private int o(String str) {
        int a2;
        if (!str.equals(TPDecoderType.TP_CODEC_MIMETYPE_AVC)) {
            if (str.equals(TPDecoderType.TP_CODEC_MIMETYPE_HEVC) && this.ao.h265IsMC()) {
                a2 = VideoSettingManager.a().a(str);
                if (a2 <= 0) {
                    return a2;
                }
                VideoSettingManager.a().a(str, a2 - 1);
                return a2;
            }
            return -1;
        }
        if (this.ao.h264IsMC()) {
            a2 = VideoSettingManager.a().a(str);
            if (a2 <= 0) {
                return a2;
            }
            VideoSettingManager.a().a(str, a2 - 1);
            return a2;
        }
        if (this.ao.isStageFright()) {
            int i = VideoSettingManager.a().i();
            if (i <= 0) {
                return i;
            }
            VideoSettingManager.a().b(i - 1);
            return i;
        }
        return -1;
    }

    public static boolean o(int i) {
        return i == 102 || i == 105 || i == 104;
    }

    private boolean o(H5VideoInfo h5VideoInfo) {
        return FeatureToggle.a(BuildConfig.BUG_TOGGLE_94216053) && h5VideoInfo != null && CommonUtils.a(h5VideoInfo.mExtraData, "preloadIgnoreNetwork");
    }

    private String p(String str) {
        String string = this.aq.mExtraData.containsKey(StatVideoConsts.KEY_CUR_FROM) ? this.aq.mExtraData.getString(StatVideoConsts.KEY_CUR_FROM) : str;
        return (TextUtils.isEmpty(string) || str.equals(string)) ? bx() ? "system" : r(this.Y.getProxyType()) ? "web" : string : string;
    }

    public static boolean p(int i) {
        return i == 102;
    }

    private String q(String str) {
        if (Z()) {
            return StatVideoConsts.VALUE_VIEWER_TYPE_SAME_LAYER;
        }
        switch (this.J.a()) {
            case 101:
                return "page";
            case 102:
            case 104:
            case 105:
            case 108:
                return StatVideoConsts.VALUE_VIEWER_TYPE_FULL_SCREEN;
            case 103:
                return StatVideoConsts.VALUE_VIEWER_TYPE_LITE_WINDOW;
            case 106:
                return StatVideoConsts.VALUE_VIEWER_TYPE_PAGE_WINDOW;
            case 107:
                return StatVideoConsts.VALUE_VIEWER_TYPE_SAME_LAYER;
            case 109:
                return StatVideoConsts.VALUE_VIEWER_TYPE_FULL_FLOAT;
            case 110:
                return StatVideoConsts.VALUE_VIEWER_TYPE_PAGE_FULL_FLOAT;
            case 111:
                return StatVideoConsts.VALUE_VIEWER_TYPE_BACKGROUND;
            default:
                return str;
        }
    }

    private void r(String str) {
        b(str, (Bundle) null);
    }

    public static boolean r(int i) {
        return i == 1;
    }

    public static boolean s(int i) {
        return i == 1 || i == 6;
    }

    public static boolean t(int i) {
        return (i == -21022 || i == -21023 || i == -21035 || i == -21036 || i == 0 || i == -21044 || i == -21045) ? false : true;
    }

    private void w(int i) {
        if (i == 101 && getScreenMode() == 110) {
            a("exitPageFloatMode", new Bundle());
        }
    }

    public void x(int i) {
        if (this.cO < 2) {
            if (ad()) {
                dk();
                this.r.sendEmptyMessageDelayed(133, i);
                return;
            }
            return;
        }
        VideoLogHelper.a(IH5VideoPlayer.TAG, "Already toast " + this.cO + " no data, return.");
    }

    private void y(int i) {
        String aB;
        int i2;
        if (i == 101 || i == 103 || i == 109) {
            e(aB());
            x();
            return;
        }
        if (i == 102) {
            aB = aB();
            i2 = 2;
        } else if (i == 104) {
            aB = aB();
            i2 = 3;
        } else {
            if (i != 105) {
                return;
            }
            aB = aB();
            i2 = 4;
        }
        b(aB, i2);
    }

    private void z(int i) {
        if (i == 102) {
            d(aB());
            b(aB(), 2);
            if (!this.F) {
                return;
            }
        } else if (i == 104) {
            d(aB());
            b(aB(), 3);
            if (!this.F) {
                return;
            }
        } else {
            if (i != 105) {
                if (i == 107) {
                    d(aB());
                    dm();
                    return;
                }
                return;
            }
            d(aB());
            b(aB(), 4);
            if (!this.F) {
                return;
            }
        }
        VideoManager.getInstance().requestActive(this);
    }

    protected void A() {
        PlayerStatKt.a(this, "H5VideoPlayer.resetPlayer1");
        this.cQ = 0L;
        this.q.g();
        e(true);
        this.f72678a.al();
        if (aT()) {
            this.f72678a.aY();
        }
        this.B = false;
        this.E = -1;
        this.p.a("PlayerStateDepr", -1);
        updateControlView();
        this.R.e();
        a(false, (Bundle) null);
        MediaPlayerImpl.b((IHWDecodeAvailableListenter) this);
        VideoManager.getInstance().getWonderCacheManager().d();
        this.av.g();
        PlayerStatKt.a(this, "H5VideoPlayer.resetPlayer2");
    }

    public int B() {
        if (this.bF) {
            return 2;
        }
        if (this.af) {
            return 1;
        }
        return !S() ? 3 : 4;
    }

    public void C() {
        PlayerStatKt.a(this, "H5VideoPlayer.destroy1");
        VideoManager.getInstance().getVideoHost().userBehaviorWithParams(StatVideoConsts.VALUE_EVENT_VIDEO_ACTION53, cg());
        this.co = false;
        this.aN = false;
        this.m.a(isLiveStreaming());
        this.G = true;
        VideoProxyDefault videoProxyDefault = this.Y;
        if (videoProxyDefault != null && videoProxyDefault.getProxyType() == 3 && this.x == 0) {
            I();
        }
        WonderPlayerSoSession wonderPlayerSoSession = this.g;
        if (wonderPlayerSoSession != null) {
            wonderPlayerSoSession.a((IPluginPrepareListener) this, false);
        }
        Handler handler = this.r;
        if (handler != null) {
            handler.removeMessages(111);
            handler.removeMessages(211);
            handler.removeMessages(109);
            handler.removeMessages(110);
            handler.removeMessages(TPOptionalID.OPTION_ID_BEFORE_LONG_DEMXUER_TYPE);
        }
        e(aB());
        x();
        A();
        this.T.y();
        l();
        VideoManager.getInstance().destroyVideoPlayer(this);
        if (videoProxyDefault != null) {
            videoProxyDefault.onPlayerDestroyed(this);
        }
        PlayerEnv playerEnv = this.ax;
        if (playerEnv != null) {
            playerEnv.setPlayerEnvLisenter(null);
        }
        VideoPlayRestoreKt.a().c(this);
        cJ();
        if (!VideoManager.getInstance().hasRuningPlayer()) {
            VideoManager.getInstance().abandonAudioFocus();
        }
        Bundle a2 = SafeBundleUtil.a();
        a2.putBoolean("isUsedLocalFilePanel", this.cz);
        b(IVideoService.EVENT_ON_EXIT_PLAYER, a2);
        PlayerStatKt.a(this, "H5VideoPlayer.destroy2");
        if (G()) {
            VideoManager.getInstance().getVideoHost().userBehaviorWithParams("VideoAction_199", cg());
        }
    }

    public int D() {
        if (this.aF == 0 && c(this.as)) {
            this.aF = 100;
        }
        return this.aF;
    }

    boolean E() {
        return this.n.support(1024L);
    }

    public void F() {
        PlayerStatKt.a(this, "H5VideoPlayer.startPlay");
        boolean z = false;
        if (this.cJ.c()) {
            this.cH.a();
            this.w = false;
            this.bc = true;
            return;
        }
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,startPlay");
        if (this.f72679b == null && !isLocalVideo()) {
            f(this.aq);
        }
        this.q.i();
        this.s = false;
        this.p.a("PlayerStateDepr", 12);
        if (!this.Y.isInPrefetchPage() && p() && this.O != 5 && !VideoManager.getInstance().requestActive(this)) {
            VideoLogHelper.c(IH5VideoPlayer.TAG, "Cannot request active when startPlay.");
            this.B = false;
            return;
        }
        if (cX() && !this.cq && cN()) {
            this.bc = true;
            df();
            cM();
            return;
        }
        if (!this.ch && !c(this.as) && !this.bV && !this.bc && this.F && cN()) {
            if (bw()) {
                this.bc = true;
                this.f72678a.makeText(VideoResources.b("video_sdk_queen_sim_free_follow"));
                H();
            } else if (bv()) {
                this.bc = true;
                dp();
            }
        }
        if (this.O != 5) {
            Bundle bundle = new Bundle();
            bundle.putString("playerType", cZ());
            this.Y.invokeWebViewClientMiscCallBackMethod("onPlayStarting", bundle);
        } else if (r(getProxyType()) && this.E == 0) {
            I();
            return;
        }
        if (!this.aB.b()) {
            if (!PlayerSwitchController.a().c() && this.aB.a()) {
                z = SuperPlayerInitializer.d();
            }
            if (!this.aw || this.bt == 0 || ((this.o == 1 && this.ac == IMediaPlayer.PlayerType.SYSTEM_PLAYER) || z || this.T.t())) {
                dv();
            } else {
                this.by = true;
                cB();
            }
            du();
            g(this.aq);
        }
        k("preferSuperPlayerState.forceSuperPlayer(): true");
        z = true;
        if (this.aw) {
        }
        dv();
        du();
        g(this.aq);
    }

    public boolean G() {
        return this.aq != null && this.aq.mExtraData.getBoolean("accelerated_video");
    }

    public void H() {
        String b2 = VideoResources.b("video_sdk_queen_sim_free_follow");
        if (!cr() || cn() == null) {
            return;
        }
        cn().b(TVideoStatHelperKt.c("2", b2));
    }

    protected void I() {
        PlayerStatKt.a(this, "H5VideoPlayer.pauseWebCore");
        J();
        this.E = 0;
        this.p.a("PlayerStateDepr", 0);
        this.K = true;
        this.B = false;
        updateControlView();
    }

    protected void J() {
        if (this.W < 2) {
            this.Y.dispatchSeek(1, getDuration());
        }
        e(1);
    }

    void K() {
        if (isCrossedFromSdk()) {
            return;
        }
        this.p.f73693a = this.as;
        VideoStatData videoStatData = this.p;
        videoStatData.J = true;
        videoStatData.h(this.as);
        this.p.n();
        this.p.o();
        if (this.bo > 0) {
            this.p.e("pds", String.valueOf(SystemClock.elapsedRealtime() - this.bo));
        }
        this.p.C = this.am;
        this.q.t = this.am;
        this.q.j = this.p.ai;
        this.q.f();
        b(this.p);
        this.p.l();
    }

    String L() {
        if (this.Z != null && !TextUtils.isEmpty(this.Z.getJumpUrl(null))) {
            return this.Z.getJumpUrl(null);
        }
        return this.as;
    }

    protected void M() {
        PlayerStatKt.a(this, "H5VideoPlayer.doStart");
        this.cM.a(80);
        if (!bJ()) {
            this.co = true;
            VideoManager.getInstance().requestAudioFocus();
        } else if (this.co) {
            this.co = false;
            VideoManager.getInstance().abandonAudioFocus();
        }
        if (this.Z != null) {
            this.cL.c();
            if (ce()) {
                this.Z.setPlaySpeed(this.cv);
            }
            N();
            boolean isPlaying = this.Z.isPlaying();
            this.Z.start();
            VideoSurfaceCreatorBase b2 = this.av.b();
            if ((b2 instanceof TVideoSurfaceCreator) && ((TVideoSurfaceCreator) b2).h()) {
                this.Z.pause();
                this.Z.start();
            }
            if (QBVideoRenderer.h()) {
                k(!isPlaying);
            }
            this.T.b();
        }
        this.Y.onPlayed();
        this.M = 0;
        n();
        if (bz()) {
            O();
        }
        SubtitleController subtitleController = this.aS;
        if (subtitleController != null && this.aT > this.aU) {
            subtitleController.setPlay();
        }
        this.f72678a.ag();
        this.p.a(this.bO);
        this.q.b();
        Iterator<IPlayer.IPlayerCallback> it = this.bN.iterator();
        while (it.hasNext()) {
            it.next().onStart();
        }
    }

    void N() {
        H5VideoSurfaceCreator h5VideoSurfaceCreator;
        if (this.Z == null) {
            return;
        }
        int videoWidth = this.Z.getVideoWidth();
        int videoHeight = this.Z.getVideoHeight();
        if (videoWidth <= 0 || videoHeight <= 0 || !Z() || (h5VideoSurfaceCreator = this.N) == null) {
            return;
        }
        h5VideoSurfaceCreator.a(videoWidth, videoHeight);
    }

    public void O() {
        PlayerStatKt.a(this, "H5VideoPlayer.requestFullScreenIfNeed");
        if (isStandardFullScreen()) {
            return;
        }
        RotateManager.a().a(aB(), this.ax);
    }

    public void P() {
        if (this.aY || !i()) {
            return;
        }
        this.aY = true;
        updateControlView();
        this.J.o();
    }

    public int Q() {
        if (this.W == 2) {
            this.aI = ("mpegts".equalsIgnoreCase(this.Z.getData(1)) || VideoInfoParser.c(getVideoUrl())) ? IMediaPlayer.VideoType.M3U8 : this.Z.isLiveStreaming() ? IMediaPlayer.VideoType.M3U8LIVE : IMediaPlayer.VideoType.MP4;
        }
        return this.aI;
    }

    public long R() {
        if (this.bh && this.aq != null && !TextUtils.isEmpty(this.aq.mExtraData.getString("videoid"))) {
            return StringUtils.a(this.aq.mExtraData.getString("videoid"), 0L);
        }
        long videoId = getEpisodeInfo() != null ? (int) VideoDbUtils.getVideoId(r0.mDramaId) : 0L;
        if (videoId != 0) {
            return videoId;
        }
        return 0L;
    }

    public boolean S() {
        if (this.ba) {
            return this.Y.canPagePlay();
        }
        return false;
    }

    public void T() {
        c(false);
    }

    public void U() {
        if (this.ca || !this.F || getCurrentPosition() <= 0) {
            return;
        }
        if (!m(this.as) || this.T.h()) {
            this.m.c();
            VideoPlayRestoreKt.a().b(this);
        }
    }

    public void V() {
        PlayerStatKt.a(this, "H5VideoPlayer.doExitPlayByDeActive");
        this.cK = true;
        doExitPlay(false);
    }

    public void W() {
        this.ax.reqMoveTaskBackground();
    }

    public boolean X() {
        int i = this.x;
        return i == 1 || i == 3;
    }

    public String Y() {
        return this.cI;
    }

    @Override
    public boolean Z() {
        return isSupportHardwareMode() && (getScreenMode() == 101 || getScreenMode() == 107);
    }

    public H5VideoInfo a(H5VideoInfo h5VideoInfo) {
        H5VideoInfo c2 = this.f72678a.k.c();
        return c2 == null ? h5VideoInfo : c2;
    }

    public Object a(String str, Bundle bundle) {
        return this.Y.invokeWebViewClientMiscCallBackMethod(str, bundle);
    }

    @Override
    public void a() {
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,onHwDecodeAvailable");
        if (this.r.hasMessages(211)) {
            this.r.removeMessages(211);
            if (CommonUtils.b()) {
                dt();
            } else {
                this.r.sendEmptyMessage(211);
            }
        }
    }

    public void a(int i, int i2) {
        this.aV = i;
        if (this.aU <= 0) {
            this.aT = i2;
            Handler handler = this.r;
            if (handler != null) {
                handler.removeMessages(132);
                this.r.sendEmptyMessage(132);
            }
        }
        int i3 = this.j;
        if (i3 > this.aU || i3 == 0) {
            n(this.j);
        }
    }

    public void a(int i, int i2, Throwable th) {
        onError(this.Z, i, i2, th);
    }

    public void a(int i, Throwable th) {
        PlayerStatKt.a(this, "H5VideoPlayer.releaseWhenError");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,releaseWhenError = " + i);
        if (s(this.Y.getProxyType()) && this.x == 2) {
            d(4);
        }
        e(true);
        this.s = true;
        b(202, i, th);
    }

    public void a(int i, boolean z) {
        PlayerStatKt.a(this, "H5VideoPlayer.seekTo");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,H5VideoPlayer::seekTo()  pos = " + i);
        this.aO = z;
        this.Y.dispatchSeek(i, getDuration());
    }

    public void a(int i, boolean z, boolean z2) {
        PlayerStatKt.a(this, "H5VideoPlayer.switchScreen2");
        if (this.G) {
            return;
        }
        int a2 = this.J.a();
        VideoLogHelper.c("H5VideoPlayer", "doSwitchScreen from=" + a2 + ", to=" + i + ", isSwitchfullScreenPending=" + z + ", ignoreAlreadySameScreenMode=" + z2);
        if (this.Y.onScreenModeChangeBefore(a2, i)) {
            return;
        }
        boolean z3 = (a2 == 101 && i == 106) || (a2 == 106 && i == 101) || c(a2, i) || d(a2, i);
        if (cr() && ck() != null) {
            z3 = true;
        }
        if (z3 && this.X != null) {
            this.X.setPreventFromSurfaceDestroy(true);
        }
        if (this.aq != null) {
            this.J.a(this.aq.mLiteWndPosX, this.aq.mLiteWndPosY, this.aq.mLiteWndWidth, this.aq.mLiteWndHeight);
        }
        w(i);
        if (i != 111) {
            this.J.r();
        }
        this.J.a(i, z, z2);
        if (i == 106) {
            VideoManager.getInstance().getVideoHost().userBehaviorStatistics("ADNP8");
        }
        if (z3 && this.X != null) {
            this.X.setPreventFromSurfaceDestroy(false);
        }
        this.Y.onScreenModeChanged(a2, i);
    }

    public void a(Activity activity) {
        PlayerStatKt.a(this, "H5VideoPlayer.onActivityPause");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,onActivityPause");
        if (a((Context) activity)) {
            this.u = 4;
        }
        this.cH.a("Try to autoPause for activity pause.");
        cU();
        U();
    }

    public void a(Context context, VideoProxyDefault videoProxyDefault, H5VideoInfo h5VideoInfo, PlayerEnv playerEnv, FeatureSupport featureSupport) {
        PlayerStatKt.a(this, "H5VideoPlayer.replacePlayerClient");
        this.cb = new PlayerClientEnv();
        this.cb.f72732a = this.Y;
        this.cb.f72733b = this.ax;
        PlayerClientEnv playerClientEnv = this.cb;
        playerClientEnv.f72734c = this.n;
        playerClientEnv.f72735d = h5VideoInfo;
        this.X.setPreventFromSurfaceDestroy(true);
        this.ax.setPlayerEnvLisenter(null);
        this.I = true;
        this.J.a(videoProxyDefault);
        this.Y.setVideoPlayer(null);
        this.Y = videoProxyDefault;
        this.ax = playerEnv;
        this.n = featureSupport;
        this.aq = h5VideoInfo;
        this.ax.setPlayerEnvLisenter(this);
        this.X.setPreventFromSurfaceDestroy(false);
    }

    public void a(Context context, boolean z) {
        PlayerStatKt.a(this, "H5VideoPlayer.onActivityResume");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,onActivityResume");
        if (context != null) {
            boolean z2 = this.n.support(128L) && z;
            if ((this.J.a() == 103 || this.J.a() == 109) && z2) {
                a(bA(), true, false);
            } else if (this.J.l()) {
                a(bA(), true, false);
                this.J.a(true);
            }
        }
        cW();
        if (context == null) {
            context = this.ax.getContext();
        }
        boolean a2 = a(context);
        if (a2) {
            this.u = 3;
        }
        if ((a2 || this.J.a() == 103 || this.J.a() == 109 || isSdkMode()) && !this.v) {
            ai();
        }
        if (a2 && bz()) {
            this.ax.resumePlayerRotateStatus();
        }
    }

    public void a(MotionEvent motionEvent) {
        this.Y.dispatchTouchEvent(motionEvent);
    }

    @Override
    public void a(View view) {
        PlayerStatKt.a(this, "H5VideoPlayer.onAttachedToWindow");
        if (this.Y != null && this.Y.getProxyType() == 6 && view == getVideoView()) {
            boolean a2 = a(this.ax.getContext());
            if (a2) {
                this.u = 3;
            }
            if ((a2 || this.J.a() == 103 || this.J.a() == 109 || isSdkMode()) && !this.v) {
                ai();
            }
            if (a2 && bz()) {
                this.ax.resumePlayerRotateStatus();
            }
        }
    }

    public void a(View view, ViewGroup.LayoutParams layoutParams) {
        if (this.Y.getProxyType() == 2) {
            ((ViewGroup) bS()).addView(view, layoutParams);
        } else if (this.X != null) {
            this.X.addView(view, layoutParams);
        }
    }

    public void a(IMediaPlayer.DecodeType decodeType, boolean z) {
        cS();
        PlayerStatKt.a(this, "H5VideoPlayer.showVideo2");
        this.cM.a(20);
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer," + String.format("H5VideoPlayer.showVideo decodeType = %s, destroyOldSurface = %s", decodeType, Boolean.valueOf(z)));
        this.p.a("PlayerStateDepr", 14);
        MediaPlayerImpl.b((IHWDecodeAvailableListenter) this);
        this.ao = decodeType;
        this.av.a(decodeType, z, this.cA);
    }

    public void a(VideoGestureDispatcher videoGestureDispatcher) {
        this.J.a(videoGestureDispatcher);
    }

    public void a(IPlayer.IPlayerCallback iPlayerCallback) {
        this.bN.add(iPlayerCallback);
    }

    public void a(String str) {
        if (this.F) {
            this.f72678a.makeText(str);
        }
    }

    @Override
    public void a(String str, int i) {
        PlayerStatKt.a(this, "H5VideoPlayer.onPreloadEnd");
        c(str, i);
    }

    @Override
    public void a(String str, int i, String str2) {
        PlayerStatKt.a(this, "H5VideoPlayer.onPreloadError");
        final Bundle a2 = SafeBundleUtil.a();
        a2.putString("url", str);
        a2.putInt("errorCode", i);
        a2.putString("errorMsg", str2);
        BrowserExecutorSupplier.getInstance().getMainThreadExecutor().execute(new Runnable() {
            @Override
            public void run() {
                H5VideoPlayer.this.a("onPreloadError", a2);
            }
        });
    }

    void a(String str, String str2, int i) {
        PlayerStatKt.a(this, "H5VideoPlayer.doPlayVideoUrl");
        if (TextUtils.isEmpty(str)) {
            return;
        }
        if (this.Y.getProxyType() == 2 || this.Y.getProxyType() == 6) {
            H5VideoInfo copy = this.aq != null ? H5VideoInfo.copy(this.aq) : null;
            if (copy != null) {
                copy.mScreenMode = i;
                copy.mVideoUrl = str;
                copy.mUA = str2;
            }
            this.Y.setVideoInfo(copy);
            if (copy != null && !TextUtils.isEmpty(getVideoUrl()) && !StringUtils.a(getVideoUrl(), copy.mVideoUrl)) {
                A();
            }
            play(copy, 1);
        }
    }

    public void a(String str, boolean z) {
        if (this.G || TextUtils.isEmpty(str)) {
            return;
        }
        VideoDefinition b2 = this.S.b(str);
        if (b2 == null) {
            VideoLogHelper.c(IH5VideoPlayer.TAG, str + " is not a valid definitionId");
            return;
        }
        if (this.W != 2 || this.Z == null || !cv() || TextUtils.equals(this.S.b(), str)) {
            return;
        }
        if (z && this.T.a(str)) {
            return;
        }
        this.T.b(str);
        this.Z.switchDefinition(b2);
    }

    public void a(boolean z) {
        PlayerStatKt.a(this, "H5VideoPlayer.release");
        PlayerStatKt.a(this, "H5VideoPlayer.release." + this.cM.a());
        h();
        this.cS = null;
        this.cU.set(false);
        this.aP = -1;
        this.R.e();
        this.cR.a(this);
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,release releaseWakeLock");
        IPlayConfirmController iPlayConfirmController = this.aK;
        if (iPlayConfirmController != null) {
            iPlayConfirmController.dismiss();
        }
        if (this.Z != null) {
            a(1.0f);
            if (cu()) {
                if (!z) {
                    r();
                }
                this.f72678a.ah();
                Iterator<IPlayer.IPlayerCallback> it = this.bN.iterator();
                while (it.hasNext()) {
                    it.next().onPause();
                }
            }
            cF();
            if (!z || this.W == -1) {
                this.Z.setDisplay(null);
                SubtitleController subtitleController = this.aS;
                if (subtitleController != null) {
                    subtitleController.setPause();
                    this.aS.hideSubtitleView();
                }
            } else {
                U();
                if (!this.ca && !isLiveStreaming()) {
                    this.h = getCurrentPosition();
                }
                this.W = -1;
                SubtitleController subtitleController2 = this.aS;
                if (subtitleController2 != null) {
                    subtitleController2.showTextSubtitle("");
                    this.aS.hideSubtitleView();
                    this.aS.releaseNativeSubSource();
                    this.aS = null;
                }
                cE();
                if (!this.av.a() || !cu() || m(getVideoUrl()) || Build.VERSION.SDK_INT <= 25) {
                    this.Z.reset();
                } else {
                    this.Z.misCallMothed(206, null);
                }
                this.Z = null;
                this.w = true;
                this.A = false;
                bI();
                this.f72679b = null;
            }
            this.av.e();
            this.ag = false;
        }
        if (QBVideoRenderer.h()) {
            this.aC.f();
            this.aC = new QBVideoRenderer();
        }
        this.T.c();
        this.p.b(this.bO);
    }

    public void a(boolean z, int i) {
        this.cH.a(z, this.cK);
        if (s(this.Y.getProxyType()) || this.Y.canPagePlay()) {
            if (!this.cl && this.f72681cn) {
                d(1);
                if (this.x != 0 && !this.F) {
                    a(true, true);
                }
            }
            if (cR()) {
                switchScreen(101);
                VideoManager.getInstance().getVideoHost().onPlayerCountChanged(VideoManager.getInstance().getVideoPlayerList().size());
            }
            if (z) {
                if (this.X != null) {
                    this.X.setNextWindowToken(true);
                }
                a(true);
            }
        } else {
            if (this.f72678a.L()) {
                VideoLogHelper.d(IH5VideoPlayer.TAG, this.f72678a + " doExit use float window.");
                if (this.F) {
                    this.J.d();
                    this.J.b();
                    b(aB(), 3);
                    VideoManager.getInstance().switchToDlnaFloatMode(this);
                }
            }
            C();
        }
        this.ax.onPlayerExited();
    }

    public boolean a(float f) {
        if (this.cv == f || !b(f)) {
            return false;
        }
        this.cv = f;
        return true;
    }

    public boolean a(long j) {
        return this.n.support(j);
    }

    boolean a(Context context) {
        if (s(this.Y.getProxyType()) && !this.J.c()) {
            return c(context);
        }
        if (this.J.c()) {
            return b(context);
        }
        return false;
    }

    public boolean a(VideoMediaControllerStatusBtn videoMediaControllerStatusBtn) {
        if (bU()) {
            if (videoMediaControllerStatusBtn != null) {
                videoMediaControllerStatusBtn.i = VideoMediaControllerStatusBtn.DownloadTips.MSEVIDEO;
            }
            return false;
        }
        if (TextUtils.isEmpty(this.as)) {
            if (videoMediaControllerStatusBtn != null) {
                videoMediaControllerStatusBtn.i = VideoMediaControllerStatusBtn.DownloadTips.VIDEOSRCNULL;
            }
            return false;
        }
        if (FileUtils.l(this.as.trim())) {
            if (videoMediaControllerStatusBtn != null) {
                videoMediaControllerStatusBtn.i = VideoMediaControllerStatusBtn.DownloadTips.LOCALVIDEO;
            }
            return false;
        }
        if (this.as.toLowerCase().startsWith("rtsp://") || this.as.toLowerCase().startsWith("rtmp://") || this.as.toLowerCase().startsWith("mms://") || this.as.toLowerCase().startsWith("mmsh://") || this.as.toLowerCase().startsWith("mmst://")) {
            if (videoMediaControllerStatusBtn != null) {
                videoMediaControllerStatusBtn.i = VideoMediaControllerStatusBtn.DownloadTips.LIVEVIDEO;
            }
            return false;
        }
        if (m(this.as)) {
            if (videoMediaControllerStatusBtn != null) {
                videoMediaControllerStatusBtn.i = this.as.toLowerCase().contains("livepid") ? VideoMediaControllerStatusBtn.DownloadTips.LIVEVIDEO : VideoMediaControllerStatusBtn.DownloadTips.COPYRIGHT;
            }
            return false;
        }
        if (IOpenJsApis.TRUE.equals(u(14))) {
            if (videoMediaControllerStatusBtn != null) {
                videoMediaControllerStatusBtn.i = VideoMediaControllerStatusBtn.DownloadTips.SRCLIMITED;
            }
            return false;
        }
        if (!this.n.support(1L)) {
            if (videoMediaControllerStatusBtn != null) {
                videoMediaControllerStatusBtn.i = VideoMediaControllerStatusBtn.DownloadTips.COPYRIGHT;
            }
            return false;
        }
        if (this.m.getEpisodeInfo() != null) {
            return true;
        }
        if (videoMediaControllerStatusBtn != null) {
            videoMediaControllerStatusBtn.i = VideoMediaControllerStatusBtn.DownloadTips.EPISODERNULL;
        }
        return false;
    }

    public boolean a(boolean z, Bundle bundle) {
        if (!this.p.J) {
            if (this.bd) {
                VideoStatData videoStatData = new VideoStatData(this.ab, this);
                videoStatData.J = true;
                videoStatData.u = 3000003;
                videoStatData.a("NoPlayError", 2);
                db();
                videoStatData.e();
                return true;
            }
            if (this.by) {
                VideoStatData videoStatData2 = new VideoStatData(this.ab, this);
                videoStatData2.J = true;
                if (this.p.u == 3000000) {
                    this.p.u = 3000007;
                }
                videoStatData2.a("NoPlayError", 2);
                db();
                videoStatData2.e();
            }
            return false;
        }
        if (this.p.u == 3000000 && this.bJ) {
            this.p.u = 3000008;
        }
        if (this.n.support(16L)) {
            if (this.bh && !TextUtils.isEmpty(this.bn)) {
                this.p.C = this.bn;
            }
            if (FileUtils.l(this.as) && this.aq != null) {
                String string = this.aq.mExtraData.getString("referUrl");
                if (!TextUtils.isEmpty(string)) {
                    this.p.a("referUrl", UrlUtils.encode(string));
                }
                String string2 = this.aq.mExtraData.getString("taskUrl");
                if (!TextUtils.isEmpty(string2)) {
                    this.p.a("downloadUrl", UrlUtils.encode(string2));
                }
            }
            if (this.p.u != 0) {
                dq();
            }
            db();
            IMediaPlayer.DecodeType d2 = bh().d();
            this.p.e("PlayerMode", B() + "");
            this.p.a("decodeTypein", d2.getExtravalue());
            this.p.a("wangka", bw() ? 1 : 0);
            if (z) {
                this.p.a("rn_report", 1);
            }
            VideoStatData videoStatData3 = this.p;
            videoStatData3.e("XServerIp", videoStatData3.T);
            VideoStatData videoStatData4 = this.p;
            videoStatData4.e("X-Android-Received-Millis", videoStatData4.W);
            VideoStatData videoStatData5 = this.p;
            videoStatData5.e("X-Android-Sent-Millis", videoStatData5.X);
            VideoStatData videoStatData6 = this.p;
            videoStatData6.e("Content-Length", videoStatData6.Y);
            VideoStatData videoStatData7 = this.p;
            videoStatData7.e("Error", videoStatData7.Z);
            VideoStatData videoStatData8 = this.p;
            videoStatData8.e("macAddress", videoStatData8.V);
            VideoStatData videoStatData9 = this.p;
            videoStatData9.e("imei", videoStatData9.U);
            cI();
            a(this.p);
            if (z) {
                this.p.a(bundle == null ? null : String.valueOf(bundle.get(ICircleModule.CIRCLE_ARGUMENTS)));
                cF();
                cE();
                this.p.b(this.bO);
            }
            HashMap<String, String> hashMap = this.cg;
            if (hashMap != null && !hashMap.isEmpty()) {
                this.p.a(this.cg);
            }
            if (this.O != 5) {
                this.p.a(z, this.aq.mExtraData);
            }
        }
        if (z) {
            this.p.i();
            this.p.d(false);
        } else {
            this.p.e();
        }
        return true;
    }

    public void aA() {
        String b2;
        if (TextUtils.isEmpty(this.f)) {
            if (TextUtils.isEmpty(this.am) || this.am.startsWith("qb://home")) {
                b2 = VideoResources.b("video_sdk_unknown");
            } else {
                this.f = UrlUtils.getHost(this.am);
                b2 = CommonUtils.q(this.f);
                if (TextUtils.isEmpty(b2)) {
                    return;
                }
            }
            this.f = b2;
        }
    }

    public String aB() {
        return toString();
    }

    public void aC() {
        IMediaPlayerInter iMediaPlayerInter;
        IMediaPlayerInter iMediaPlayerInter2;
        Throwable th;
        boolean z;
        PlayerStatKt.a(this, "H5VideoPlayer.createPlayer");
        this.cM.a(40);
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,H5VideoIsolateView::init()");
        this.bG = new Object();
        if (this.T.t()) {
            this.E = 2;
            updateControlView();
            final Object obj = this.bG;
            this.T.a(new TVideoCreatePlayerCallback() {
                @Override
                public void a() {
                    if (H5VideoPlayer.this.B) {
                        H5VideoPlayer.this.r.sendMessage(H5VideoPlayer.this.r.obtainMessage(110, 0, 0));
                    }
                }

                @Override
                public void a(int i) {
                    if (H5VideoPlayer.this.B) {
                        H5VideoPlayer.this.r.sendMessage(H5VideoPlayer.this.r.obtainMessage(110, i, 0));
                    }
                }

                @Override
                public void a(final IMediaPlayerInter iMediaPlayerInter3) {
                    Object obj2 = new Object();
                    H5VideoPlayer.this.bH = obj2;
                    H5VideoPlayer.this.l("fetchTVideoUserInfoin");
                    H5VideoPlayer.this.T.a(new TVideoUserInfoCallback() {
                        @Override
                        public void a(TVideoUserInfo tVideoUserInfo, Object obj3) {
                            if (obj3 != H5VideoPlayer.this.bH || H5VideoPlayer.this.G) {
                                return;
                            }
                            H5VideoPlayer.this.l("fetchTVideoUserInfoout");
                            H5VideoPlayer.this.T.a(tVideoUserInfo);
                            H5VideoPlayer.this.a(iMediaPlayerInter3, (Throwable) null, obj, 0, WonderErrorCode.ERROR_CREAT_PLAYER_ERROR);
                        }
                    }, obj2);
                }
            });
            return;
        }
        Throwable th2 = null;
        if (this.aw) {
            PlayerStatKt.a(this, "H5VideoPlayer.createPlayer2");
            iMediaPlayerInter2 = new MSEMediaPlayer((IMSEMediaPlayer) this.Y.invokeWebViewClientMiscCallBackMethod("getPlayer", null));
            th = null;
        } else {
            PlayerStatKt.a(this, "H5VideoPlayer.createPlayer4");
            try {
            } catch (Throwable th3) {
                th2 = th3;
                iMediaPlayerInter = null;
            }
            if (!this.aB.a() && !this.aB.b() && !m(this.as)) {
                z = false;
                iMediaPlayerInter = MediaPlayerSelector.createPlayer(this.ab, this.ao, this.ac, 0, 0, this.am, this, z);
                Bundle a2 = SafeBundleUtil.a();
                a2.putInt("mcValue", this.ap.getAllMcDecoderValue());
                iMediaPlayerInter.misCallMothed(207, a2);
                if (this.aq.mExtraData != null) {
                    this.aq.mExtraData.putBoolean("actionPreload", this.O == 5);
                }
                iMediaPlayerInter.misCallMothed(208, this.aq.mExtraData);
                iMediaPlayerInter.setEnableParallelDownload(G());
                iMediaPlayerInter2 = iMediaPlayerInter;
                th = th2;
            }
            z = true;
            iMediaPlayerInter = MediaPlayerSelector.createPlayer(this.ab, this.ao, this.ac, 0, 0, this.am, this, z);
            Bundle a22 = SafeBundleUtil.a();
            a22.putInt("mcValue", this.ap.getAllMcDecoderValue());
            iMediaPlayerInter.misCallMothed(207, a22);
            if (this.aq.mExtraData != null) {
            }
            iMediaPlayerInter.misCallMothed(208, this.aq.mExtraData);
            iMediaPlayerInter.setEnableParallelDownload(G());
            iMediaPlayerInter2 = iMediaPlayerInter;
            th = th2;
        }
        a(iMediaPlayerInter2, th, this.bG, 0, WonderErrorCode.ERROR_CREAT_PLAYER_ERROR);
    }

    public int aD() {
        if (this.H) {
            return this.h;
        }
        return -1;
    }

    void aE() {
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,initMideaPlayer");
        db();
        dc();
        if (!QBVideoRenderer.h() || cr()) {
            aC();
            return;
        }
        cS();
        final Object obj = new Object();
        this.bI = obj;
        final long elapsedRealtime = SystemClock.elapsedRealtime();
        cS();
        this.aC.a(new QBVideoRenderer.CreateInputSurfaceCallback() {
            @Override
            public void a(Surface surface) {
                if (obj == H5VideoPlayer.this.bI) {
                    H5VideoPlayer.this.k("[QBVideoRenderer] create surface use time=" + (SystemClock.elapsedRealtime() - elapsedRealtime) + "ms.");
                    H5VideoPlayer.this.aC();
                }
            }
        });
    }

    void aF() {
        this.w = true;
        I();
    }

    public void aG() {
        Handler handler = this.r;
        if (handler == null) {
            return;
        }
        VideoLogHelper.a("H5VideoPlayer", "force updateControlView mPlayerState = " + this.E);
        handler.removeMessages(134);
        handler.sendMessage(Message.obtain(handler, 124, this.E, 1));
    }

    public void aH() {
        if (!this.bT || bz()) {
            de();
        }
    }

    public IPlayConfirmController aI() {
        if (this.aK == null) {
            m();
        }
        return this.aK;
    }

    public void aJ() {
        this.r.post(new Runnable() {
            @Override
            public void run() {
                if (H5VideoPlayer.this.X == null || !H5VideoPlayer.this.J.c()) {
                    return;
                }
                H5VideoPlayer.this.X.invalidate();
            }
        });
    }

    public boolean aK() {
        if (!TextUtils.isEmpty(this.as) && FileUtils.l(this.as)) {
            return true;
        }
        if (this.aw) {
            return false;
        }
        return this.n.support(4L);
    }

    public boolean aL() {
        return this.W < 0;
    }

    public boolean aM() {
        if (this.aJ == 0) {
            this.aJ = (b(this.am) || CommonUtils.o(this.as)) ? (byte) 2 : (byte) 1;
        }
        return this.aJ == 2;
    }

    public int aN() {
        if (this.Z != null) {
            return this.Z.getCurrentSpeed();
        }
        return -1;
    }

    public void aO() {
        int aN = aN();
        if (aN < 0 || this.aH > 5 || !FeatureToggle.a(com.tencent.library.BuildConfig.BUG_TOGGLE_93998523)) {
            return;
        }
        int a2 = VideoPrefDefine.a(G(), Q());
        Logs.c(IH5VideoPlayer.TAG, "Video," + this + " current speed = " + aN + " thread count = " + a2);
        if (aN > 0) {
            this.aH++;
            Map<String, String> cg = cg();
            cg.put("currentSpeed", String.valueOf(aN()));
            cg.put("videoType", String.valueOf(Q()));
            cg.put("threadCount", String.valueOf(a2));
            VideoManager.getInstance().getVideoHost().userBehaviorWithParams(StatVideoConsts.VALUE_EVENT_VIDEO_ACTION206, cg);
        }
        this.r.sendEmptyMessageDelayed(TPOptionalID.OPTION_ID_BEFORE_LONG_DEMXUER_TYPE, 3000L);
    }

    public long aP() {
        if (this.Z != null) {
            return this.Z.getFileSize();
        }
        return -1L;
    }

    public boolean aQ() {
        return !TextUtils.equals(this.aL, this.as);
    }

    public String aR() {
        String str = aT() ? this.bn : this.am;
        return !TextUtils.isEmpty(str) ? str : "";
    }

    public boolean aS() {
        return this.bi;
    }

    public boolean aT() {
        return this.bh;
    }

    public boolean aU() {
        return this.bj;
    }

    public boolean aV() {
        return this.bl;
    }

    public void aW() {
        boolean z = this.T.z();
        this.f72678a.d((this.bT || z) ? false : true);
        this.f72678a.e(z);
    }

    public void aX() {
        this.f72681cn = !this.cm;
    }

    public void aY() {
        this.f72681cn = true;
    }

    public boolean aZ() {
        return this.J.c();
    }

    @Override
    protected boolean aa() {
        return this.av.h();
    }

    public boolean ab() {
        return this.J.s();
    }

    protected void ac() {
        PlayerStatKt.a(this, "H5VideoPlayer.switchProxy");
        VideoManager.getInstance().getVideoHost().reqSwitchProxy(this, this.aq);
        this.I = this.Y.isActive();
    }

    @Override
    public void active() {
        PlayerStatKt.a(this, "H5VideoPlayer.active");
        this.I = true;
        if (this.G) {
            return;
        }
        if (this.J.a() == 103 && this.J.a() == 109) {
            return;
        }
        ai();
    }

    public boolean ad() {
        int i = this.E;
        return i == 3 || i == 6 || i == 4;
    }

    public boolean ae() {
        return (this.aw || !this.n.support(256L) || isStandardFullScreen()) ? false : true;
    }

    public boolean af() {
        return ae() && ad();
    }

    public void ag() {
        PlayerStatKt.a(this, "H5VideoPlayer.onCallRingPause");
        if (this.G) {
            return;
        }
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,onCallRingPause");
        r();
        this.f72678a.ah();
        d(1);
        this.p.b(this.bO);
        Iterator<IPlayer.IPlayerCallback> it = this.bN.iterator();
        while (it.hasNext()) {
            it.next().onPause();
        }
    }

    public void ah() {
        PlayerStatKt.a(this, "H5VideoPlayer.autoPauseIfNeed");
        cV();
        if (this.ag && this.W == 2 && aj() && !this.cl) {
            d(2);
            if (this.M < 1) {
                this.M = 1;
            }
        }
    }

    public void ai() {
        PlayerStatKt.a(this, "H5VideoPlayer.autoPlayIfNeed");
        cV();
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,mActivityState : " + this.u);
        if (aj() || cr()) {
            return;
        }
        cY();
    }

    public boolean aj() {
        return f(true);
    }

    boolean ak() {
        if (getScreenMode() == 103 && getScreenMode() == 109) {
            return true;
        }
        if (isSdkMode()) {
            return this.Y.isActive() && this.I;
        }
        if (o(getScreenMode())) {
            return true;
        }
        return this.Y.isActive() && this.I;
    }

    public IMediaPlayer.PlayerType al() {
        return this.Z == null ? IMediaPlayer.PlayerType.UNKNOW : this.Z.getPlayerType();
    }

    public IMediaPlayer.PlayerType am() {
        return this.Z != null ? this.Z.getPlayerType() : this.aa != null ? this.aa : IMediaPlayer.PlayerType.UNKNOW;
    }

    public void an() {
        PlayerStatKt.a(this, "H5VideoPlayer.onScreenOff");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,onScreenOff");
        this.J.o();
        if (!this.ag || this.W != 2 || this.cl || this.cP.a() || getScreenMode() == 111) {
            return;
        }
        d(2);
    }

    public void ao() {
        PlayerStatKt.a(this, "H5VideoPlayer.onScreenOn");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,onScreenOn");
        if (this.cl) {
            return;
        }
        ai();
    }

    public void ap() {
        PlayerStatKt.a(this, "H5VideoPlayer.onBackPressed");
        if (this.G) {
            return;
        }
        this.p.a("PlayerStateDepr", 11);
        if (this.f72678a.bo()) {
            return;
        }
        d(false);
        if (this.ax.handleBackPress()) {
            return;
        }
        aq();
    }

    protected void aq() {
        if (this.J.h()) {
            W();
            this.J.a(false);
        }
    }

    public void ar() {
        PlayerStatKt.a(this, "H5VideoPlayer.activePlayer");
        boolean z = this.F;
        boolean z2 = true;
        this.F = true;
        if (this.Z != null) {
            this.Z.onActiveChanged(this.F);
        }
        if (this.X != null && !z) {
            this.X.b();
        }
        H5VideoSurfaceCreator h5VideoSurfaceCreator = this.N;
        if (h5VideoSurfaceCreator != null && h5VideoSurfaceCreator.isSurfaceValid()) {
            z2 = false;
        }
        if (!Z() || z) {
            return;
        }
        if (!this.ag || z2) {
            requestCreateSurface();
        }
    }

    public void as() {
        this.J.i();
    }

    public void at() {
        PlayerStatKt.a(this, "H5VideoPlayer.onAudioFocusGain");
        if (VideoManager.getInstance().isActivityActived() && this.ag && this.W == 2 && this.F && !this.G && this.M <= 2) {
            if (!this.ax.isAppBackground() || getScreenMode() == 103 || getScreenMode() == 109) {
                c(2);
            }
        }
    }

    public void au() {
        PlayerStatKt.a(this, "H5VideoPlayer.onAudioFocusLost");
        if (this.M < 2) {
            this.M = 2;
        }
        d(2);
    }

    public boolean av() {
        return this.m.b();
    }

    public boolean aw() {
        H5VideoEpisodeInfo episodeInfo;
        return this.n.support(8L) && (episodeInfo = getEpisodeInfo()) != null && episodeInfo.hasEpisodes();
    }

    public boolean ax() {
        H5VideoEpisodeInfo episodeInfo;
        return this.n.support(8L) && (episodeInfo = getEpisodeInfo()) != null && episodeInfo.hasEpisodes();
    }

    public String ay() {
        generateVideoTitleAndFrom();
        return this.f;
    }

    public boolean az() {
        return this.ck;
    }

    public PlayerEnv b() {
        return this.ax;
    }

    public void b(int i, int i2) {
        this.aj = i;
        this.ak = i2;
        g();
        this.aC.b(i, i2);
    }

    public void b(int i, int i2, Throwable th) {
        this.E = 8;
        updateControlView();
        this.bd = i == 208;
        this.p.a("PlayerStateDepr", 8);
        Handler handler = this.r;
        handler.sendMessage(Message.obtain(handler, 126, i, i2, th));
    }

    public void b(int i, boolean z) {
        aH();
        if (this.B && i == 2) {
            n();
        }
        this.f72678a.b(i, z);
    }

    void b(long j) {
        Handler handler = this.r;
        handler.sendMessageDelayed(Message.obtain(handler, 134, this.E, -1), j);
    }

    @Override
    public void b(View view) {
        PlayerStatKt.a(this, "H5VideoPlayer.onDetachedFromWindow");
    }

    void b(H5VideoInfo h5VideoInfo) {
        int i = this.bk;
        if (IOpenJsApis.TRUE.equals(h5VideoInfo.mExtraData.getString("forceShowMuteButton"))) {
            this.bk |= 2;
        }
        if (IOpenJsApis.TRUE.equals(h5VideoInfo.mExtraData.getString("forceNoMuteButton"))) {
            this.bk &= -4;
        }
        if (i == this.bk || !ad()) {
            return;
        }
        updateControlView();
    }

    public void b(String str, int i) {
        PlayerStatKt.a(this, "H5VideoPlayer.requestRotate");
        if (isStandardFullScreen()) {
            return;
        }
        this.cf = i;
        RotateManager.a().a(aB(), i, this.ax);
    }

    public void b(boolean z) {
        PlayerStatKt.a(this, "H5VideoPlayer.retryPlay");
        this.aM = false;
        if (((this.ac == IMediaPlayer.PlayerType.SYSTEM_PLAYER || (this.ac == IMediaPlayer.PlayerType.WONDER_PLAYER && this.A)) && CpuInfoUtils.isSupportedCPU() && c(this.as) && bv()) || this.aN) {
            this.aM = true;
        }
        if (z) {
            z();
        }
        f(1);
    }

    public boolean b(int i) {
        if (i == 103 || i == 109) {
            return !DeviceUtils.a(this.ab);
        }
        return false;
    }

    public boolean b(Context context) {
        return this.J.a(context);
    }

    protected boolean b(String str) {
        return VideoManager.getInstance().getVideoHost().isUrlInBackList(str, this.as);
    }

    public int bA() {
        if (this.T.t()) {
            return 102;
        }
        int cG = cG();
        return cG != -1 ? cG : this.bb;
    }

    public boolean bB() {
        return this.ax.handleBackPress();
    }

    public boolean bC() {
        return this.ax.isAppBackground();
    }

    public long bD() {
        return this.p.ai;
    }

    public void bE() {
        SystemClock.currentThreadTimeMillis();
        Bundle a2 = SafeBundleUtil.a();
        if (WonderPlayer.getVersion() != -1) {
            a2.putString("wdpversion", String.valueOf(WonderPlayer.getVersion()));
            a2.putString("romname", DeviceUtils.k());
        }
        a2.putString("cpuversion", String.valueOf(CpuInfoUtils.getCPUType()));
        a2.putString("startplaytime", String.valueOf(this.p.ah));
        a2.putString("wdpplayertype", this.ac + "");
        a2.putString("useNewRender", String.valueOf(QBVideoRenderer.h()));
        a2.putString("playerSwitch", String.valueOf(PlayerSwitchController.a().f72377a));
        VideoManager.getInstance().getVideoHost().callHostFunction("putVideoInfoToRQD", a2);
    }

    public boolean bF() {
        if (isDestroyed()) {
            return false;
        }
        return ad() ? this.E == 3 : this.W >= 0 && this.W < 2;
    }

    public boolean bG() {
        return this.Y.getProxyType() == 1 || this.Y.getProxyType() == 2 || bH();
    }

    public boolean bH() {
        return this.Y.getProxyType() == 6 && this.aq != null && this.aq.mExtraData != null && this.aq.mExtraData.containsKey(StatVideoConsts.KEY_CUR_FROM) && "video_page".equals(this.aq.mExtraData.getString(StatVideoConsts.KEY_CUR_FROM));
    }

    public void bI() {
        final String be = be();
        if (TextUtils.isEmpty(be)) {
            return;
        }
        VideoAsyncExecutor.a().a(new Runnable() {
            @Override
            public void run() {
                PreloadManager.a().c(be);
            }
        });
    }

    public boolean bJ() {
        return this.bD == 0.0f && this.bE == 0.0f;
    }

    public void bK() {
        if (this.Z != null) {
            if (getScreenMode() == 101 || getScreenMode() == 107) {
                this.Z.setVideoVolume(this.bD, this.bE);
            } else {
                this.Z.setVideoVolume(1.0f, 1.0f);
            }
        }
    }

    public void bL() {
        a("CacheErrorCode : " + this.bw + ",CacheStatus: " + this.bv + ",Speed:" + (aN() / 1000) + "K/s");
        this.bm = true;
    }

    public int bM() {
        return (this.bF && r(this.Y.getProxyType())) ? 107 : 102;
    }

    public int bN() {
        return (this.bF && r(this.Y.getProxyType())) ? 107 : 104;
    }

    public String bO() {
        return this.bn;
    }

    public boolean bP() {
        return bA() != 102;
    }

    public ILiteWndGestureEventHandler bQ() {
        return this.J.p();
    }

    public VideoSurfaceCreatorBase bR() {
        o();
        return this.X.getNativeSurfaceCreator();
    }

    public View bS() {
        return this.bM.a();
    }

    public IRenderWindow bT() {
        o();
        return this.X;
    }

    public boolean bU() {
        return this.aw;
    }

    public boolean bV() {
        return this.aX;
    }

    public VideoSurfaceCreatorBase bW() {
        if (!this.T.t()) {
            return Z() ? this.N : bR();
        }
        o();
        return this.T.a(this.X);
    }

    public void bX() {
        PlayerStatKt.a(this, "H5VideoPlayer.onSurfaceCreateFailed");
        this.av.g();
        requestCreateSurface();
    }

    public boolean bY() {
        Activity activity;
        return this.bR || bx() || (activity = getActivity()) == null || activity.getWindow().getDecorView().isHardwareAccelerated();
    }

    public boolean bZ() {
        return this.bQ;
    }

    public void ba() {
        boolean i;
        this.t = VideoNetworkStatus.a().d();
        int i2 = this.t;
        boolean z = true;
        if (i2 == 1) {
            if (E()) {
                bI();
            }
        } else if ((i2 == 2 || i2 == 6) && !TextUtils.isEmpty(be()) && !this.F && this.f72678a == null) {
            bh().b((IPluginPrepareListener) null, this.ax.getPlayerEnvType() == 5);
        }
        if (!this.F || c(this.as)) {
            return;
        }
        int i3 = this.t;
        if (i3 != 1) {
            if (i3 == 2 && this.ac == IMediaPlayer.PlayerType.WONDER_PLAYER) {
                h(true);
                return;
            }
            return;
        }
        if (isPlaying()) {
            if (this.ac == IMediaPlayer.PlayerType.SYSTEM_PLAYER || this.ac == IMediaPlayer.PlayerType.WONDER_PLAYER) {
                if (this.ac != IMediaPlayer.PlayerType.SYSTEM_PLAYER && !isLiveStreaming()) {
                    z = false;
                }
                i = i(z);
                if (cr() && i && !z) {
                    dp();
                }
            } else {
                i = false;
            }
            if (i) {
                return;
            }
            if (!isPlaying()) {
                g(false);
            }
            if (!bw()) {
                dp();
            } else {
                this.f72678a.makeText(VideoResources.b("video_sdk_queen_sim_free_follow"));
                H();
            }
        }
    }

    public boolean bb() {
        return !isLocalVideo() && this.t == 1 && bv() && E() && this.w;
    }

    public ViewGroup.LayoutParams bc() {
        return this.X.getLayoutParams();
    }

    public void bd() {
        if (this.s || this.E == 1) {
            return;
        }
        this.J.q();
    }

    public String be() {
        PreloadStat preloadStat = this.f72679b;
        return preloadStat != null ? preloadStat.a() : "";
    }

    @Override
    public void beforeEnterLiteWnd() {
    }

    @Override
    public boolean beginSwtichScreen(int i) {
        if (!o(i) || getScreenMode() != 103) {
            return true;
        }
        if (!VideoManager.getInstance().getVideoHost().checkCanSwitchScreen()) {
            return false;
        }
        VideoManager.getInstance().getVideoHost().onPlayerFullScreen();
        return true;
    }

    public int bf() {
        return this.E;
    }

    public boolean bg() {
        return this.z;
    }

    public WonderPlayerSoSession bh() {
        WonderPlayerSoSession wonderPlayerSoSession = this.g;
        if (wonderPlayerSoSession != null) {
            return wonderPlayerSoSession;
        }
        this.g = WonderPlayerSoSession.a(this.ab);
        return this.g;
    }

    protected void bi() {
        this.w = false;
        F();
        n();
    }

    public String bj() {
        return this.cc;
    }

    public boolean bk() {
        if (this.cb == null) {
            return false;
        }
        this.X.setPreventFromSurfaceDestroy(true);
        this.Y.setVideoPlayer(null);
        this.ax.setPlayerEnvLisenter(null);
        this.I = this.cb.e;
        this.J.a(this.cb.f72732a);
        this.Y = this.cb.f72732a;
        this.ax = this.cb.f72733b;
        this.n = this.cb.f72734c;
        this.aq = this.cb.f72735d;
        this.Y.setVideoPlayer(this);
        this.ax.setPlayerEnvLisenter(this);
        this.X.setPreventFromSurfaceDestroy(false);
        this.cb = null;
        return !this.Y.isDestroyed();
    }

    public boolean bl() {
        return this.cb == null;
    }

    public void bm() {
        if (getScreenMode() == 103 && this.aq != null) {
            H5VideoInfo copy = H5VideoInfo.copy(this.aq);
            fillVideoInfo(copy);
            copy.mVideoCachePath = VideoManager.getInstance().getVideoHost() != null ? VideoManager.getInstance().getVideoHost().getVideoCacheDir() : "";
            copy.mScreenMode = 103;
            VideoConcurrentMgr.a().a(copy);
        }
        C();
    }

    public Bundle bn() {
        return new Bundle(this.cV);
    }

    public int bo() {
        return this.aU + this.aV;
    }

    public int bp() {
        return this.aU;
    }

    public int bq() {
        return this.aT;
    }

    public boolean br() {
        return bo() > 0;
    }

    public int bs() {
        return this.aW;
    }

    public int bt() {
        if (this.Z != null) {
            try {
                return Integer.parseInt(this.Z.getData(4));
            } catch (Exception unused) {
            }
        }
        return 0;
    }

    public boolean bu() {
        return this.J.l();
    }

    public boolean bv() {
        return VideoNetworkStatus.a().c() && !QueenConfig.isQueenEnable();
    }

    public boolean bw() {
        return VideoNetworkStatus.a().c() && QueenConfig.isQueenEnable();
    }

    public boolean bx() {
        return this.ax.getPlayerEnvType() == 2;
    }

    public IVideoWebViewProxy by() {
        IVideoServiceInner iVideoServiceInner = (IVideoServiceInner) VideoManager.getInstance().getVideoHost().getVideoService();
        if (iVideoServiceInner != null) {
            return iVideoServiceInner.createMTTVideoWebViewProxy(this.ab);
        }
        return null;
    }

    public boolean bz() {
        return o(getScreenMode());
    }

    public void c() {
        if (TextUtils.isEmpty(this.aq.mWebUrl) && k(this.aq)) {
            this.aq.mWebUrl = this.aq.mExtraData.getString("videoPageUrl");
        }
        this.am = this.aq.mWebUrl;
        if (this.aq.mExtraData != null) {
            this.bX = TextUtils.equals(this.aq.mExtraData.getString("closeDeepPreload"), IOpenJsApis.TRUE);
            String string = this.aq.mExtraData.getString("videoMultiHWDecodeMinApiLevel");
            if (!TextUtils.isEmpty(string)) {
                try {
                    this.bZ = Integer.valueOf(string).intValue();
                } catch (Throwable unused) {
                    this.bZ = 24;
                }
            }
            if (this.bZ <= DeviceUtils.a()) {
                this.bY = TextUtils.equals(this.aq.mExtraData.getString("videoMultiHWDecode"), IOpenJsApis.TRUE);
            }
            if (QBVideoRenderer.h()) {
                this.cA = CommonUtils.a(this.aq.mExtraData, "isTranslucentSrc");
            } else if (CommonUtils.a(this.aq.mExtraData, "isTranslucentSrc")) {
                this.cA = true;
            }
            if (CommonUtils.a(this.aq.mExtraData, "preloadToFirstFrame")) {
                this.P = Q;
            }
            this.cW = CommonUtils.a(this.aq.mExtraData, "playerPriority", -1);
        }
        if (!this.bX && CommonUtils.a(this.aq.mExtraData, "isPrePlayVideo")) {
            this.bW = true;
        }
        this.ad = this.aq.mUA != null ? this.aq.mUA : VideoManager.getInstance().getVideoHost().getUa();
        this.ae = this.aq.mPrivateBrowsingEnabled;
        this.bL = this.aq.mExtraData.getString("nextUrl");
        if (isCrossedFromSdk()) {
            this.x = !this.aq.mExtraData.getBoolean(IVREventListener.GET_KEY_IS_PLAYING) ? 1 : 0;
        }
    }

    public void c(int i) {
        String str;
        if (r(getProxyType()) && this.O == 5 && i == 2) {
            str = "Web preload state, should not dispatch play for HOST.";
        } else {
            PlayerStatKt.a(this, "H5VideoPlayer.dispatchPlay");
            if (!r(getProxyType()) || this.E != 0 || i != 2 || this.x == 0) {
                f(i);
                return;
            }
            str = "Init state for web, should not dispatch play for HOST.";
        }
        k(str);
    }

    public void c(View view) {
        if (bz()) {
            CommonUtils.a(view);
        } else {
            CommonUtils.b(view);
        }
    }

    public void c(H5VideoInfo h5VideoInfo) {
        if (h5VideoInfo != null && !TextUtils.isEmpty(h5VideoInfo.mVideoUrl)) {
            if (h5VideoInfo.mVideoUrl.startsWith("file://")) {
                h5VideoInfo.mVideoUrl = h5VideoInfo.mVideoUrl.substring(7);
            }
            if (!this.n.support(8192L) && h5VideoInfo.mVideoUrl.startsWith("content:")) {
                String l = CommonUtils.l(h5VideoInfo.mVideoUrl);
                if (l != null) {
                    h5VideoInfo.mVideoUrl = l;
                } else {
                    this.n.addFeatureFlag(8192L);
                }
            }
            this.f72678a.a(CommonUtils.a(h5VideoInfo.mExtraData, "controlPanelGuideStrategy", H5VideoGuideConstantsKt.a(this.Y)));
        }
        if (h5VideoInfo != null && h5VideoInfo.mScreenMode == 100) {
            h5VideoInfo.mScreenMode = VideoManager.getInstance().getVideoHost().getDefaultFullscreenMode();
        }
        this.aB.a(h5VideoInfo);
    }

    public void c(boolean z) {
        PlayerStatKt.a(this, "H5VideoPlayer.deActivePlayer");
        U();
        boolean z2 = false;
        this.F = false;
        if (this.Z != null) {
            this.Z.onActiveChanged(this.F);
        }
        if (!cQ() && this.W == 2 && !this.bW && this.X != null) {
            this.X.a();
        }
        if ((z && MediaPlayerImpl.a((Object) this.Z) && FeatureToggle.a(BuildConfig.BUG_TOGGLE_93821497)) || (Z() && !this.bW)) {
            z2 = true;
        }
        if (z2) {
            onSurfaceDestroyed();
        }
    }

    boolean c(String str) {
        return FileUtils.l(str);
    }

    public int ca() {
        return this.bk;
    }

    public void cb() {
        cc();
    }

    void cc() {
        PlayerStatKt.a(this, "H5VideoPlayer.stopPlay2");
        a(true);
        this.s = true;
    }

    public boolean cd() {
        return !this.cs;
    }

    public boolean ce() {
        IMediaPlayer.PlayerType playerType = this.Z != null ? this.Z.getPlayerType() : null;
        boolean j = j(2);
        Logs.c("H5VideoPlayer", "isSupportPlaySpeed, isWonder:" + cu() + ",playerType:" + playerType + ",WonderPlayer.getVersion():" + WonderPlayer.getVersion() + ",isLive:" + isLiveStreaming() + ",isBlackSite:" + j);
        return (((!cu() || WonderPlayer.getVersion() < 9400) && !cv()) || isLiveStreaming() || j) ? false : true;
    }

    public float cf() {
        return this.cv;
    }

    public Map<String, String> cg() {
        HashMap hashMap = new HashMap();
        if (this.aq != null && this.aq.mExtraData != null) {
            String string = this.aq.mExtraData.containsKey("from") ? this.aq.mExtraData.getString("from") : "unknown";
            if (G()) {
                string = StatVideoConsts.KEY_FROM_ACC;
            }
            if (TextUtils.isEmpty(string) || "unknown".equals(string)) {
                if (bx()) {
                    string = "system";
                } else if (r(this.Y.getProxyType())) {
                    string = "web";
                }
            }
            String p = p("unknown");
            String q = q("unknown");
            String videoUrl = isLocalVideo() ? getVideoUrl() : getWebUrl();
            String u = u(1);
            if (TextUtils.isEmpty(u)) {
                u = FileUtilsF.a(getVideoUrl());
            }
            String str = getDuration() + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + u + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + aP();
            String dx = dx();
            hashMap.put("from", string);
            hashMap.put(StatVideoConsts.KEY_CUR_FROM, p);
            hashMap.put(StatVideoConsts.KEY_VIEWER_TYPE, q);
            hashMap.put(StatVideoConsts.KEY_URL, videoUrl);
            hashMap.put("file_type", u);
            hashMap.put(StatVideoConsts.KEY_VIDEO_ACTION_ID, this.cy);
            hashMap.put(StatVideoConsts.KEY_VIDEO_INFO_COMBINE, str);
            hashMap.put(StatVideoConsts.KEY_VIDEO_TITLE_NAME, this.e);
            hashMap.put("video_url", this.as);
            Bundle bundle = this.cX;
            hashMap.put(StatVideoConsts.KEY_WEB_FROM, (bundle == null || !bundle.containsKey(IFileStatService.EVENT_REPORT_FROM_WHERE)) ? "" : String.valueOf(bundle.getInt(IFileStatService.EVENT_REPORT_FROM_WHERE)));
            String dy = dy();
            if (!TextUtils.isEmpty(dy)) {
                hashMap.put(StatVideoConsts.KEY_VIDEO_EXPERIMENT, dy);
            }
            if (!TextUtils.isEmpty(dx)) {
                hashMap.put(StatVideoConsts.KEY_VIDEO_SOURCE_TYPE, dx);
            }
            hashMap.put(StatVideoConsts.KEY_BIZ_FIELD1, this.aq.mExtraData.getString(StatVideoConsts.KEY_BIZ_FIELD1));
            hashMap.put(StatVideoConsts.KEY_BIZ_FIELD2, this.aq.mExtraData.getString(StatVideoConsts.KEY_BIZ_FIELD2));
            hashMap.put(StatVideoConsts.KEY_BIZ_FIELD3, this.aq.mExtraData.getString(StatVideoConsts.KEY_BIZ_FIELD3));
            hashMap.put(StatVideoConsts.KEY_BIZ_FIELD4, this.aq.mExtraData.getString(StatVideoConsts.KEY_BIZ_FIELD4));
            hashMap.put(StatVideoConsts.KEY_BIZ_FIELD5, this.aq.mExtraData.getString(StatVideoConsts.KEY_BIZ_FIELD5));
        }
        return hashMap;
    }

    public H5VideoSettingCenter ch() {
        return this.cP;
    }

    public boolean ci() {
        return this.cw;
    }

    public int[] cj() {
        return this.X != null ? this.X.getSurfaceWidthAndHeight() : new int[]{getVideoWidth(), getVideoHeight()};
    }

    public TextureView ck() {
        return this.av.d();
    }

    public QueenGuideFeature cl() {
        return this.cJ;
    }

    public void cm() {
        PlayerStatKt.a(this, "H5VideoPlayer.clearSurface");
        if (!QBVideoRenderer.h()) {
            if (this.Z != null) {
                this.Z.setSurface(null);
                return;
            }
            return;
        }
        this.aC.a((Surface) null);
        if ((this.aD || aa()) && this.Z != null) {
            this.Z.setSurface(null);
            this.aD = false;
            this.aE = false;
        }
    }

    public TVideoProxy cn() {
        return this.T;
    }

    public VideoDefinitionController co() {
        return this.S;
    }

    public boolean cp() {
        return this.W == 2;
    }

    public void cq() {
        if (this.G) {
            return;
        }
        this.f72678a.U();
    }

    public boolean cr() {
        return this.T.t();
    }

    public boolean cs() {
        return this.aB.b() || this.T.t();
    }

    public int ct() {
        return this.cW;
    }

    public void d(int i) {
        PlayerStatKt.a(this, "H5VideoPlayer.dispatchPause");
        this.x = 3;
        a(false, i == 1);
        e(i);
        this.co = false;
    }

    public void d(View view) {
        if (this.X == null || view == null || view.getParent() != this.X) {
            return;
        }
        this.X.removeView(view);
    }

    public synchronized void d(H5VideoInfo h5VideoInfo) {
        if (h5VideoInfo != null) {
            if ((h5VideoInfo.mVideoUrl != null || !h5VideoInfo.mExtraData.getBoolean("selfProvdePlayer")) && !this.B) {
                if (isCrossedFromSdk() || j()) {
                    String videoCacheDir = VideoManager.getInstance().getVideoHost() != null ? VideoManager.getInstance().getVideoHost().getVideoCacheDir() : "";
                    if (h5VideoInfo.mCacheFilePos != -1 && !TextUtils.isEmpty(h5VideoInfo.mVideoCachePath) && !h5VideoInfo.mVideoCachePath.equals(videoCacheDir)) {
                        ((WonderCacheManager) VideoManager.getInstance().getWonderCacheMgr()).a(h5VideoInfo.mVideoUrl, h5VideoInfo.mVideoCachePath, videoCacheDir, h5VideoInfo.mCacheFilePos);
                    }
                }
                this.aq = h5VideoInfo;
                generateVideoTitleAndFrom();
                this.bF = h5VideoInfo.mExtraData.getBoolean("fakeFullScreen");
                this.aw = h5VideoInfo.mExtraData.getBoolean("selfProvdePlayer");
                if (this.bF) {
                    VideoManager.getInstance().getVideoHost().userBehaviorStatistics("AWSP005");
                }
                this.bn = this.aq.mExtraData.getString("videoPageUrl");
                this.cj = this.aq.mExtraData.getString("videoImageUrl");
                this.bQ = true;
                if (this.aq.mExtraData != null && this.aq.mExtraData.get("disableFullScreen") != null) {
                    this.bQ = false;
                }
                this.bR = false;
                if (this.aq.mExtraData != null && this.aq.mExtraData.get("useTextureView") != null) {
                    this.bR = true;
                }
                if (this.aq.mExtraData != null && this.aq.mExtraData.get("disableFeature") != null) {
                    this.n.clearFeatrueFlag(this.aq.mExtraData.getInt("disableFeature"));
                }
                this.bV = this.aq.mExtraData.getBoolean("isWebUgcVideo", false);
                if (this.bV) {
                    PlatformStatUtils.a("IS_WEB_UGC_VIDEO_TRUE");
                }
                if (CommonUtils.a(this.aq.mExtraData, "isVideoCropMode")) {
                    this.bU = true;
                } else {
                    this.bU = null;
                }
                this.bS = CommonUtils.a(this.aq.mExtraData, "needTvkAdv");
                this.ch = CommonUtils.a(this.aq.mExtraData, "disableMobileToast");
                this.ci = CommonUtils.a(this.aq.mExtraData, "isSilenceMode");
                this.cl = CommonUtils.a(this.aq.mExtraData, "fullyControl");
                this.cd = this.aq.mExtraData.getString("tvkAdvGroupId");
                this.cq = CommonUtils.a(this.aq.mExtraData, "disableWKLachineToast");
                this.cE = CommonUtils.a(this.aq.mExtraData, "transparentBackground");
                int i = this.aq.mScreenMode;
                if (!p()) {
                    i = 101;
                } else if (h(i)) {
                    i = 109;
                }
                boolean z = this.aq.mExtraData.getBoolean("preHardwareAccelerated");
                this.af = this.aq.mExtraData.getBoolean("isHardwareAccelerated");
                if (this.af) {
                    this.ba = true;
                } else {
                    this.ba = this.aq.mExtraData.getBoolean("isCanPagePlay", true);
                }
                int defaultFullscreenMode = VideoManager.getInstance().getVideoHost().getDefaultFullscreenMode();
                Bundle bundle = this.aq.mExtraData;
                if (o(i)) {
                    defaultFullscreenMode = i;
                }
                this.bb = bundle.getInt("defaultFullScreenMode", defaultFullscreenMode);
                if (this.aq != null && (!TextUtils.isEmpty(this.aq.mVideoUrl) || this.aw)) {
                    c();
                }
                if (!this.Y.isInPrefetchPage()) {
                    a(i, false, z != this.af);
                }
                this.B = true;
                n((String) null);
            }
        }
    }

    public void d(String str) {
        PlayerStatKt.a(this, "H5VideoPlayer.requestFullScreen");
        O();
    }

    public void d(boolean z) {
        PlayerStatKt.a(this, "H5VideoPlayer.doUserCloseAction");
        if (!this.n.support(32768L)) {
            doExitPlay(z);
        } else {
            C();
            this.ax.onPlayerExited();
        }
    }

    public boolean d() {
        return this.cA;
    }

    @Override
    public void deactive() {
        PlayerStatKt.a(this, "H5VideoPlayer.deactive");
        this.I = false;
        if (this.G) {
            return;
        }
        this.cH.a("Try to auto pause for deactive()");
        ah();
        if (!bz() || this.J.c()) {
            return;
        }
        switchScreen(101);
    }

    @Override
    public void doExitPlay(boolean z) {
        a(z, 0);
    }

    public int e(H5VideoInfo h5VideoInfo) {
        int i = h5VideoInfo != null ? h5VideoInfo.mPostion : 0;
        if (i <= 0) {
            return -1;
        }
        this.H = true;
        return i;
    }

    public void e(int i) {
        PlayerStatKt.a(this, "H5VideoPlayer.notifyProxyPause");
        this.x = 3;
        this.Y.dispatchPause(i);
    }

    public void e(String str) {
        VideoProxyDefault videoProxyDefault = this.Y;
        PlayerEnv playerEnv = this.ax;
        if (playerEnv == null || videoProxyDefault == null || isStandardFullScreen()) {
            return;
        }
        int i = -1;
        if (this.bh && videoProxyDefault.isActive() && this.I) {
            i = this.cf;
        }
        RotateManager.a().a(aB(), playerEnv, i);
    }

    void e(boolean z) {
        PlayerStatKt.a(this, "H5VideoPlayer.stopPlay");
        a(z);
        if (this.X != null) {
            this.X.d();
            if (z) {
                this.X.c();
            }
        }
    }

    public boolean e() {
        return this.cE;
    }

    public void f(int i) {
        PlayerStatKt.a(this, "H5VideoPlayer.notifyProxyPlay");
        this.x = 2;
        this.Y.dispatchPlay(i);
    }

    void f(final H5VideoInfo h5VideoInfo) {
        final int i;
        PlayerStatKt.a(this, "H5VideoPlayer.doPreload");
        if (h5VideoInfo == null || m(this.as) || G()) {
            return;
        }
        this.aB.a(h5VideoInfo);
        this.cG = h5VideoInfo.mVideoUrl;
        if (PlayerSwitchController.a().c() || this.aB.a() || this.aB.b()) {
            return;
        }
        if (h5VideoInfo.mExtraData != null) {
            int parseInt = Integer.parseInt(h5VideoInfo.mExtraData.getString("preloadPercent", "-1"));
            i = parseInt > 100 ? 100 : parseInt < 0 ? 0 : parseInt;
        } else {
            i = -1;
        }
        String be = be();
        if (!TextUtils.isEmpty(be)) {
            if (be.equals(h5VideoInfo.mVideoUrl)) {
                a(h5VideoInfo, i);
                return;
            }
            bI();
        }
        i(h5VideoInfo);
        HashMap hashMap = null;
        if (this.au != null && this.au.size() > 0) {
            hashMap = new HashMap(this.au);
        }
        final HashMap hashMap2 = hashMap;
        final String str = h5VideoInfo.mVideoUrl;
        VideoAsyncExecutor.a().a(new Runnable() {
            @Override
            public void run() {
                final PreloadStat a2 = PreloadManager.a().a(str, hashMap2, true);
                if (a2 != null) {
                    a2.a(i);
                    a2.a(H5VideoPlayer.this);
                } else {
                    H5VideoPlayer.this.a(h5VideoInfo, i);
                }
                H5VideoPlayer.this.r.post(new Runnable() {
                    @Override
                    public void run() {
                        PreloadStat preloadStat;
                        if (H5VideoPlayer.this.G && (preloadStat = a2) != null) {
                            preloadStat.a((PreloadStat.IPreloadListener) null);
                            PreloadManager.a().c(str);
                        } else {
                            if (a2 == null || H5VideoPlayer.this.f72679b == a2) {
                                return;
                            }
                            if (H5VideoPlayer.this.f72679b != null) {
                                H5VideoPlayer.this.f72679b.a((PreloadStat.IPreloadListener) null);
                            }
                            H5VideoPlayer.this.f72679b = a2;
                        }
                    }
                });
            }
        });
    }

    public void f(String str) {
        Message obtainMessage = this.r.obtainMessage(125);
        obtainMessage.obj = str;
        this.r.sendMessage(obtainMessage);
    }

    public boolean f() {
        return this.ci;
    }

    boolean f(boolean z) {
        boolean z2 = !z && this.cP.a();
        if (VideoManager.getInstance().isKeguardShowing() && !VideoManager.getInstance().isScreenOn()) {
            return true;
        }
        if (getScreenMode() == 103 || getScreenMode() == 109 || getScreenMode() == 111) {
            return false;
        }
        boolean bz = bz();
        boolean z3 = this.u == 4 || (this.v && !bz);
        if (z2 && z3) {
            this.cH.a("backgroundPlay enable, ignore activity status. mActivityStatus=4, mIsHideByFunctionWindow=" + this.v + ", isFullScreen=" + bz);
            z3 = false;
        }
        return this.ce || !ak() || z3;
    }

    @Override
    public void fillVideoInfo(H5VideoInfo h5VideoInfo) {
        WindowManager.LayoutParams layoutParams;
        if (h5VideoInfo == null) {
            return;
        }
        long cacheReadPosition = this.Z != null ? this.Z.getCacheReadPosition() : -1L;
        String string = h5VideoInfo.mExtraData.getString("backupUrl");
        if (!TextUtils.isEmpty(string)) {
            h5VideoInfo.mVideoUrl = string;
        }
        h5VideoInfo.mExtraData.putBoolean(IVREventListener.GET_KEY_IS_PLAYING, isPlaying());
        h5VideoInfo.mExtraData.putBoolean("isCrossed", true);
        h5VideoInfo.mCacheFilePos = cacheReadPosition;
        h5VideoInfo.mPostion = getCurrentPosition();
        ViewGroup.LayoutParams layoutParams2 = this.X.getLayoutParams();
        if (!(layoutParams2 instanceof WindowManager.LayoutParams) || (layoutParams = (WindowManager.LayoutParams) layoutParams2) == null) {
            return;
        }
        h5VideoInfo.mLiteWndPosX = layoutParams.x;
        h5VideoInfo.mLiteWndPosY = layoutParams.y;
        h5VideoInfo.mLiteWndWidth = layoutParams.width;
        h5VideoInfo.mLiteWndHeight = layoutParams.height;
    }

    void g() {
        SubtitleController subtitleController;
        if (this.X == null || (subtitleController = this.aS) == null) {
            return;
        }
        subtitleController.setAdjustSubtitleSize(this.X.getWidth(), this.X.getHeight());
    }

    public void g(H5VideoInfo h5VideoInfo) {
        m(this.aq);
        if (h5VideoInfo.mFromWhere == 2) {
            this.z = true;
        }
        if (p()) {
            this.m.a(this.f72682d);
            this.m.c(this.cj);
        }
    }

    public void g(String str) {
        Handler handler = this.r;
        if (handler != null) {
            handler.removeMessages(128);
            Message obtainMessage = this.r.obtainMessage(128);
            obtainMessage.obj = str;
            this.r.sendMessage(obtainMessage);
        }
    }

    public void g(boolean z) {
        int U;
        PlayerStatKt.a(this, "H5VideoPlayer.pauseDownload");
        if (this.Z != null) {
            DownloadTask a2 = BaseDownloadServiceManager.b().a(this.as);
            boolean z2 = true;
            if (a2 != null && ((U = a2.U()) == 2 || U == 0 || U == 1)) {
                z2 = false;
            }
            if (cv() || !z2) {
                return;
            }
            this.Z.pauseCacheTask(z);
            this.Y.onNetworkStateChanged(VideoProxyDefault.NetworkState.Idle);
        }
    }

    public boolean g(int i) {
        if (this.Z != null) {
            return this.Z.setAudioTrack(i);
        }
        return false;
    }

    @Override
    public void generateVideoTitleAndFrom() {
        String str;
        String str2;
        if (this.as == null) {
            return;
        }
        if (this.T.t()) {
            this.e = this.T.x();
            return;
        }
        if (this.aq != null && this.aq.mExtraData != null && this.aq.mExtraData.containsKey("displayTitle")) {
            this.e = this.aq.mExtraData.getString("displayTitle");
            return;
        }
        if (this.aq != null && this.aq.mExtraData != null && this.aq.mExtraData.containsKey("displayTitle")) {
            this.e = this.aq.mExtraData.getString("displayTitle");
            return;
        }
        if (FileUtils.l(this.as) && !ci()) {
            this.e = FileUtils.c(this.as);
            return;
        }
        String str3 = this.cp;
        if (str3 == null) {
            str3 = this.aq != null ? this.aq.mWebTitle : "";
        }
        if (!TextUtils.isEmpty(str3)) {
            this.e = str3;
            if (this.e.length() > 50) {
                this.e = this.e.substring(0, 50);
            }
            this.e = CommonUtils.p(this.e);
            aA();
            return;
        }
        H5VideoEpisodeInfo episodeInfo = this.m.getEpisodeInfo();
        if (episodeInfo == null) {
            if (TextUtils.isEmpty(this.am)) {
                if (!TextUtils.isEmpty(this.as)) {
                    str2 = this.as;
                }
                if (TextUtils.isEmpty(this.e)) {
                    this.e = VideoResources.b("video_sdk_no_title");
                }
                if (!TextUtils.isEmpty(this.e) && this.e.length() > 50) {
                    this.e = this.e.substring(0, 50);
                }
                this.e = CommonUtils.p(this.e);
                aA();
                return;
            }
            str2 = this.am;
            this.e = UrlUtils.getHost(str2);
            if (TextUtils.isEmpty(this.e)) {
            }
            if (!TextUtils.isEmpty(this.e)) {
                this.e = this.e.substring(0, 50);
            }
            this.e = CommonUtils.p(this.e);
            aA();
            return;
        }
        if (!TextUtils.isEmpty(episodeInfo.mTitle)) {
            this.e = episodeInfo.mTitle;
            this.f = episodeInfo.mVideoFrom;
            aA();
            return;
        }
        if (TextUtils.isEmpty(episodeInfo.mDramaName)) {
            if (TextUtils.isEmpty(str3)) {
                str3 = VideoResources.b("video_sdk_no_title");
            }
            this.e = str3;
        } else {
            if (episodeInfo.hasEpisodes()) {
                str = episodeInfo.mDramaName + " " + VideoResources.b("video_sdk_title_episode_no_prefix") + episodeInfo.mSubId + VideoResources.b("video_sdk_title_episode_no_surfix");
            } else {
                str = episodeInfo.mDramaName;
            }
            this.e = str;
            this.f = episodeInfo.mVideoFrom;
        }
        if (!TextUtils.isEmpty(this.e) && this.e.length() > 50) {
            this.e = this.e.substring(0, 50);
        }
        aA();
    }

    @Override
    public Activity getActivity() {
        if (this.Y == null) {
            return null;
        }
        Context context = isSdkMode() ? this.Y.getContext() : null;
        if (!(context instanceof Activity)) {
            context = this.ax.getContext();
        }
        if (context instanceof Activity) {
            return (Activity) context;
        }
        return null;
    }

    @Override
    public int getCurAudioTrackIdx() {
        if (this.Z != null) {
            return this.Z.getCurAudioTrackIdxWrap();
        }
        return -1;
    }

    @Override
    public int getCurSubtitleIdx() {
        return bq();
    }

    @Override
    public int getCurrentPosition() {
        if (this.W != 2 || this.Z == null) {
            return 0;
        }
        try {
            return this.Z.getCurrentPosition();
        } catch (Exception unused) {
            return 0;
        }
    }

    @Override
    public int getDuration() {
        if (this.al > 0) {
            return this.al;
        }
        if (this.W == 2 && this.Z != null) {
            try {
                this.al = this.Z.getDuration();
                return this.al;
            } catch (Exception unused) {
            }
        }
        return -1;
    }

    @Override
    public H5VideoEpisodeInfo getEpisodeInfo() {
        H5VideoEpisodeInfo episodeInfo = this.m.getEpisodeInfo();
        if (episodeInfo != null) {
            if (episodeInfo.mExtraData == null) {
                episodeInfo.mExtraData = SafeBundleUtil.a();
            }
            if (this.aq != null && this.aq.mExtraData != null) {
                episodeInfo.mExtraData.putAll(this.aq.mExtraData);
            }
        }
        return episodeInfo;
    }

    @Override
    public FrameLayout getFakeFullScreenPanel() {
        return this.f72678a.aO();
    }

    @Override
    public double getPlaybackRate() {
        return this.cv;
    }

    @Override
    public int getProxyType() {
        return this.Y.getProxyType();
    }

    @Override
    public int getScreenMode() {
        return this.J.a();
    }

    @Override
    public String[] getValidAudioTrackTitles() {
        if (this.Z == null) {
            return null;
        }
        Object[] validAudioTrackTitlesWrap = this.Z.getValidAudioTrackTitlesWrap();
        if (validAudioTrackTitlesWrap instanceof String[]) {
            return (String[]) validAudioTrackTitlesWrap;
        }
        return null;
    }

    @Override
    public int getVideoHeight() {
        if (this.Z != null) {
            return this.Z.getVideoHeight();
        }
        return 0;
    }

    @Override
    public int getVideoID() {
        return (int) R();
    }

    @Override
    public H5VideoInfo getVideoInfo() {
        return this.aq;
    }

    @Override
    public int getVideoShowingRatio() {
        return this.aW;
    }

    @Override
    public String getVideoTitle() {
        generateVideoTitleAndFrom();
        return this.e;
    }

    @Override
    public String getVideoUrl() {
        return this.as;
    }

    @Override
    public View getVideoView() {
        return this.X;
    }

    @Override
    public int getVideoWidth() {
        if (this.Z != null) {
            return this.Z.getVideoWidth();
        }
        return 0;
    }

    @Override
    public ViewGroup getViewContainer() {
        ViewGroup viewGroup;
        Activity activity = getActivity();
        if (activity != null) {
            try {
                viewGroup = (ViewGroup) activity.getWindow().getDecorView();
            } catch (Exception unused) {
                viewGroup = null;
            }
            if (viewGroup instanceof ViewGroup) {
                return viewGroup;
            }
        }
        return null;
    }

    @Override
    public String getWebUrl() {
        return this.am;
    }

    public void h() {
        PlayerStatKt.a(this, "H5VideoPlayer.releaseWakeLock");
        VideoManager.getInstance().getWakeLockManager().b(this.aG, getActivity());
    }

    public void h(H5VideoInfo h5VideoInfo) {
        PlayerStatKt.a(this, "H5VideoPlayer.notifyVideoPreload");
        if (h5VideoInfo == null || TextUtils.isEmpty(h5VideoInfo.mWebUrl) || TextUtils.isEmpty(h5VideoInfo.mVideoUrl)) {
            return;
        }
        BrowserExecutorSupplier.forBackgroundTasks().execute(new SniffVideoTask(h5VideoInfo));
    }

    public void h(String str) {
        Handler handler = this.r;
        if (handler != null) {
            handler.removeMessages(302);
            Message obtainMessage = this.r.obtainMessage(302);
            obtainMessage.obj = str;
            this.r.sendMessage(obtainMessage);
        }
    }

    public void h(boolean z) {
        PlayerStatKt.a(this, "H5VideoPlayer.resumeDownload");
        if (isLiveStreaming()) {
            return;
        }
        if (cu() || cv()) {
            this.Z.resumeCacheTask(z);
        }
    }

    boolean h(int i) {
        return i == 101 && UserSettingManager.b().p() && r(getProxyType()) && S() && DeviceUtils.a(this.ab);
    }

    @Override
    public boolean handlePluginTag(String str, String str2, boolean z, String str3) {
        return false;
    }

    public void i(int i) {
        if (bz() && this.x != 1) {
            this.ax.resumePlayerRotateStatus();
        }
        this.J.j();
        this.f72678a.s(i);
    }

    public void i(String str) {
        a(str, true);
    }

    public boolean i() {
        return this.aq != null && this.aq.mCacheFilePos >= 0;
    }

    public boolean i(boolean z) {
        if (!bb()) {
            return false;
        }
        g(true);
        if (z) {
            d(1);
            dh();
        }
        return true;
    }

    @Override
    public boolean interceptUrl(String str) {
        if (TextUtils.isEmpty(str) || !r(getProxyType())) {
            return false;
        }
        Bundle bundle = new Bundle();
        bundle.putString("url", str);
        Object invokeWebViewClientMiscCallBackMethod = this.Y.invokeWebViewClientMiscCallBackMethod("interceptVideoUrl", bundle);
        VideoLogHelper.c(IH5VideoPlayer.TAG, "interceptUrl, url=" + str + ", result=" + invokeWebViewClientMiscCallBackMethod);
        return (invokeWebViewClientMiscCallBackMethod instanceof Boolean) && ((Boolean) invokeWebViewClientMiscCallBackMethod).booleanValue();
    }

    @Override
    public boolean isActive() {
        return this.F;
    }

    @Override
    public boolean isCanAttachVideoToWebView() {
        return VideoManager.getInstance().getVideoHost().isCanAttachVideoToWebView(this.Y);
    }

    @Override
    public boolean isCompletioned() {
        return this.k;
    }

    @Override
    public boolean isCrossedFromSdk() {
        if (this.aq != null && this.aq.mExtraData.containsKey("isCrossed")) {
            return this.aq.mExtraData.getBoolean("isCrossed");
        }
        return false;
    }

    @Override
    public boolean isCrossingPlayerPending() {
        if (ad() || this.s) {
            return false;
        }
        return i();
    }

    @Override
    public boolean isDestroyed() {
        return this.G;
    }

    @Override
    public boolean isLiveStreaming() {
        return this.Z != null && this.Z.isLiveStreaming();
    }

    @Override
    public boolean isLocalVideo() {
        return !TextUtils.isEmpty(this.as) && c(this.as.trim());
    }

    @Override
    public boolean isPlayerInMyVideo() {
        if (s(this.Y.getProxyType())) {
            return false;
        }
        return VideoManager.getInstance().getVideoHost().isPlayerInMyVideo(this.J.k());
    }

    @Override
    public boolean isPlaying() {
        if (this.W != 2 || this.Z == null) {
            return false;
        }
        return this.Z.isPlaying();
    }

    @Override
    public boolean isSdkMode() {
        return this.ax.getPlayerEnvType() == 3;
    }

    @Override
    public boolean isStandardFullScreen() {
        return this.n.support(2048L) || this.ax.isStandardFullScreen();
    }

    @Override
    public boolean isSupportHardwareMode() {
        return this.af;
    }

    @Override
    public boolean isVideoPlaying() {
        return isPlaying();
    }

    public void j(String str) {
        if (this.G || TextUtils.isEmpty(str) || this.W != 2 || this.Z == null || !cv()) {
            return;
        }
        PlatformStatUtils.a("VIDEO_PLAY_SWITCH_DEFINITION_FOR_URL");
        this.Z.switchDefinitionForUrl(str);
    }

    public void j(boolean z) {
        String aB;
        int i;
        if (this.aZ == z) {
            return;
        }
        if (getScreenMode() == 105 || getScreenMode() == 102) {
            if (z) {
                if (DeviceUtils.c(this.ax.getContext()) > DeviceUtils.d(this.ax.getContext())) {
                    if (getActivity() != null) {
                        getActivity().getWindowManager().getDefaultDisplay().getRotation();
                    }
                    aB = aB();
                    i = 6;
                } else {
                    aB = aB();
                    i = 3;
                }
            } else if (getScreenMode() == 105) {
                aB = aB();
                i = 4;
            } else if (getScreenMode() == 102) {
                aB = aB();
                i = 2;
            }
            b(aB, i);
        }
        this.aZ = z;
    }

    public boolean j() {
        if (this.aq != null && this.aq.mExtraData.containsKey("isTBS")) {
            return this.aq.mExtraData.getBoolean("isTBS");
        }
        return false;
    }

    public boolean j(int i) {
        return b(this.am, this.as, i);
    }

    @Override
    protected Uri k() {
        if (cv()) {
            String c2 = this.S.c();
            String str = this.as;
            if (!TextUtils.isEmpty(c2) && !TextUtils.equals(str, c2)) {
                this.cH.a("setDataSource use definition url: " + c2);
                return Uri.parse(c2);
            }
        }
        return super.k();
    }

    public void k(String str) {
        this.cH.a(str);
    }

    public boolean k(int i) {
        return b(this.am, this.as, i);
    }

    public void l() {
        if (this.X != null) {
            this.X.setNextWindowToken(true);
            this.X.b(this);
        }
        cD();
        this.X = null;
        this.f72678a.W();
        this.J.r();
    }

    public void l(int i) {
        if (this.X == null) {
            return;
        }
        int i2 = i != 1 ? i != 2 ? i != 3 ? i != 4 ? i != 5 ? -2 : -1 : 2 : 1 : 0 : 3;
        if (i2 > -2) {
            this.aW = i;
            this.X.setFrameMode(i);
            this.X.a(i);
            if (i2 >= 0) {
                VideoManager.getInstance().getVideoHost().userBehaviorStatistics("N390_" + i2);
            }
        }
    }

    public void l(String str) {
        Bundle bundle = new Bundle();
        bundle.putString(IFileStatService.EVENT_REPORT_NAME, str);
        a("playerEvent", bundle);
    }

    public void m() {
        IVideoExtraAbilityControllerHolder iVideoExtraAbilityControllerHolder;
        du();
        if (this.aK != null || (iVideoExtraAbilityControllerHolder = this.aQ) == null) {
            return;
        }
        this.aK = (IPlayConfirmController) iVideoExtraAbilityControllerHolder.getExtraAbility(IPlayConfirmController.class, this);
    }

    public void m(int i) {
        this.C = i;
    }

    public int n(int i) {
        int i2;
        SubtitleController subtitleController;
        if (this.aT != i && i == 0) {
            this.aT = i;
            if (this.Z != null) {
                this.Z.setSwitchStream(3, -1);
                g("");
            }
            SubtitleController subtitleController2 = this.aS;
            if (subtitleController2 != null) {
                subtitleController2.switchSubtitle(-1);
            }
        } else if (this.aT == i || i > this.aU || this.Z == null) {
            int i3 = this.aT;
            if (i3 != i && i > (i2 = this.aU) && this.aS != null) {
                if (i3 <= i2 && this.Z != null) {
                    this.Z.setSwitchStream(3, -1);
                }
                this.aT = i;
                this.aS.switchSubtitle(i - this.aU);
            }
        } else {
            if (this.aT > this.aU && (subtitleController = this.aS) != null) {
                subtitleController.switchSubtitle(-1);
            }
            this.aT = i;
            this.Z.setSwitchStream(3, i - 1);
        }
        return this.aT;
    }

    public void n() {
        PlayerStatKt.a(this, "H5VideoPlayer.acquireWakeLock");
        if (this.G) {
            return;
        }
        VideoManager.getInstance().getWakeLockManager().a(this.aG, getActivity());
    }

    void o() {
        int i;
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,initViews begin");
        if (this.X == null) {
            this.X = new WonderVideoView(VideoManager.getInstance().getApplicationContext(), this);
            this.X.a(this);
            this.X.setVideoWatermarkInfo(this.cx);
            this.X.setTranslucentSrc(this.cA);
        }
        if (!this.X.h()) {
            if (!this.bV) {
                Boolean bool = this.bU;
                i = bool != null ? bool.booleanValue() ? 4 : 2 : 5;
                this.X.setFrameMode(this.aW);
            }
            this.aW = i;
            this.X.setFrameMode(this.aW);
        }
        if (!this.X.h() && i()) {
            this.X.e();
            this.X.setBackgroundColor(0);
        }
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,initViews end ");
    }

    @Override
    public void onAppExit() {
        if (isSdkMode()) {
            bm();
        }
    }

    @Override
    public void onBufferingUpdate(IMediaPlayerInter iMediaPlayerInter, int i) {
        VideoProxyDefault videoProxyDefault;
        VideoProxyDefault.NetworkState networkState;
        if (this.X != null) {
            this.X.i();
        }
        if (i > 0 && i <= 100) {
            this.f72678a.o(i);
        }
        if (i <= 0 || i >= 100) {
            videoProxyDefault = this.Y;
            networkState = VideoProxyDefault.NetworkState.Loaded;
        } else {
            videoProxyDefault = this.Y;
            networkState = VideoProxyDefault.NetworkState.Loading;
        }
        videoProxyDefault.onNetworkStateChanged(networkState);
        this.Y.onBufferingUpdate(i);
        this.aF = i;
    }

    @Override
    public void onCacheStatusInfo(int i, String str, Bundle bundle) {
        this.p.b("host", bundle.getString("downloaded_host"));
        this.p.b(TPReportKeys.Common.COMMON_STEP, bundle.getString("downloaded_step"));
        if (i == -21041 || i == -21042 || i == -21043) {
            this.bB = i;
        } else if (i == -21044) {
            this.bz = true;
            if (bundle != null) {
                this.bA = bundle.getInt("errorCode");
            }
        } else if (i != 0) {
            this.bv = i;
            this.p.e(bundle.getString("XServerIp"));
            this.p.i(bundle.getString("X-Android-Received-Millis"));
            this.p.j(bundle.getString("X-Android-Sent-Millis"));
            this.p.k(bundle.getString("Content-Length"));
            this.p.l(bundle.getString("Error"));
        }
        if (t(this.bv)) {
            this.bx = str;
            int i2 = this.bv;
            this.bw = i2;
            if (!a(i2, bundle) || ad()) {
                return;
            }
            super.onError(null, this.bw, 0, null);
        }
    }

    @Override
    public void onCompletion(IMediaPlayerInter iMediaPlayerInter) {
        PlayerStatKt.a(this, "H5VideoPlayer.onCompletion");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,H5VideoIsolateView::onCompletion(MediaPlayer)");
        this.k = true;
        this.E = 6;
        this.M = 100;
        this.p.a("PlayerStateDepr", 6);
        updateControlView();
        h();
        this.Y.onCompletion();
        this.x = 1;
        SubtitleController subtitleController = this.aS;
        if (subtitleController != null) {
            subtitleController.setPause();
        }
        try {
            this.f72678a.c(getWebUrl());
            Iterator<IPlayer.IPlayerCallback> it = this.bN.iterator();
            while (it.hasNext()) {
                it.next().onCompletion();
            }
        } catch (Exception e) {
            VideoManager.getInstance().getVideoHost().reportCatchedException(Thread.currentThread(), e, "onCompletion", null);
        }
        VideoManager.getInstance().getVideoHost().userBehaviorWithParams(StatVideoConsts.VALUE_EVENT_VIDEO_ACTION3, cg());
        this.cR.b();
        VideoPlayRestoreKt.a().c(this);
    }

    @Override
    public void onContinuePlay(int i) {
        PlayerStatKt.a(this, "H5VideoPlayer.onContinuePlay");
        if (i == 1) {
            VideoManager.getInstance().setCheck2g3gConfirmTime(System.currentTimeMillis());
        }
        this.w = false;
        h(true);
        if (!isLiveStreaming()) {
            a(getCurrentPosition(), false);
        }
        c(1);
    }

    @Override
    public void onContinuePlayCanceled() {
        PlayerStatKt.a(this, "H5VideoPlayer.onContinuePlayCanceled");
        Object invokeWebViewClientMiscCallBackMethod = this.Y.invokeWebViewClientMiscCallBackMethod("mobileNetCancelPlay", null);
        if ((invokeWebViewClientMiscCallBackMethod instanceof Boolean) && ((Boolean) invokeWebViewClientMiscCallBackMethod).booleanValue()) {
            return;
        }
        this.w = true;
        if (this.W < 2) {
            doExitPlay(false);
        } else {
            d(1);
        }
    }

    @Override
    public void onCustomViewHidden() {
        this.J.a(bS());
    }

    @Override
    public void onDepInfo(IMediaPlayerInter iMediaPlayerInter, String str) {
        SystemClock.currentThreadTimeMillis();
        if (bx()) {
            return;
        }
        this.p.a(this.Z, this.ao);
        String str2 = this.p.f;
        if (TextUtils.isEmpty(str2)) {
            return;
        }
        boolean z = str2.equals(TPDecoderType.TP_CODEC_MIMETYPE_AVC) || str2.equals(TPDecoderType.TP_CODEC_MIMETYPE_HEVC);
        VideoStatData videoStatData = this.p;
        videoStatData.af = 0;
        videoStatData.ag = 0;
        a(videoStatData, VideoManager.getInstance().getVideoPlayerList());
        if (z) {
            if (o(str2) < 1) {
                if (!this.p.f("wdpdecoder")) {
                    this.p.a("wdpdecoder", str);
                }
                this.p.k();
                return;
            }
            if (TextUtils.isEmpty(str)) {
                return;
            }
            this.bf = true;
            this.p.d("WPV", WonderPlayer.getVersion() + "");
            this.p.d("RON", DeviceUtils.k());
            this.p.d("ROS", DeviceUtils.j() + "");
            this.p.d("RAS", DeviceUtils.i() + "");
            this.p.d("OPE", DeviceUtils.e(this.ab));
            this.p.d("PLA", "0");
            String[] strArr = {"PR", "LE", "RF", "WH", "HH", "LH"};
            String[] split = str.split(Constants.ACCEPT_TIME_SEPARATOR_SP);
            if (split != null) {
                for (int i = 0; i < split.length && i < strArr.length; i++) {
                    this.p.d(strArr[i], split[i]);
                }
            }
            cI();
            a(this.p);
            this.p.a(false, this.aq.mExtraData);
            this.p.a("wdpdecoder", str);
        }
    }

    @Override
    public void onDestroy(Activity activity) {
        PlayerStatKt.a(this, "H5VideoPlayer.onDestroy");
        if (this.G || !b(activity)) {
            return;
        }
        if (this.ax.getPlayerEnvType() == 5) {
            if (!bz()) {
                return;
            }
        } else if (this.ax.getPlayerEnvType() != 1 && this.ax.getPlayerEnvType() != 2) {
            return;
        }
        d(false);
    }

    @Override
    public void onEnterLiteWnd() {
        if (this.ax.handleEnterLiteWnd()) {
            return;
        }
        aq();
    }

    @Override
    public void onEnvEvent(String str, Bundle bundle) {
        if ("onMultiWndShow".equals(str)) {
            this.ce = true;
            this.cH.a("Try to auto pause for onMultiWndShow()");
            ah();
        } else if ("onMultiWndHide".equals(str)) {
            this.ce = false;
            ai();
        } else if ("onAppBackground".equals(str)) {
            m53do();
        }
    }

    @Override
    public boolean onError(IMediaPlayerInter iMediaPlayerInter, int i, int i2, Throwable th) {
        PlayerStatKt.a(this, "H5VideoPlayer.onError");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,H5VideoPlayer::onError(" + iMediaPlayerInter + ") what=" + i + ";extra=" + i2);
        if (!cv()) {
            PlatformStatUtils.a("VIDEO_PLAY_FAILED_" + al(), i);
        }
        if (this.W != -1) {
            a(iMediaPlayerInter, i, i2, th);
        }
        LogUploadUtil.a("VideoOnError_" + i);
        a(i, 202, th == null ? null : th.toString());
        a(i, th);
        if (this.bm) {
            VideoManager.getInstance().getVideoHost().showToast("播放失败,错误码:" + i, 1);
        }
        if (!CpuInfoUtils.isSupportedCPU()) {
            VideoManager.getInstance().getVideoHost().onVideoCanNotSupport(this.as);
        }
        this.T.a(th);
        super.onError(iMediaPlayerInter, i, i2, th);
        this.q.h();
        VideoManager.getInstance().getVideoHost().userBehaviorWithParams(StatVideoConsts.VALUE_EVENT_VIDEO_ACTION173, cg());
        if (this.f72678a.f72811b.A != null) {
            this.f72678a.f72811b.A.h();
        }
        return true;
    }

    @Override
    public boolean onExtInfo(IMediaPlayerInter iMediaPlayerInter, int i, int i2, String str) {
        super.onExtInfo(iMediaPlayerInter, i, i2, str);
        if (i == 431 && TextUtils.equals("first_frame_message", str)) {
            l(str);
            return false;
        }
        if (i != 700 || TextUtils.isEmpty(str) || !str.contains("onvideoeventlag")) {
            return false;
        }
        this.p.m(str);
        return false;
    }

    @Override
    public void onFunctionWindowViewHide() {
        if (this.G) {
            return;
        }
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,onFunctionWindowViewHide");
        this.v = true;
        this.cH.a("Try to auto pause for onFunctionWindowViewHide");
        ah();
    }

    @Override
    public void onFunctionWindowViewShow() {
        if (this.G) {
            return;
        }
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,onFunctionWindowViewShow");
        this.v = false;
        if (this.u == 3) {
            ai();
        }
        if (bz()) {
            this.ax.resumePlayerRotateStatus();
        }
    }

    @Override
    public void onHaveVideoData(IMediaPlayerInter iMediaPlayerInter) {
        long j = this.cQ;
        this.cQ = 0L;
        if (j > 0) {
            Map<String, String> cg = cg();
            StatVideoConsts.addExtraToParams(cg, Collections.singletonMap("loading_time", String.valueOf(SystemClock.elapsedRealtime() - j)));
            VideoManager.getInstance().getVideoHost().userBehaviorWithParams(StatVideoConsts.VALUE_EVENT_VIDEO_ACTION172, cg);
        }
        PlayerStatKt.a(this, "H5VideoPlayer.onHaveVideoData");
        this.f72678a.am();
        dk();
        this.q.l();
        this.Y.invokeWebViewClientMiscCallBackMethod("onHaveVideoData", null);
        this.cR.d();
    }

    @Override
    public boolean onInfo(IMediaPlayerInter iMediaPlayerInter, int i, int i2) {
        super.onInfo(iMediaPlayerInter, i, i2);
        if (i == 701) {
            this.D = true;
        } else if (i == 702) {
            this.D = false;
        } else if (this.ac != IMediaPlayer.PlayerType.SYSTEM_PLAYER && i == 790) {
            this.f72678a.n(i2);
            if (i2 == 90) {
                this.br = SystemClock.elapsedRealtime();
                this.p.e("findstream", String.valueOf(this.br - this.bq));
            }
        } else if (i == 810) {
            i(true);
        } else if (this.ac == IMediaPlayer.PlayerType.WONDER_PLAYER && i == 820) {
            this.ap.clearMcDecodeType();
        } else if (getScreenMode() == 101 && !S()) {
            d(1);
        }
        if (i == 700) {
            this.Y.onInfo(i, i2);
        }
        return false;
    }

    @Override
    public void onMediaPlayerCreated() {
        da();
        bK();
    }

    @Override
    public Object onMiscCallBack(String str, Bundle bundle) {
        Handler handler;
        if (!"updateVideoInfo".equals(str)) {
            if ("setVideoAttr".equals(str)) {
                if (bundle != null) {
                    String string = bundle.getString("key");
                    String string2 = bundle.getString("value");
                    if (string != null) {
                        String lowerCase = string.toLowerCase();
                        if (lowerCase.startsWith("x5-video-vr-")) {
                            if (string2 != null) {
                                string2 = string2.toLowerCase();
                            }
                            if (this.bP == null) {
                                this.bP = SafeBundleUtil.a();
                            }
                            if (string2 != null) {
                                this.bP.putString(lowerCase, string2);
                            }
                        } else if ("reuseid".equals(lowerCase)) {
                            this.cc = string2;
                        } else if ("x5-video-no-title".equals(lowerCase)) {
                            this.ck = true;
                        } else if ("x5-video-show-mute-btn".equals(lowerCase)) {
                            if (IOpenJsApis.TRUE.equals(string2)) {
                                this.bk |= 2;
                            }
                        } else if ("x5-video-no-autopause".equals(lowerCase)) {
                            this.cm = true;
                        } else if ("x5-video-fullscreen-title".equals(lowerCase)) {
                            if (this.aq != null) {
                                this.aq.mWebTitle = string2;
                            } else {
                                this.cp = string2;
                            }
                        }
                    }
                }
            } else if (TextUtils.equals("realTimeStat", str)) {
                a(true, bundle);
            } else {
                if (TextUtils.equals("isTvkAdvPlaying", str)) {
                    return Boolean.valueOf(this.bO);
                }
                if ("isPlayerReused".equals(str)) {
                    return Boolean.valueOf(this.cb != null);
                }
                if (TextUtils.equals("destroyPlayer", str)) {
                    C();
                } else {
                    if (TextUtils.equals("showControlBar", str)) {
                        this.bT = false;
                    } else if (TextUtils.equals("hideControlBar", str)) {
                        this.bT = true;
                    } else if (TextUtils.equals("download", str)) {
                        if (aM()) {
                            a("版权限制,暂不支持下载");
                        } else {
                            this.f72678a.a(bundle);
                        }
                    } else if (!TextUtils.equals("updateSurfaceMode", str) || bundle == null) {
                        if (TextUtils.equals("updateExtraInfo", str) && bundle != null) {
                            String string3 = bundle.getString("videoName");
                            if (this.aq != null) {
                                this.aq.mWebTitle = string3;
                            }
                            String string4 = bundle.getString("extraReportVideoInfo");
                            if (!TextUtils.isEmpty(string4)) {
                                HashMap<String, String> urlParam = UrlUtils.getUrlParam("https://fakehost?" + string4);
                                if (urlParam != null && urlParam.size() > 0) {
                                    if (this.cg == null) {
                                        this.cg = new HashMap<>();
                                    }
                                    this.cg.putAll(urlParam);
                                }
                            }
                            String string5 = bundle.getString("videoImageUrl");
                            if (!TextUtils.isEmpty(string5) && !TextUtils.equals(this.cj, string5)) {
                                this.cj = string5;
                                this.m.c(this.cj);
                            }
                            this.m.e();
                        } else if (TextUtils.equals("updateVideoWatermarkInfo", str)) {
                            if (bundle != null) {
                                a(bundle);
                            }
                        } else if (TextUtils.equals("updateVideoShowingRatioMode", str) && bundle != null) {
                            l(bundle.getInt("videoShowingRatioMode", 2));
                        } else if (TextUtils.equals("setUseLocalFilePanel", str)) {
                            this.cz = true;
                        } else if (TextUtils.equals(HippyQBLongVideoViewController.COMMAND_SHOW_PANEL, str)) {
                            H5VideoMediaController h5VideoMediaController = this.f72678a;
                            if (h5VideoMediaController != null) {
                                h5VideoMediaController.q();
                            }
                        } else if (TextUtils.equals("hidePanel", str)) {
                            H5VideoMediaController h5VideoMediaController2 = this.f72678a;
                            if (h5VideoMediaController2 != null) {
                                h5VideoMediaController2.p();
                            }
                        } else {
                            if (TextUtils.equals("isFullyControl", str)) {
                                return Boolean.valueOf(this.cl);
                            }
                            if (TextUtils.equals("setFullyControl", str)) {
                                b(bundle);
                            } else if (TextUtils.equals("getVideoFileSize", str)) {
                                IMediaPlayerInter iMediaPlayerInter = this.Z;
                                if (iMediaPlayerInter != null) {
                                    return Long.valueOf(iMediaPlayerInter.getFileSize());
                                }
                            } else if (TextUtils.equals("setBusinessLog", str)) {
                                if (bundle != null) {
                                    this.p.b(bundle.getString("businessLog", null));
                                }
                            } else if (TextUtils.equals(HippyQBVideoViewController.COMMAND_SWITCH_DEFINITION, str)) {
                                if (bundle != null) {
                                    a(bundle.getString("definition"), false);
                                }
                            } else if (TextUtils.equals("switchDefinitionForUrl", str)) {
                                if (bundle != null) {
                                    j(bundle.getString("url"));
                                }
                            } else if (TextUtils.equals("setTVEpisodeInfo", str)) {
                                H5VideoMediaController h5VideoMediaController3 = this.f72678a;
                                if (h5VideoMediaController3 != null) {
                                    h5VideoMediaController3.b(bundle);
                                }
                            } else if (TextUtils.equals("updateTVideoBaseInfo", str)) {
                                this.T.a(bundle);
                            } else if (!TextUtils.equals("setPageFloatMode", str) || bundle == null) {
                                if (TextUtils.equals("updateExtraRestoreData", str) && bundle != null) {
                                    this.cV.clear();
                                    this.cV.putAll(bundle);
                                    VideoPlayRestoreKt.a().b(this);
                                } else {
                                    if (TextUtils.equals("getPlayerState", str)) {
                                        return Integer.valueOf(this.E);
                                    }
                                    if (TextUtils.equals("isPermissionTimeout", str)) {
                                        return Boolean.valueOf(this.T.u());
                                    }
                                    if (TextUtils.equals("supportM89LiteWnd", str)) {
                                        return true;
                                    }
                                    if (TextUtils.equals("showPanelLongVideo", str)) {
                                        de();
                                    } else {
                                        if (TextUtils.equals("getAuthTask", str)) {
                                            return this.T.v();
                                        }
                                        if (TextUtils.equals("updatePanelMode", str) && bundle != null && (handler = this.r) != null) {
                                            handler.post(new Runnable() {
                                                @Override
                                                public void run() {
                                                    if (H5VideoPlayer.this.f72678a == null || H5VideoPlayer.this.f72678a.f72811b == null) {
                                                        return;
                                                    }
                                                    VideoMediaControllerView videoMediaControllerView = H5VideoPlayer.this.f72678a.f72811b;
                                                    videoMediaControllerView.measure(View.MeasureSpec.makeMeasureSpec(videoMediaControllerView.getWidth(), WXVideoFileObject.FILE_SIZE_LIMIT), View.MeasureSpec.makeMeasureSpec(videoMediaControllerView.getHeight(), WXVideoFileObject.FILE_SIZE_LIMIT));
                                                    videoMediaControllerView.layout(videoMediaControllerView.getLeft(), videoMediaControllerView.getTop(), videoMediaControllerView.getRight(), videoMediaControllerView.getBottom());
                                                    videoMediaControllerView.requestLayout();
                                                }
                                            });
                                        }
                                    }
                                }
                            } else {
                                if (FeatureToggle.a(BuildConfig.BUG_TOGGLE_94303185)) {
                                    return null;
                                }
                                int i = bundle.getBoolean("isFloatMode") ? 110 : 101;
                            }
                        }
                    } else if (this.X != null) {
                        this.X.b(bundle.getInt("width"), bundle.getInt("height"));
                    }
                    aW();
                }
            }
        } else if (bundle != null) {
            this.bF = bundle.getBoolean("fakeFullScreen");
            this.af = bundle.getBoolean("isHardwareAccelerated");
        }
        return null;
    }

    @Override
    public void onNoVideoData(IMediaPlayerInter iMediaPlayerInter) {
        PlayerStatKt.a(this, "H5VideoPlayer.onNoVideoData");
        this.cQ = SystemClock.elapsedRealtime();
        this.R.b();
        PlatformStatUtils.a("VIDEO_PLAY_BUFFERING_" + al());
        this.f72678a.b(this.E, false);
        this.f72678a.c(c(this.as));
        x(3000);
        this.q.k();
        this.Y.invokeWebViewClientMiscCallBackMethod("onNoVideoData", null);
        this.p.p();
        this.cR.c();
    }

    @Override
    public void onPause(Activity activity) {
        PlayerStatKt.a(this, "H5VideoPlayer.onPause");
        if (this.G) {
            return;
        }
        VideoManager.getInstance().setKeyguardStatus();
        a(activity);
    }

    @Override
    public void onPlayCanceled() {
        PlayerStatKt.a(this, "H5VideoPlayer.onPlayCanceled");
        Object invokeWebViewClientMiscCallBackMethod = this.Y.invokeWebViewClientMiscCallBackMethod("mobileNetCancelPlay", null);
        if ((invokeWebViewClientMiscCallBackMethod instanceof Boolean) && ((Boolean) invokeWebViewClientMiscCallBackMethod).booleanValue()) {
            return;
        }
        e(false);
        aF();
    }

    @Override
    public void onPlayConfirmed(int i) {
        PlayerStatKt.a(this, "H5VideoPlayer.onPlayConfirmed");
        Logs.c("BubbleD", "H5VideoPlayer.onPlayConfirmed index = " + i);
        if (i == 0 || i == 3) {
            if (i == 0) {
                VideoSettingManager.a().b(System.currentTimeMillis());
            }
            bi();
        } else if (i == 2) {
            onPlayCanceled();
        }
    }

    @Override
    public void onPluginDownloadProgress(String str, int i, int i2) {
        PlayerStatKt.a(this, "H5VideoPlayer.onPluginDownloadProgress");
        if (this.B) {
            Message obtainMessage = this.r.obtainMessage(110);
            obtainMessage.arg1 = i2;
            obtainMessage.sendToTarget();
        }
        VideoPluginLoadStatSession videoPluginLoadStatSession = this.cN;
        if (videoPluginLoadStatSession != null) {
            videoPluginLoadStatSession.b();
        }
    }

    @Override
    public void onPluginDownloadStart(String str, int i) {
        PlayerStatKt.a(this, "H5VideoPlayer.onPluginDownloadStart");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,PlayerSession, onDownloadStart  totalSize = " + i);
        if (this.B) {
            Message obtainMessage = this.r.obtainMessage(109);
            obtainMessage.arg1 = i;
            obtainMessage.sendToTarget();
        }
        VideoPluginLoadStatSession videoPluginLoadStatSession = this.cN;
        if (videoPluginLoadStatSession != null) {
            videoPluginLoadStatSession.b();
        }
    }

    @Override
    public void onPluginPrepareFinished(String str, QBPluginItemInfo qBPluginItemInfo, int i, int i2, Throwable th) {
        PlayerStatKt.a(this, "H5VideoPlayer.onPluginPrepareFinished");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,PlayerSession, onPrepareFinished status = " + i + " errorCode = " + i2);
        VideoPluginLoadStatSession videoPluginLoadStatSession = this.cN;
        if (videoPluginLoadStatSession != null) {
            videoPluginLoadStatSession.a(i2);
        }
        WonderPlayerSoSession.a(this.ab).a(this);
        this.bC = th;
        this.by = false;
        this.aM = false;
        this.bt = i == 0 ? i : i2;
        this.r.removeMessages(111);
        if (this.B) {
            if (i != 0) {
                PlayerStatKt.a(this, "H5VideoPlayer.onPluginPrepareFinished3");
                G(i2);
            } else {
                PlayerStatKt.a(this, "H5VideoPlayer.onPluginPrepareFinished2");
                this.A = false;
                this.aN = false;
                this.r.post(new Runnable() {
                    @Override
                    public void run() {
                        H5VideoPlayer.this.dv();
                    }
                });
            }
        }
    }

    @Override
    public void onPluginPrepareStart(String str) {
        PlayerStatKt.a(this, "H5VideoPlayer.onPluginPrepareStart");
        if (this.B) {
            Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,PlayerSession, onPrepareStart ");
            this.r.sendMessageDelayed(this.r.obtainMessage(111), 1000L);
        }
    }

    @Override
    public void onPreDownloadError(String str) {
    }

    @Override
    public void onPreDownloadSuccess(String str) {
        c(str, 10);
    }

    @Override
    public void onPrepared(IMediaPlayerInter iMediaPlayerInter) {
        VideoStatData videoStatData;
        long j;
        long j2;
        PlayerStatKt.a(this, "H5VideoPlayer.onPrepared");
        this.cM.a(70);
        boolean z = this.bO;
        if (z) {
            this.p.b(z);
            this.p.c();
            this.bO = false;
        }
        if (this.Z == null) {
            return;
        }
        this.cL.b();
        Map<String, String> cg = cg();
        StatVideoConsts.addExtraToParams(cg, Collections.singletonMap("first_frame_loading_time", String.valueOf(this.cL.i())));
        VideoManager.getInstance().getVideoHost().userBehaviorWithParams(StatVideoConsts.VALUE_EVENT_VIDEO_ACTION171, cg);
        PlatformStatUtils.a("VIDEO_PLAY_READY_" + al());
        this.l = true;
        if (this.ct != null) {
            long currentTimeMillis = System.currentTimeMillis() - this.ct.f72729b;
            this.ct.f72730c = this.ct.f72730c + "\n数据和解码器准备,耗时:" + currentTimeMillis + "ms";
            this.ct.f72729b = System.currentTimeMillis();
            PerformanceData performanceData = this.ct;
            performanceData.f72731d = performanceData.f72731d + currentTimeMillis;
            Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer, :: onPrepared() --- url: " + this.aq.mVideoUrl + " 耗时:" + this.ct.f72730c + "\n" + this);
        }
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,important time onPrepared,mRequestType=" + this.o + " this = " + this);
        this.bs = SystemClock.elapsedRealtime();
        if (cu() || cv()) {
            if (this.O == 5 && !this.P) {
                pause(5);
            }
            videoStatData = this.p;
            j = this.bs;
            j2 = this.br;
        } else {
            videoStatData = this.p;
            j = this.bs;
            j2 = this.bq;
        }
        videoStatData.e("onprepared", String.valueOf(j - j2));
        a(iMediaPlayerInter);
        this.f72678a.be();
        dA();
        v();
        this.r.sendEmptyMessageDelayed(TPOptionalID.OPTION_ID_BEFORE_LONG_DEMXUER_TYPE, 5000L);
    }

    @Override
    public void onResume(Activity activity) {
        PlayerStatKt.a(this, "H5VideoPlayer.onResume");
        if (this.G) {
            return;
        }
        VideoManager.getInstance().setKeyguardStatus();
        a((Context) activity, true);
    }

    @Override
    public void onScreenModeChangeBefore(int i, int i2) {
        this.ax.onPlayScreenModeChangeBefore(i, i2);
    }

    @Override
    public void onScreenModeChanged(int i, int i2) {
        if (isDestroyed()) {
            return;
        }
        c(bS());
        e(i, i2);
        this.ax.onPlayScreenModeChanged(i, i2);
        if (this.Y != null) {
            this.Y.setScreenMode(getScreenMode());
        }
        if (!o(i) && o(i2)) {
            dn();
        }
        this.f72678a.a(i, i2);
        if (i2 == 103) {
            if (aT()) {
                VideoManager.getInstance().getVideoHost().userBehaviorStatistics("AWSP003");
            }
            VideoManager.getInstance().getVideoHost().userBehaviorStatistics("AWSP004");
        }
        aH();
        aW();
        if ((o(i) || !o(i2) || this.bO) ? false : true) {
            this.r.postDelayed(new Runnable() {
                @Override
                public void run() {
                    H5VideoPlayer.this.f72678a.q();
                }
            }, 100L);
        }
        if (!o(i) && o(i2)) {
            r(IVideoService.EVENT_ON_ENTER_FULL_SCREEN);
        } else if (o(i) && !o(i2)) {
            Bundle a2 = SafeBundleUtil.a();
            a2.putBoolean("isUsedLocalFilePanel", this.cz);
            b(IVideoService.EVENT_ON_EXIT_FULL_SCREEN, a2);
        }
        bK();
        this.T.b(i2);
        VideoPlayRestoreKt.a().b(this);
    }

    @Override
    public void onSeekComplete(IMediaPlayerInter iMediaPlayerInter) {
        PlayerStatKt.a(this, "H5VideoPlayer.onSeekComplete");
        if (this.G) {
            return;
        }
        this.aP = -1;
        super.onSeekComplete(iMediaPlayerInter);
        P();
        this.f72678a.a(iMediaPlayerInter);
        try {
            if (this.aS != null && this.aT > this.aU) {
                this.aS.seekReset();
            }
        } catch (Exception unused) {
        }
        List<IPlayer.IPlayerCallback> list = this.bN;
        if (list != null) {
            Iterator<IPlayer.IPlayerCallback> it = list.iterator();
            while (it.hasNext()) {
                it.next().onSeekCompleted();
            }
        }
    }

    @Override
    public void onSurfaceCreated() {
        TextureView ck;
        l("SurfaceCreated");
        PlayerStatKt.a(this, "H5VideoPlayer.onSurfaceCreated");
        this.cM.a(30);
        if (this.ct != null) {
            long currentTimeMillis = System.currentTimeMillis() - this.ct.f72729b;
            this.ct.f72730c = this.ct.f72730c + "\n创建surface,耗时:" + currentTimeMillis + "ms";
            this.ct.f72729b = System.currentTimeMillis();
            PerformanceData performanceData = this.ct;
            performanceData.f72731d = performanceData.f72731d + currentTimeMillis;
        }
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,important time onSurfaceCreated,mPlayerState:" + this.E + " this = " + this);
        if (this.ao == null || this.G) {
            return;
        }
        if (QBVideoRenderer.h() && (ck = ck()) != null) {
            ck.setOpaque(!this.cA);
        }
        g();
        if (!Z() && !this.av.f()) {
            Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,surface is not valid return!");
            return;
        }
        PlayerStatKt.a(this, "H5VideoPlayer.onSurfaceCreated2");
        N();
        if (this.W == 2) {
            cw();
            if ((aj() || !this.F) && !this.cl) {
                this.cH.a("Try to auto pause for onSurfaceCreated() not active or visible");
                ah();
            } else {
                int i = this.E;
                if (i != 4 && i != 6 && !this.f72678a.L()) {
                    PlayerStatKt.a(this, "H5VideoPlayer.onSurfaceCreated_start");
                    M();
                }
            }
        } else if (this.W != 1) {
            this.bp = SystemClock.elapsedRealtime();
            VideoStatData videoStatData = this.p;
            videoStatData.e("surfacecreate", String.valueOf(this.bp - videoStatData.ai));
            PlayerStatKt.a(this, "H5VideoPlayer.onSurfaceCreated_initPlayer");
            aE();
        } else if (this.T.t() && this.av != null && (this.av.b() instanceof TVideoSurfaceCreator)) {
            cw();
        }
        aG();
        VideoManager.getInstance().getVideoHost().userBehaviorWithParams(StatVideoConsts.VALUE_EVENT_VIDEO_ACTION1, cg());
    }

    @Override
    public void onSurfaceCreated(Object obj) {
        this.N.b(obj);
    }

    @Override
    public void onSurfaceDestroyed() {
        PlayerStatKt.a(this, "H5VideoPlayer.onSurfaceDestroyed");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,onSurfaceDestroyed");
        if (this.ac != IMediaPlayer.PlayerType.SYSTEM_PLAYER) {
            a(this.W != 2);
            return;
        }
        a(true);
        if (this.F) {
            return;
        }
        this.s = true;
    }

    @Override
    public void onSurfaceTextureCreated(Object obj) {
        PlayerStatKt.a(this, "H5VideoPlayer.onSurfaceTextureCreated");
        this.N.a(obj);
    }

    @Override
    public void onTimedText(IMediaPlayerInter iMediaPlayerInter, String str) {
        if (this.aS != null) {
            g(str);
        }
    }

    @Override
    public void onTvkAdvEvent(int i, Bundle bundle) {
        int i2;
        if (this.G) {
            return;
        }
        if (i == 6) {
            this.Y.invokeWebViewClientMiscCallBackMethod(null, bundle);
            return;
        }
        if (i != 3) {
            if (i == 4) {
                i2 = bA();
            } else if (i == 5) {
                i2 = 101;
            }
            switchScreen(i2);
        } else {
            if (this.Z == null) {
                return;
            }
            this.bO = true;
            a(this.Z);
        }
        updateControlView();
        this.f72678a.onTvkAdvEvent(i, bundle);
    }

    @Override
    public void onUpdateSurface(IMediaPlayer.PlayerType playerType, int i, int i2, int i3) {
        PlayerStatKt.a(this, "H5VideoPlayer.onUpdateSurface");
        this.p.a("PlayerStateDepr", 15);
        this.p.ak++;
        this.ac = playerType;
        IMediaPlayer.DecodeType valueOf = IMediaPlayer.DecodeType.valueOf(i);
        this.f72678a.al();
        this.at = i3;
        if (this.X != null) {
            try {
                cS();
                a(valueOf, true);
            } catch (Exception e) {
                onError(null, WonderErrorCode.ERROR_SHOWVIDEO_ERROR, 0, e);
                return;
            }
        }
        if (this.ac == IMediaPlayer.PlayerType.SYSTEM_PLAYER) {
            this.y = i2;
        }
        this.p.a(this.Z, valueOf);
    }

    @Override
    public void onVideoCaptureImageCreated(String str, String str2) {
        if (StringUtils.a(str, getWebUrl())) {
            dA();
        }
    }

    @Override
    public void onVideoSizeChanged(int i, int i2) {
        this.f72678a.b(i, i2);
    }

    @Override
    public void onVideoSizeChanged(IMediaPlayerInter iMediaPlayerInter, int i, int i2) {
        PlayerStatKt.a(this, "H5VideoPlayer.onVideoSizeChanged");
        if (this.ah == i && this.ai == i2) {
            return;
        }
        this.bg = false;
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,shawnhan111 onVideoSizeChanged actionFrom " + this.O + ", player = " + this + ", w = " + i + ", h = " + i2);
        this.ah = i;
        this.ai = i2;
        this.aC.a(i, i2);
        N();
        if (!n(this.aq)) {
            b(iMediaPlayerInter, i, i2);
        }
        this.Y.onVideoSizeChanged(i, i2);
        Iterator<IPlayer.IPlayerCallback> it = this.bN.iterator();
        while (it.hasNext()) {
            it.next().onVideoSizeChanged(i, i2);
        }
    }

    @Override
    public void onVideoStartShowing(IMediaPlayerInter iMediaPlayerInter) {
        PlayerStatKt.a(this, "H5VideoPlayer.onVideoStartShowing1");
        k("--onVideoStartShowing");
        this.cM.a(90);
        if (cL()) {
            return;
        }
        PlayerStatKt.a(this, "H5VideoPlayer.onVideoStartShowing2");
        super.onVideoStartShowing(iMediaPlayerInter);
        this.cL.d();
        a(0, 0, (String) null);
        if (this.X != null) {
            this.X.i();
        }
        long elapsedRealtime = SystemClock.elapsedRealtime() - this.bq;
        this.p.e(SystemDictionary.field_first_frame_time, String.valueOf(SystemClock.elapsedRealtime() - this.bs));
        if (this.Z != null && elapsedRealtime > 0) {
            this.p.e("firstrate", String.valueOf((this.Z.getRealTimeDownloadedLen() * 1000) / elapsedRealtime));
        }
        this.p.c(this.as);
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,important time onVideoStartShowing() firstFrameTime = " + (SystemClock.elapsedRealtime() - this.p.ai));
        if (this.ct != null) {
            long currentTimeMillis = System.currentTimeMillis() - this.ct.f72729b;
            PerformanceData performanceData = this.ct;
            performanceData.f72728a = this.e;
            performanceData.f72730c = this.ct.f72730c + "\n解码器解出第一帧,耗时:" + currentTimeMillis + "ms";
            this.ct.f72729b = System.currentTimeMillis();
            PerformanceData performanceData2 = this.ct;
            performanceData2.f72731d = performanceData2.f72731d + currentTimeMillis;
            Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer, :: onVideoStartShowing() --- url: " + this.aq.mVideoUrl + " 耗时:" + this.ct.f72730c + "\n" + this);
            Bundle a2 = SafeBundleUtil.a();
            a2.putString("title", this.ct.f72728a);
            a2.putString("info", this.ct.f72730c);
            a2.putLong("total", this.ct.f72731d);
            a2.putString("decodeType", this.ao + "");
            this.Y.invokeWebViewClientMiscCallBackMethod("performance_show", a2);
            this.ct = null;
        }
        this.q.j();
        aH();
        if (!m(this.as)) {
            w();
        }
        this.E = 3;
        updateControlView();
        this.p.d();
        this.p.a(this.bq);
        VideoStatData videoStatData = this.p;
        videoStatData.u = 0;
        videoStatData.ad = System.currentTimeMillis() - this.p.ae;
        if (this.p.v == -1 && this.Z != null) {
            this.p.v = this.Z.getConnTime();
        }
        if (this.f72680c && cx() && VideoNetworkStatus.a().e()) {
            this.f72680c = false;
            this.r.postDelayed(new Runnable() {
                @Override
                public void run() {
                    if (H5VideoPlayer.this.getCurrentPosition() < 1000) {
                        H5VideoPlayer.this.f72678a.makeText(VideoResources.b("video_sdk_download_reduce_all_time"));
                    }
                }
            }, 200L);
        }
        this.J.g();
        n();
        this.f72678a.l();
        VideoPlayRestoreKt.a().a(this);
        if (bz()) {
            dn();
        }
        VideoManager.getInstance().getVideoHost().userBehaviorWithParams(StatVideoConsts.VALUE_EVENT_VIDEO_ACTION2, cg());
        if (this.cU.compareAndSet(false, true)) {
            VideoManager.getInstance().getVideoHost().userBehaviorWithParams(StatVideoConsts.VALUE_EVENT_VIDEO_ACTION183, cg());
        }
        if (this.cC) {
            d(1);
        } else {
            VideoManager.getInstance().destroyDlnaFloatPlayerWhenOtherPlayerShowing(this);
        }
        if (isLiveStreaming()) {
            this.f72678a.T();
        }
        cK();
        this.cR.a();
    }

    @Override
    public void onVideoViewMove(int i, int i2, int i3, int i4) {
        if (this.Y != null) {
            this.Y.onVideoViewMove(i, i2, i3, i4);
        }
    }

    @Override
    @Deprecated
    public boolean onViewAdded(View view, View view2) {
        return false;
    }

    @Override
    @Deprecated
    public boolean onViewRemoved(View view, View view2) {
        return false;
    }

    protected boolean p() {
        return !s(this.Y.getProxyType()) || this.C == 2;
    }

    @Override
    public void pause(int i) {
        PlayerStatKt.a(this, "H5VideoPlayer.pause");
        PlayerStatKt.a(this, "H5VideoPlayer.pause." + this.cM.a());
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,important time pause() from proxy " + i + " this = " + this);
        if (this.G) {
            return;
        }
        boolean z = true;
        this.x = 1;
        if (i == 1) {
            VideoManager.getInstance().getVideoHost().userBehaviorWithParams(StatVideoConsts.VALUE_EVENT_VIDEO_ACTION71, cg());
        }
        if (i != 1 && i != 3) {
            z = false;
        }
        a(false, z);
    }

    @Override
    public void play(H5VideoInfo h5VideoInfo, int i) {
        boolean z;
        int i2;
        StringBuilder sb;
        String str;
        String str2;
        VideoHost videoHost;
        H5VideoInfo a2 = a(h5VideoInfo);
        PlayerStatKt.a("H5VideoPlayer.play", i, a2);
        this.cM.a(10);
        if (this.G || a2 == null) {
            return;
        }
        if (r(getProxyType()) && this.cF) {
            Logs.c(IH5VideoPlayer.TAG, "Video,play() be return because already play in detail plge");
            return;
        }
        if (this.f72678a.L()) {
            Logs.c(IH5VideoPlayer.TAG, "Video,play() be return because dlna panel already showing");
            return;
        }
        if (this.f72678a.M()) {
            Logs.c(IH5VideoPlayer.TAG, "Video,play() be return because screenshot is working");
            return;
        }
        if (!TextUtils.isEmpty(a2.mVideoUrl) && i != 5) {
            this.R.c();
        }
        cT();
        this.cH.a(a2);
        PlayerStatKt.a("H5VideoPlayer.play2", i, a2);
        this.p.b();
        this.p.a();
        this.ct = new PerformanceData();
        this.ct.f72729b = System.currentTimeMillis();
        PerformanceData performanceData = this.ct;
        performanceData.f72730c = "";
        performanceData.f72731d = 0L;
        this.O = i;
        boolean z2 = false;
        if (a2.mExtraData != null) {
            z = a2.mExtraData.getBoolean("isHardwareAccelerated");
            i2 = a2.mExtraData.getInt("playType");
        } else {
            z = false;
            i2 = -1;
        }
        if (r(getProxyType()) && !m(a2.mVideoUrl) && !z && !this.cl && this.cC) {
            if ((i2 == 3 || i == 1) && !this.cB) {
                this.cC = false;
            }
        }
        if (r(getProxyType()) && !m(a2.mVideoUrl) && !z && !isLiveStreaming() && !this.cl && (i2 == 1 || i2 == 2)) {
            VideoManager.getInstance().getVideoHost().userBehaviorWithParams(StatVideoConsts.VALUE_EVENT_VIDEO_ACTION74, cg());
            VideoHost videoHost2 = VideoManager.getInstance().getVideoHost();
            if (videoHost2 != null && videoHost2.shouldDisableAutoplay(a2.mWebUrl)) {
                VideoManager.getInstance().getVideoHost().userBehaviorWithParams(StatVideoConsts.VALUE_EVENT_VIDEO_ACTION92, cg());
                this.cC = true;
            }
        }
        if (r(getProxyType()) && !isLiveStreaming() && !m(a2.mVideoUrl) && !z && i2 == 3 && ((getScreenMode() == 101 || getScreenMode() == 0) && (videoHost = VideoManager.getInstance().getVideoHost()) != null && videoHost.shouldPlayInDetailPage(a2.mWebUrl))) {
            if (!this.cB) {
                d(1);
                videoHost.openVideoInDetailPage(a2.mVideoUrl, "", this.Z != null ? this.Z.getFileSize() : 0L, a2.mWebUrl, a2.mWebTitle);
                this.cF = true;
                return;
            }
            this.cB = false;
        }
        this.p.a(i);
        if (TextUtils.isEmpty(a2.mSnifferReffer)) {
            a2.mSnifferReffer = a2.mWebUrl;
        }
        this.ca = !TextUtils.isEmpty(a2.mExtraData.getString("disableSavePlayPosition"));
        this.cr = CommonUtils.a(a2.mExtraData, "disableSubTitle") || PlayerSwitchController.a().c();
        this.cs = CommonUtils.a(a2.mExtraData, "disableRecommend");
        this.bT = a2.mExtraData.getBoolean("disableToolsBar", false);
        if (this.W == 2) {
            aH();
        }
        c(a2);
        this.cw = CommonUtils.a(a2.mExtraData, "isPrivatePlay");
        if (!TextUtils.isEmpty(a2.mExtraData.getString("videoTitle"))) {
            a2.mWebTitle = a2.mExtraData.getString("videoTitle");
        }
        if (CommonUtils.a(a2.mExtraData, "isFeedsVideoUIMode")) {
            this.bi = true;
        }
        if (CommonUtils.a(a2.mExtraData, "isPrePlayVideo")) {
            this.bW = true;
        }
        this.cu = StringUtils.b(a2.mExtraData.getString("statFrom"), -1);
        if (CommonUtils.a(a2.mExtraData, "isFeedsVideo")) {
            this.bh = true;
            if (CommonUtils.a(a2.mExtraData, "isFeedsVideosMode")) {
                this.bj = true;
            }
            b(a2);
            if (CommonUtils.a(a2.mExtraData, "isFeedsVideoAdv")) {
                this.bl = true;
            }
            if (CommonUtils.a(a2.mExtraData, "muteplay")) {
                setVolume(0.0f, 0.0f);
            } else {
                setVolume(this.bD, this.bE);
            }
            this.p.a(a2);
            if (this.bm) {
                if (TextUtils.isEmpty(a2.mVideoUrl)) {
                    sb = new StringBuilder();
                    sb.append("开始播放,页面地址: ");
                    str = a2.mWebUrl;
                } else {
                    if (m(a2.mVideoUrl)) {
                        sb = new StringBuilder();
                        str2 = "开始播放V+视频: ";
                    } else {
                        sb = new StringBuilder();
                        str2 = "开始播放,播放地址: ";
                    }
                    sb.append(str2);
                    str = a2.mVideoUrl;
                }
                sb.append(str);
                a(sb.toString());
            }
        }
        if (CommonUtils.a(a2.mExtraData, "isLiveBusiness")) {
            this.aX = true;
        } else {
            this.aX = false;
        }
        a(a2.mExtraData);
        if (CommonUtils.a(a2.mExtraData, "needCoverScreen")) {
            PlatformStatUtils.a("NEED_COVER_SCREEN_" + a2.mExtraData.getString("VideoErrorStatSession.sceneId"));
            this.aW = 5;
        }
        this.p.b(a2);
        if (this.x != -1 && getScreenMode() == 101 && !S() && i == 3 && !a2.mHasClicked && this.aq != null && TextUtils.equals(a2.mVideoUrl, this.aq.mVideoUrl)) {
            J();
            return;
        }
        this.x = 0;
        cC();
        a2.mExtraData.putBoolean("preHardwareAccelerated", this.af);
        if (this.Y.isInPrefetchPage()) {
            d(2);
            return;
        }
        if (!this.ax.canPlay()) {
            d(2);
            return;
        }
        if (!this.cl && aj() && a2.mScreenMode == 101) {
            if ((i == 1 || i == 3) && this.E == 4) {
                this.E = 3;
            }
            d(2);
            return;
        }
        boolean z3 = (this.aq == null || TextUtils.isEmpty(this.aq.mVideoUrl) || TextUtils.isEmpty(a2.mVideoUrl) || TextUtils.equals(a2.mVideoUrl, this.aq.mVideoUrl)) ? false : true;
        this.S.a(a2.mVideoUrl);
        if (z3) {
            VideoManager.getInstance().getVideoHost().userBehaviorWithParams(StatVideoConsts.VALUE_EVENT_VIDEO_ACTION52, cg());
            z();
            this.R.c();
            this.Y.setVideoInfo(a2);
            this.p.a(i);
            this.p.b(a2);
            this.p.a();
            this.p.b();
            if (CommonUtils.a(a2.mExtraData, "isFeedsVideo")) {
                this.p.a(a2);
            }
        }
        if (this.aq == null || z3) {
            dz();
            this.cF = false;
            z2 = true;
        }
        this.cT = VideoNetworkToastStrategy.a(a2.mExtraData == null ? null : a2.mExtraData.getString("networkToastStrategy"), a2.mExtraData == null ? null : a2.mExtraData.getString("networkToastStrategy_id"));
        this.T.a(a2);
        aW();
        b(a2, i);
        if (s(this.Y.getProxyType())) {
            if (a2.mHasClicked || i == 1) {
                this.C = 2;
            } else {
                this.K = true;
            }
        }
        boolean b2 = this.T.b(a2);
        if (b2) {
            k("Need reopen tvk player.");
        }
        cS();
        if (!this.B && !ad()) {
            PlayerStatKt.a("H5VideoPlayer.playVideoInfo", i, a2);
            d(a2);
        } else if (this.s) {
            PlayerStatKt.a("H5VideoPlayer.play_startPlay", i, a2);
            F();
            if (F(a2.mScreenMode)) {
                switchScreen(a2.mScreenMode);
            }
        } else if (this.W == 2 || b2) {
            if (!isSdkMode() && aj() && !this.cl) {
                d(2);
                if (b2) {
                    this.E = 3;
                    return;
                }
                return;
            }
            if (F(a2.mScreenMode)) {
                switchScreen(a2.mScreenMode);
            }
            if (!cy() && this.O != 5) {
                final IMediaPlayerInter iMediaPlayerInter = this.Z;
                if (!this.T.t() || (!(this.T.u() || b2) || iMediaPlayerInter == null)) {
                    PlayerStatKt.a("H5VideoPlayer.play_start", i, a2);
                    cP();
                } else {
                    this.T.c(a2);
                    this.T.w();
                    final Object obj = new Object();
                    Object obj2 = new Object();
                    this.bG = obj;
                    this.bH = obj2;
                    dd();
                    this.E = 2;
                    b(1000L);
                    l("fetchTVideoUserInfo in");
                    this.T.a(new TVideoUserInfoCallback() {
                        @Override
                        public void a(TVideoUserInfo tVideoUserInfo, Object obj3) {
                            H5VideoPlayer.this.l("fetchTVideoUserInfo out");
                            if (H5VideoPlayer.this.bH != obj3 || H5VideoPlayer.this.G) {
                                return;
                            }
                            H5VideoPlayer.this.T.a(tVideoUserInfo);
                            H5VideoPlayer.this.a(iMediaPlayerInter, (Throwable) null, obj, 0, WonderErrorCode.ERROR_CREAT_PLAYER_ERROR);
                        }
                    }, obj2);
                }
            }
        }
        if (z2) {
            r(IVideoService.EVENT_ON_START_PLAY);
        }
        PlayerStatKt.a(this, a2);
    }

    @Override
    public void playEpisode(H5VideoEpisodeInfo h5VideoEpisodeInfo) {
        if (h5VideoEpisodeInfo == null) {
            return;
        }
        this.x = 0;
        this.aq = VideoManager.initH5VideoFromEpisodeInfo(h5VideoEpisodeInfo, this.aq);
        this.m.a(h5VideoEpisodeInfo);
        if (this.aq.mExtraData != null) {
            this.aq.mExtraData.remove("displayTitle");
        }
        a(h5VideoEpisodeInfo.mVideoUrl, (String) null, this.J.a() == 0 ? 108 : this.J.a());
    }

    @Override
    public void preload(H5VideoInfo h5VideoInfo) {
        this.U = h5VideoInfo;
        PlayerStatKt.a("H5VideoPlayer.preload", 5, h5VideoInfo);
        if (di() && !o(h5VideoInfo)) {
            h(h5VideoInfo);
            return;
        }
        if (dj() || o(h5VideoInfo)) {
            if (h5VideoInfo != null && h5VideoInfo.mExtraData != null) {
                this.bX = TextUtils.equals(h5VideoInfo.mExtraData.getString("closeDeepPreload"), IOpenJsApis.TRUE);
                if (!this.bX && CommonUtils.a(h5VideoInfo.mExtraData, "isPrePlayVideo")) {
                    this.bW = true;
                }
            }
            if (this.bW) {
                play(h5VideoInfo, 5);
            } else if (h5VideoInfo != null) {
                if (r(this.Y.getProxyType())) {
                    h5VideoInfo.mFromWhere = 1;
                }
                this.aB.a(h5VideoInfo);
                if (m(h5VideoInfo.mVideoUrl)) {
                    Bundle bundle = new Bundle();
                    bundle.putString("url", h5VideoInfo.mVideoUrl);
                    bundle.putBoolean("load", true);
                    VideoManager.getInstance().preloadVideoData(bundle);
                } else if (l(h5VideoInfo)) {
                    f(h5VideoInfo);
                }
            } else {
                Logs.e(IH5VideoPlayer.TAG, "H5VideoPlayer," + getClass().getName() + " preload() info is null");
            }
        }
        if (!this.bW) {
            cz();
        }
        if (this.bt == -8888) {
            cA();
        }
        h(h5VideoInfo);
    }

    @Override
    public View q() {
        if (this.bF) {
            return null;
        }
        return this.f72678a.aN().a();
    }

    public String q(int i) {
        try {
        } catch (Exception unused) {
            return "";
        }
        if (i != 1) {
            if (i != 2) {
                if (i == 3) {
                    return this.p.ai + "";
                }
                if (i == 4) {
                    return this.ac + "";
                }
                return "";
            }
        } else if (WonderPlayer.getVersion() != -1) {
            return String.valueOf(WonderPlayer.getVersion());
        }
        return String.valueOf(CpuInfoUtils.getCPUType());
    }

    public void r() {
        PlayerStatKt.a(this, "H5VideoPlayer.doPause");
        this.cH.b();
        if (isPlaying() || cu() || cv()) {
            Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,shawnhan111 doPause player = " + this + ", mActionFrom = " + this.O + ", decodeType = " + this.ao);
            this.Z.pause();
            this.T.c();
        }
    }

    @Override
    public void releaseVideo(int i, boolean z) {
        PlayerStatKt.a(this, "H5VideoPlayer.releaseVideo");
        this.h = getCurrentPosition();
        if (IMediaPlayer.PlayerType.SYSTEM_PLAYER.value() == i) {
            e(z);
            this.s = true;
        } else if (IMediaPlayer.PlayerType.WONDER_PLAYER.value() == i) {
            if (this.X != null) {
                this.X.setNextWindowToken(true);
            }
            a(z);
        }
    }

    @Override
    public boolean renderRelease() {
        return false;
    }

    @Override
    public boolean reqMoveTaskFg() {
        return this.ax.reqMoveTaskForeground();
    }

    @Override
    public void requestCreateSurface() {
        this.cM.a(20);
        PlayerStatKt.a(this, "H5VideoPlayer.requestCreateSurface");
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,requestCreateSurface: mDecodeType = " + this.ao);
        if (!this.F || this.ao == null) {
            return;
        }
        this.av.a(this.ao, false, this.cA);
    }

    public boolean s() {
        return this.W == -1;
    }

    @Override
    public void seek(int i) {
        PlayerStatKt.a(this, "H5VideoPlayer.seek");
        this.cH.a(i, this.W);
        if (this.G || i < 0 || this.Z == null) {
            return;
        }
        if (this.W != 2) {
            this.h = i;
            return;
        }
        if (bv() && !c(this.as) && !this.w && this.aO && !isPlaying()) {
            h(false);
        }
        if (this.ag) {
            this.aP = i;
            this.Z.seekTo(i);
        }
        if (this.aO) {
            this.aO = false;
            if (isPlaying()) {
                return;
            }
            c(1);
            if (s(this.Y.getProxyType())) {
                Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,seek seekTo pos=" + i);
                a(i, false);
            }
        }
    }

    @Override
    public void sendErrorToUI(int i, int i2) {
        b(i, i2, (Throwable) null);
    }

    @Override
    public void setExtraAbilityHolder(IVideoExtraAbilityControllerHolder iVideoExtraAbilityControllerHolder) {
        this.aQ = iVideoExtraAbilityControllerHolder;
    }

    @Override
    public void setNextWindowToken(boolean z) {
        if (this.X != null) {
            this.X.setNextWindowToken(z);
        }
    }

    @Override
    public void setPlaybackRate(double d2) {
        float f = (float) d2;
        if (this.cv != f) {
            this.cv = f;
            b(this.cv);
        }
    }

    @Override
    public void setVideoProxy(VideoProxyDefault videoProxyDefault) {
        this.Y = videoProxyDefault;
    }

    @Override
    public void setVolume(float f, float f2) {
        this.bD = f;
        this.bE = f2;
        bK();
        if (bJ() || this.co || !isPlaying()) {
            return;
        }
        this.co = true;
        VideoManager.getInstance().requestAudioFocus();
    }

    @Override
    public void switchScreen(int i) {
        PlayerStatKt.a(this, "H5VideoPlayer.switchScreen1");
        if (b(i)) {
            return;
        }
        if (i == 108) {
            i = bA();
        }
        if (o(i) && this.T.t()) {
            i = 102;
        }
        a(i, false, false);
    }

    @Override
    public void t() throws IllegalArgumentException, SecurityException, IllegalStateException, IOException {
        PlayerStatKt.a(this, "H5VideoPlayer.prepareDataAndDisplayMode");
        this.bq = SystemClock.elapsedRealtime();
        this.p.e("playercreate", String.valueOf(this.bq - this.bp));
        this.Z.setOnVideoSizeChangedListener(this);
        this.Z.setOnUpdateSurfaceListener(this);
        this.Z.setPlayerListener(this);
        this.Z.setOnBufferingUpdateListener(this);
        this.Z.setOnTimedTextListener(this);
        this.Z.setOnDepInfoListener(this);
        this.Z.setUrlInterceptor(this);
        this.Z.setOnCacheStatusInfoListener(this);
        this.Z.setOnMediaPlayerCreatedListener(this);
        this.Z.setTvkAdvListener(this);
        this.Z.setTVKDefinitionCallback(this.S);
        this.Z.setSwitchDefinitionCallback(this.S);
        this.Z.setTVideoNetInfoListener(this.T);
        super.t();
    }

    public String u(int i) {
        return (this.Z == null || !this.l) ? "" : this.Z.getData(i);
    }

    @Override
    public void u() throws IllegalArgumentException, SecurityException, IllegalStateException, IOException {
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,H5VideoIsolateView::prepareDataCommon()");
        if (this.Z == null) {
            return;
        }
        PlayerStatKt.a(this, "H5VideoPlayer.prepareDataCommon2");
        this.cM.a(60);
        this.cL.a();
        PlatformStatUtils.a("VIDEO_PLAY_INVOKE_" + al());
        try {
            if (this.i != -1) {
                g(this.i);
            }
            super.u();
            this.p.f73693a = this.as;
            this.q.u = this.as;
        } finally {
            this.at = -1;
        }
    }

    @Override
    public void unmountProxy() {
        PlayerStatKt.a(this, "H5VideoPlayer.unmountProxy");
        PlayerStatKt.a(this, "H5VideoPlayer.unmountProxy." + this.cM.a());
        if (cr()) {
            k("TVideoMode unmountProxy, destroy directly.");
            C();
            return;
        }
        if (bk()) {
            return;
        }
        String be = be();
        if (!TextUtils.isEmpty(be) && !a(VideoManager.getInstance().getCurrentPlayer(), be)) {
            bI();
        }
        if (this.Y.getProxyType() == 3) {
            C();
        }
        if (s(this.Y.getProxyType())) {
            if (isSdkMode()) {
                bm();
                return;
            }
            if (this.J.c()) {
                ac();
                return;
            }
            if (this.f72678a.L()) {
                if (r(this.Y.getProxyType())) {
                    ((VideoScreenControl) this.J).c(bS(), 101, 105);
                } else if (bH()) {
                    e(this.X);
                }
                ac();
                VideoManager.getInstance().switchToDlnaFloatMode(this);
                return;
            }
        } else if (this.Y.getProxyType() != 2) {
            return;
        }
        C();
    }

    @Override
    public void updateControlView() {
        Handler handler = this.r;
        if (handler == null) {
            return;
        }
        if (this.bV && this.E == 2) {
            Logs.d(IH5VideoPlayer.TAG, "H5VideoPlayer,updateControlView ugc do not process updateUi from episoder before first frame.");
        } else {
            handler.removeMessages(134);
            handler.sendMessage(Message.obtain(handler, 124, this.E, 0));
        }
    }

    public void v() {
        if (this.Z == null || this.X == null) {
            return;
        }
        Bundle bundle = new Bundle(9);
        int i = this.X.f72931a;
        int i2 = this.X.f72933c;
        bundle.putInt("visible_width", i);
        bundle.putInt("visible_height", i2);
        bundle.putString("frame_rate", this.Z.getData(4));
        bundle.putString("code_model", this.Z.getData(2));
        bundle.putString("bitrate", this.Z.getData(0));
        this.Y.invokeWebViewClientMiscCallBackMethod("onVideoParameter", bundle);
    }

    @Override
    public int videoCountOnThePage() {
        return this.Y.videoCountOnThePage();
    }

    public void w() {
        if (this.cr || this.Z == null || this.aS != null) {
            return;
        }
        this.aU = 0;
        try {
            if (!TextUtils.isEmpty(this.Z.getData(6))) {
                this.aU = Integer.parseInt(this.Z.getData(6));
            }
        } catch (Exception unused) {
            this.aU = 0;
        }
        int i = this.aU;
        if (i > 0) {
            if (i > 5) {
                i = 5;
            }
            this.aU = i;
            this.aT = 1;
            Handler handler = this.r;
            if (handler != null) {
                handler.removeMessages(132);
                this.r.sendEmptyMessage(132);
            }
        }
        cH();
    }

    public void x() {
        PlayerStatKt.a(this, "H5VideoPlayer.restoreScreen");
        PlayerEnv playerEnv = this.ax;
        if (playerEnv == null || isStandardFullScreen()) {
            return;
        }
        RotateManager.a().b(aB(), playerEnv);
    }

    public int y() {
        int i;
        return (this.W != 2 || this.Z == null || (i = this.aP) < 0) ? getCurrentPosition() : i;
    }

    void z() {
        PlayerStatKt.a(this, "H5VideoPlayer.reset");
        PlayerStatKt.a(this, "H5VideoPlayer.reset." + this.cM.a());
        Logs.c(IH5VideoPlayer.TAG, "H5VideoPlayer,H5VideoIsolateView::reset() thread = " + Thread.currentThread());
        A();
        this.cV.clear();
        dk();
        this.ao = null;
        this.aF = 0;
        this.af = false;
        this.ba = true;
        this.k = false;
        this.ag = false;
        this.aL = this.as;
        this.cp = null;
        this.as = null;
        this.aq = null;
        this.am = null;
        this.C = 0;
        this.m.d();
        this.aY = false;
        this.ah = 0;
        this.ai = 0;
        this.aj = 0;
        this.ak = 0;
        this.al = -1;
        this.bd = false;
        this.v = false;
        this.bg = false;
        this.h = -1;
        this.f72680c = false;
        this.bo = 0L;
        this.bq = 0L;
        this.J.f();
        this.bv = 0;
        this.bw = 0;
        this.bx = null;
        this.bF = false;
        this.bG = null;
        this.bH = null;
        this.bI = null;
        this.bJ = false;
        this.bL = null;
        this.bQ = true;
        this.q = new VideoLiveStatData(this.ab, this);
        this.cj = null;
        this.cl = false;
        this.cF = false;
        HashMap<String, String> hashMap = this.cg;
        if (hashMap != null) {
            hashMap.clear();
        }
        this.f72678a.I();
        this.cI = null;
        this.R = new VideoErrorStatSession();
        this.cL = new TimingStat(this);
        H5VideoSurfaceCreator h5VideoSurfaceCreator = this.N;
        if (h5VideoSurfaceCreator != null) {
            h5VideoSurfaceCreator.a(0, 0);
        }
        if (this.f72678a.f72811b.A != null) {
            this.f72678a.f72811b.A.f();
        }
        this.cO = 0;
        this.P = false;
        this.T.y();
        this.cT = null;
        VideoPlayRestoreKt.a().c(this);
    }
}