导航菜单

页面标题

页面副标题

Rilo v2.0.21 - VideoShowActivity.java 源代码

正在查看: Rilo v2.0.21 应用的 VideoShowActivity.java JAVA 源代码文件

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


package app.callpe.ui.misc;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import androidx.appcompat.app.ActionBar;
import androidx.media3.common.MediaItem;
import androidx.media3.common.Player;
import androidx.media3.exoplayer.DefaultRenderersFactory;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.exoplayer.RenderersFactory;
import androidx.media3.exoplayer.mediacodec.MediaCodecSelector;
import androidx.media3.exoplayer.source.MediaSource;
import androidx.media3.exoplayer.source.ProgressiveMediaSource;
import androidx.media3.ui.PlayerView;
import app.callpe.common.utils.helper_functions.CacheDataSourceFactorySingleton;
import app.callpe.databinding.ActivityVideoShowBinding;
import app.callpe.ui.home.BaseActivity;
import java.util.Objects;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.internal.Intrinsics;
import timber.log.Timber;

@Metadata(d1 = {"\u0000F\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0000\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0003J\u0010\u0010\b\u001a\u00020\u00022\u0006\u0010\t\u001a\u00020\nH\u0016J\u0012\u0010\u000b\u001a\u00020\f2\b\u0010\r\u001a\u0004\u0018\u00010\u000eH\u0014J\b\u0010\u000f\u001a\u00020\fH\u0014J\u0010\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0013H\u0016J\b\u0010\u0014\u001a\u00020\fH\u0002J\u0010\u0010\u0015\u001a\u00020\f2\u0006\u0010\u0016\u001a\u00020\u0017H\u0007R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082.¢\u0006\u0002\n\u0000¨\u0006\u0018"}, d2 = {"Lapp/callpe/ui/misc/VideoShowActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityVideoShowBinding;", "()V", "exoPlayer", "Landroidx/media3/exoplayer/ExoPlayer;", "mediaSource", "Landroidx/media3/exoplayer/source/MediaSource;", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "onCreate", "", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onOptionsItemSelected", "", "item", "Landroid/view/MenuItem;", "setUpToolbar", "setVideoPath", "url", "", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class VideoShowActivity extends BaseActivity<ActivityVideoShowBinding> {
    private ExoPlayer exoPlayer;
    private MediaSource mediaSource;

    @Override
    public ActivityVideoShowBinding inflateLayout(LayoutInflater layoutInflater) {
        Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
        ActivityVideoShowBinding inflate = ActivityVideoShowBinding.inflate(layoutInflater);
        Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
        return inflate;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Unit unit;
        String stringExtra;
        super.onCreate(savedInstanceState);
        setUpToolbar();
        Intent intent = getIntent();
        if (intent == null || (stringExtra = intent.getStringExtra("url")) == null) {
            unit = null;
        } else {
            setVideoPath(stringExtra);
            unit = Unit.INSTANCE;
        }
        if (unit == null) {
            finish();
        }
    }

    private final void setUpToolbar() {
        try {
            getBinding().toolbar.setTitle("");
            setSupportActionBar(getBinding().toolbar);
            ActionBar actionBar = (ActionBar) Objects.requireNonNull(getSupportActionBar());
            if (actionBar != null) {
                actionBar.setDisplayHomeAsUpEnabled(true);
            }
        } catch (Exception e) {
            Timber.tag("").e(e, "setUpToolbar: Error ", new Object[0]);
        }
    }

    public final void setVideoPath(String url) {
        Intrinsics.checkNotNullParameter(url, "url");
        Context context = getBinding().getRoot().getContext();
        RenderersFactory mediaCodecSelector = new DefaultRenderersFactory(context).setEnableDecoderFallback(true).setMediaCodecSelector(MediaCodecSelector.DEFAULT);
        Intrinsics.checkNotNullExpressionValue(mediaCodecSelector, "DefaultRenderersFactory(…diaCodecSelector.DEFAULT)");
        ExoPlayer build = new ExoPlayer.Builder(context, mediaCodecSelector).build();
        Intrinsics.checkNotNullExpressionValue(build, "Builder(context, renderersFactory).build()");
        this.exoPlayer = build;
        ExoPlayer exoPlayer = null;
        if (build == null) {
            Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
            build = null;
        }
        build.addListener(new Player.Listener() {
            public void onPlaybackStateChanged(int playbackState) {
                super.onPlaybackStateChanged(playbackState);
            }
        });
        PlayerView playerView = getBinding().videoView;
        ExoPlayer exoPlayer2 = this.exoPlayer;
        if (exoPlayer2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
            exoPlayer2 = null;
        }
        playerView.setPlayer((Player) exoPlayer2);
        ExoPlayer exoPlayer3 = this.exoPlayer;
        if (exoPlayer3 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
            exoPlayer3 = null;
        }
        exoPlayer3.seekTo(0L);
        ExoPlayer exoPlayer4 = this.exoPlayer;
        if (exoPlayer4 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
            exoPlayer4 = null;
        }
        exoPlayer4.setVolume(getIntent().getBooleanExtra("audio", false) ? 1.0f : 0.0f);
        MediaSource createMediaSource = new ProgressiveMediaSource.Factory(CacheDataSourceFactorySingleton.INSTANCE.get()).createMediaSource(MediaItem.fromUri(Uri.parse(url)));
        Intrinsics.checkNotNullExpressionValue(createMediaSource, "Factory(dataSourceFactor…)\n            )\n        )");
        this.mediaSource = createMediaSource;
        ExoPlayer exoPlayer5 = this.exoPlayer;
        if (exoPlayer5 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
            exoPlayer5 = null;
        }
        MediaSource mediaSource = this.mediaSource;
        if (mediaSource == null) {
            Intrinsics.throwUninitializedPropertyAccessException("mediaSource");
            mediaSource = null;
        }
        exoPlayer5.setMediaSource(mediaSource);
        ExoPlayer exoPlayer6 = this.exoPlayer;
        if (exoPlayer6 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
            exoPlayer6 = null;
        }
        exoPlayer6.prepare();
        ExoPlayer exoPlayer7 = this.exoPlayer;
        if (exoPlayer7 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
            exoPlayer7 = null;
        }
        exoPlayer7.setPlayWhenReady(true);
        ExoPlayer exoPlayer8 = this.exoPlayer;
        if (exoPlayer8 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
        } else {
            exoPlayer = exoPlayer8;
        }
        exoPlayer.play();
    }

    protected void onDestroy() {
        super.onDestroy();
        ExoPlayer exoPlayer = this.exoPlayer;
        if (exoPlayer != null) {
            ExoPlayer exoPlayer2 = null;
            if (exoPlayer == null) {
                Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
                exoPlayer = null;
            }
            exoPlayer.stop();
            ExoPlayer exoPlayer3 = this.exoPlayer;
            if (exoPlayer3 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
            } else {
                exoPlayer2 = exoPlayer3;
            }
            exoPlayer2.release();
        }
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        Intrinsics.checkNotNullParameter(item, "item");
        if (item.getItemId() != 16908332) {
            return true;
        }
        onBackPressed();
        return true;
    }
}