package com.tencent.mm.plugin.story.ui.view.gallery;

import a.k.m;
import a.l;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.g.b.a.ar;
import com.tencent.mm.plugin.story.g.b.a;
import com.tencent.mm.plugin.story.g.c;
import com.tencent.mm.plugin.story.g.h;
import com.tencent.mm.plugin.story.model.d.i;
import com.tencent.mm.plugin.story.model.k;
import com.tencent.mm.pluginsdk.ui.h.b;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.bo;

@l(dWo = {1, 1, 13}, dWp = {"\u0000!\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\f*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J6\u0010\u0002\u001a\u00020\u00032\b\u0010\u0004\u001a\u0004\u0018\u00010\u00052\b\u0010\u0006\u001a\u0004\u0018\u00010\u00052\b\u0010\u0007\u001a\u0004\u0018\u00010\u00052\u0006\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\tH\u0016J,\u0010\u000b\u001a\u00020\u00032\b\u0010\u0004\u001a\u0004\u0018\u00010\u00052\b\u0010\u0006\u001a\u0004\u0018\u00010\u00052\u0006\u0010\f\u001a\u00020\t2\u0006\u0010\r\u001a\u00020\tH\u0016J\u001c\u0010\u000e\u001a\u00020\u00032\b\u0010\u0004\u001a\u0004\u0018\u00010\u00052\b\u0010\u0006\u001a\u0004\u0018\u00010\u0005H\u0016J\u001c\u0010\u000f\u001a\u00020\u00032\b\u0010\u0004\u001a\u0004\u0018\u00010\u00052\b\u0010\u0006\u001a\u0004\u0018\u00010\u0005H\u0016J\u001c\u0010\u0010\u001a\u00020\u00032\b\u0010\u0004\u001a\u0004\u0018\u00010\u00052\b\u0010\u0006\u001a\u0004\u0018\u00010\u0005H\u0016J\u001c\u0010\u0011\u001a\u00020\u00032\b\u0010\u0004\u001a\u0004\u0018\u00010\u00052\b\u0010\u0006\u001a\u0004\u0018\u00010\u0005H\u0016J\u001c\u0010\u0012\u001a\u00020\u00032\b\u0010\u0004\u001a\u0004\u0018\u00010\u00052\b\u0010\u0006\u001a\u0004\u0018\u00010\u0005H\u0016J\u001c\u0010\u0013\u001a\u00020\u00032\b\u0010\u0004\u001a\u0004\u0018\u00010\u00052\b\u0010\u0006\u001a\u0004\u0018\u00010\u0005H\u0016J\u001c\u0010\u0014\u001a\u00020\u00032\b\u0010\u0004\u001a\u0004\u0018\u00010\u00052\b\u0010\u0006\u001a\u0004\u0018\u00010\u0005H\u0016¨\u0006\u0015"}, dWq = {"com/tencent/mm/plugin/story/ui/view/gallery/StoryVideoViewMgr$videoViewCallback$1", "Lcom/tencent/mm/pluginsdk/ui/IMMVideoView$IMMVideoViewCallback;", "onError", "", "sessionId", "", "mediaId", "errorMsg", "what", "", "extra", "onGetVideoSize", "width", "height", "onPrepared", "onVideoEnded", "onVideoFirstFrameDraw", "onVideoPause", "onVideoPlay", "onVideoWaiting", "onVideoWaitingEnd", "plugin-story_release"})
public final class p$e implements b {
    final /* synthetic */ p srl;

    p$e(p pVar) {
        this.srl = pVar;
    }

    public final void c(String str, String str2, String str3, int i, int i2) {
        AppMethodBeat.i(110979);
        ab.i(this.srl.TAG, "videoViewCallback onError: " + str + ", meidiaId:" + str2 + ", errorMsg:" + str3 + ", what:" + i + ", extra:" + i2);
        AppMethodBeat.o(110979);
    }

    public final void cp(String str, String str2) {
        AppMethodBeat.i(110980);
        ab.i(this.srl.TAG, "videoViewCallback onPrepared: " + str + ", meidiaId:" + str2);
        AppMethodBeat.o(110980);
    }

