package com.xunao.effectdemo.activity;

import static android.view.View.GONE;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.xunao.effectdemo.R;
import com.xunao.effectdemo.view.VideoPreviewPlay;

public class VideoPlayActivity extends Activity {
    private static final String TAG = "VideoPlayActivity";

    private VideoPreviewPlay videoPlay;
    private String url = "http://v3.cztv.com/cztv/vod/2018/06/28/7c45987529ea410dad7c088ba3b53dac/h264_1500k_mp4.mp4";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video_play);
        Intent intent = getIntent();
        if(intent != null){
            String data = intent.getStringExtra("role");
            if(data != null){
                Log.i(TAG, data);
                LinearLayout llRole = findViewById(R.id.ll_role);
                TextView tvRoleName = findViewById(R.id.tv_role_name);
                tvRoleName.setText(data);
                llRole.setVisibility(View.VISIBLE);
            }else{
                Log.i(TAG, "null");
            }
        }else{
            Log.i(TAG, "intent null");
        }
        videoPlay = findViewById(R.id.video_play);
        videoPlay.setUp(url, true, "null");
        videoPlay.getTitleTextView().setVisibility(View.GONE);
        videoPlay.getFullscreenButton().setVisibility(View.GONE);
        videoPlay.getBackButton().setVisibility(GONE);
        videoPlay.startPlayLogic();
    }
}