package com.ss.android.ugc.aweme.shoutouts.player;

import X.0H0;
import X.1Bn;
import X.2HN;
import X.31r;
import X.5Am;
import X.BYK;
import X.F6M;
import X.F6Q;
import X.Lea;
import X.M12;
import X.QXY;
import X.QZL;
import android.content.Context;
import android.net.Uri;
import com.bytedance.covode.number.Covode;
import com.bytedance.jedi.arch.JediViewModel;
import com.ss.android.ugc.aweme.base.model.UrlModel;
import com.ss.android.ugc.aweme.download.component_api.DownloadServiceManager;
import com.ss.android.ugc.aweme.feed.model.Video;
import java.util.List;

public final class ShoutoutsPlayViewModel extends JediViewModel<ShoutoutsPlayState> {
    public final 1Bn<31r> LIZ = new 1Bn<>();
    public int LIZIZ = -1;
    public final F6Q LIZJ = new F6Q(this);

    static {
        Covode.recordClassIndex(114229);
    }

    public final /* synthetic */ 5Am dU_() {
        return new ShoutoutsPlayState(0, (F6M) null, 3, (2HN) null);
    }

    public final void LIZ(Context context, Video video) {
        String str;
        UrlModel downloadAddr;
        List urlList;
        M12.LIZ(context);
        if (video == null || (downloadAddr = video.getDownloadAddr()) == null || (urlList = downloadAddr.getUrlList()) == null) {
            str = null;
        } else {
            str = (String) Lea.LJIIIIZZ(urlList);
        }
        String str2 = BYK.LIZ(str) + '_' + System.currentTimeMillis() + ".mp4";
        Uri LIZIZ2 = 0H0.LIZIZ(context, str2, "video/mp4");
        QZL with = DownloadServiceManager.INSTANCE.getDownloadService().with(str);
        with.LJ();
        with.LIZ();
        with.LJFF = LIZIZ2.toString();
        with.LIZJ = str2;
        with.LIZ(this.LIZJ.hashCode(), this.LIZJ, QXY.SUB);
        this.LIZIZ = with.LJFF();
    }
}