    public final void cq(String str, String str2) {
        AppMethodBeat.i(110981);
        ab.i(this.srl.TAG, "videoViewCallback onVideoEnded: " + str + ", meidiaId:" + str2);
        h hVar = h.scu;
        ar cAs = h.cAs();
        cAs.bQ(cAs.FO() + 1);
        i iVar = this.srl.srb;
        if (iVar != null) {
            com.tencent.mm.plugin.story.g.b bVar = com.tencent.mm.plugin.story.g.b.sbw;
            long j = iVar.rUJ;
            if (com.tencent.mm.plugin.story.g.b.aiG()) {
                ab.v("MicroMsg.StoryBrowseDetailIDKeyStat", "onVideoEnd ".concat(String.valueOf(j)));
                if (com.tencent.mm.plugin.story.g.b.sbi.containsKey(Long.valueOf(j))) {
                    a aVar = (a) com.tencent.mm.plugin.story.g.b.sbi.get(Long.valueOf(j));
                    if (aVar != null) {
                        aVar.eTf = true;
                        AppMethodBeat.o(110981);
                        return;
                    }
                }
            }
            AppMethodBeat.o(110981);
            return;
        }
        AppMethodBeat.o(110981);
    }

    public final void d(String str, String str2, int i, int i2) {
        AppMethodBeat.i(110982);
        ab.i(this.srl.TAG, "videoViewCallback onGetVideoSize: " + str + ", " + this.srl.sqZ + ", meidiaId:" + str2);
        AppMethodBeat.o(110982);
    }

    public final void cr(String str, String str2) {
        AppMethodBeat.i(110983);
        ab.i(this.srl.TAG, "videoViewCallback onVideoPause: " + str + ", meidiaId:" + str2);
        AppMethodBeat.o(110983);
    }

