//package com.hc.webapp.video;
//
//import android.app.Activity;
//import android.os.Build;
//import android.os.Bundle;
//import android.support.annotation.Nullable;
//import android.view.KeyEvent;
//import android.widget.Toast;
//
//import com.hc.sysvideo.BDVideoView;
//import com.hc.webapp.R;
//
//public class SysVideoPlayerActivity extends Activity implements
//        BDVideoView.BdPlayerListener {
//
//    private BDVideoView videoView;
//
//    @Override
//    protected void onStart() {
//        super.onStart();
//        if(videoView != null) {
//            videoView.onStart();
//        }
//    }
//
//    @Override
//    protected void onCreate(@Nullable Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_video_player);
//        init();
//    }
//
//    private void init() {
//        videoView = findViewById(R.id.video_player);
//        videoView.setActivity(this);
//
//        VideoInfo info = new VideoInfo("测试", "http://10.43.111.4/88888888/16/20171218/268485555/index.m3u8?servicetype=0");
//
//        videoView.startPlayVideo(info);
//        videoView.setBdPlayerListener(this);
//    }
//
//    //遥控事件
//    @Override
//    public boolean onKeyDown(int keyCode, KeyEvent event) {
//        switch (keyCode) {
//            case KeyEvent.KEYCODE_DPAD_CENTER:      //播放/暂停
//                playOrPause();
//                return true;
////            case KeyEvent.KEYCODE_DPAD_LEFT:
////                if (videoView.canSeek()) {
////                    seekBack();
////                } else {
////                    Toast.makeText(SysVideoPlayerActivity.this, "视频准备中，暂时不能拖动快进", Toast.LENGTH_SHORT).show();
////                }
////                return true;
////            case KeyEvent.KEYCODE_DPAD_RIGHT:
////                //seekForward();
////                if (videoView.canSeek()) {
////                    seekForward();
////                } else {
////                    Toast.makeText(SysVideoPlayerActivity.this, "视频准备中，暂时不能拖动快进", Toast.LENGTH_SHORT).show();
////                }
////                return true;
////            case KeyEvent.KEYCODE_BACK:      //到顶跳到相应tab
////                /* duduPlayer.pause();*/
////                videoView.pause();
////                if (!showVideoEndDialog) {
////                    if (Build.VERSION.SDK_INT > 15) {
////                        showVideoEndDialog();
////                    } else {
////                        SysVideoPlayerActivity.this.finish();
////                    }
////                    //Toast.makeText(this,"显示VideoEndDialog",Toast.LENGTH_SHORT).show();
////                    return true;
////                } else {
////                    return false;
////                }
//        }
//        return false;
//    }
//
//    private void playOrPause(){
//        videoView.playOrPause();
//    }
//
//    @Override
//    public void onComplete() {
//
//    }
//
//    @Override
//    protected void onStop() {
//        super.onStop();
//        if(videoView != null) {
//            videoView.onStop();
//        }
//        this.finish();
//    }
//
//    @Override
//    protected void onDestroy() {
//        if(videoView != null) {
//            videoView.onDestroy();
//        }
//        super.onDestroy();
//    }
//
//}