    public final void cs(String str, String str2) {
        String sessionId;
        AppMethodBeat.i(110984);
        String str3 = this.srl.TAG;
        StringBuilder append = new StringBuilder("videoViewCallback onVideoPlay: ").append(str).append(' ');
        StoryVideoView storyVideoView = this.srl.sqW;
        if (storyVideoView != null) {
            sessionId = storyVideoView.getSessionId();
        } else {
            sessionId = null;
        }
        ab.i(str3, append.append(sessionId).append(", ").append(this.srl.sqZ).append(", meidiaId:").append(str2).append(", isVideoPause:").append(this.srl.sqY).toString());
        if (m.I(str, this.srl.sqZ, false) && this.srl.sqY) {
            storyVideoView = this.srl.sqW;
            if (!(storyVideoView == null || storyVideoView.sqC)) {
                this.srl.r(null);
            }
        }
        i iVar = this.srl.srb;
        if (iVar != null) {
            c cVar = c.sbQ;
            c.lm(iVar.rUJ);
            com.tencent.mm.plugin.story.g.b bVar = com.tencent.mm.plugin.story.g.b.sbw;
            long j = iVar.rUJ;
            if (com.tencent.mm.plugin.story.g.b.aiG()) {
                str3 = "MicroMsg.StoryBrowseDetailIDKeyStat";
                append = new StringBuilder("onVideoPlay storyId ").append(j).append(" lastStoryId ").append(com.tencent.mm.plugin.story.g.b.sbh).append(" contains:").append(com.tencent.mm.plugin.story.g.b.sbi.containsKey(Long.valueOf(j))).append(" result");
                a aVar = (a) com.tencent.mm.plugin.story.g.b.sbi.get(Long.valueOf(j));
                ab.v(str3, append.append(aVar != null ? Long.valueOf(aVar.sbz) : null).toString());
                if (j == com.tencent.mm.plugin.story.g.b.sbh && com.tencent.mm.plugin.story.g.b.sbi.containsKey(Long.valueOf(j))) {
                    aVar = (a) com.tencent.mm.plugin.story.g.b.sbi.get(Long.valueOf(j));
                    if (aVar != null && !aVar.rmk && aVar.sbz <= 0 && aVar.sby > 0) {
                        aVar.isWaiting = false;
                        long gb = bo.gb(aVar.sby);
                        aVar.sbz = bo.anU();
                        if (gb > 120000) {
                            ab.w("MicroMsg.StoryBrowseDetailIDKeyStat", "onPlayCostTime  storyId " + j + " onPlayCostTime:" + gb);
                        } else {
                            ab.i("MicroMsg.StoryBrowseDetailIDKeyStat", "onPlayCostTime  storyId " + j + " onPlayCostTime:" + gb);
                            com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 31, gb);
                            com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 30, 1);
                            if (gb <= 400) {
                                com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 90, 1);
                            } else if (gb <= 800) {
                                com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 91, 1);
                            } else if (gb <= 1600) {
                                com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 92, 1);
                            } else if (gb <= 3200) {
                                com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 93, 1);
                            } else if (gb <= 5000) {
                                com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 94, 1);
                            } else {
                                com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 95, 1);
                            }
                            if (gb <= 400) {
                                com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 50, 1);
                            } else if (gb <= 800) {
                                com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 51, 1);
                            } else if (gb <= 1000) {
                                com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 52, 1);
                            } else if (gb <= 2000) {
                                com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 53, 1);
                            } else if (gb <= 3000) {
                                com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 54, 1);
                            } else if (gb <= 4000) {
                                com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 55, 1);
                            } else {
                                com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 56, 1);
                            }
                            if (j == com.tencent.mm.plugin.story.g.b.sbk) {
                                if (com.tencent.mm.plugin.story.g.b.sbo) {
                                    com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 40, 1);
                                    com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 42, gb);
                                } else {
                                    com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 41, 1);
                                    com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 43, gb);
                                }
                                if (gb <= 1000) {
                                    if (com.tencent.mm.plugin.story.g.b.sbo) {
                                        com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 44, 1);
                                    } else {
                                        com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 45, 1);
                                    }
                                } else if (gb <= 2000) {
                                    if (com.tencent.mm.plugin.story.g.b.sbo) {
                                        com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 46, 1);
                                    } else {
                                        com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 47, 1);
                                    }
                                } else if (com.tencent.mm.plugin.story.g.b.sbo) {
                                    com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 48, 1);
                                } else {
                                    com.tencent.mm.plugin.story.g.b.l(com.tencent.mm.plugin.story.g.b.lhy, 49, 1);
                                }
                            }
                        }
                    }
                }
            }
            n.sqi.lA(iVar.rUJ);
            k kVar = k.rTc;
            k.aao(iVar.username);
            AppMethodBeat.o(110984);
            return;
        }
        AppMethodBeat.o(110984);
    }

    public final void ct(String str, String str2) {
        AppMethodBeat.i(110985);
        ab.i(this.srl.TAG, "videoViewCallback onVideoWaiting: " + str + ", meidiaId:" + str2);
        i iVar = this.srl.srb;
        if (iVar != null) {
            c cVar = c.sbQ;
            c.ll(iVar.rUJ);
            com.tencent.mm.plugin.story.g.b bVar = com.tencent.mm.plugin.story.g.b.sbw;
            long j = iVar.rUJ;
            if (com.tencent.mm.plugin.story.g.b.aiG() && com.tencent.mm.plugin.story.g.b.sbi.containsKey(Long.valueOf(j))) {
                a aVar = (a) com.tencent.mm.plugin.story.g.b.sbi.get(Long.valueOf(j));
                if (!(aVar == null || aVar.rmk || !aVar.sbA)) {
                    aVar.isWaiting = true;
                    AppMethodBeat.o(110985);
                    return;
                }
            }
            AppMethodBeat.o(110985);
            return;
        }
        AppMethodBeat.o(110985);
    }

    public final void cu(String str, String str2) {
        String sessionId;
        AppMethodBeat.i(110986);
        String str3 = this.srl.TAG;
        StringBuilder append = new StringBuilder("videoViewCallback onVideoWaitingEnd: ").append(str).append(' ');
        StoryVideoView storyVideoView = this.srl.sqW;
        if (storyVideoView != null) {
            sessionId = storyVideoView.getSessionId();
        } else {
            sessionId = null;
        }
        ab.i(str3, append.append(sessionId).append(", ").append(this.srl.sqZ).append(", meidiaId:").append(str2).append(", isVideoPause:").append(this.srl.sqY).toString());
        if (m.I(str, this.srl.sqZ, false) && this.srl.sqY) {
            storyVideoView = this.srl.sqW;
            if (storyVideoView == null) {
                AppMethodBeat.o(110986);
                return;
            } else if (!storyVideoView.sqC) {
                this.srl.r(null);
            }
        }
        AppMethodBeat.o(110986);
    }
}
