Search in sources :

Example 1 with Callback

use of master.flame.danmaku.controller.DrawHandler.Callback in project ABPlayer by winkstu.

the class MainActivity method findViews.

private void findViews() {
    mMediaController = findViewById(R.id.media_controller);
    mBtnRotate = (Button) findViewById(R.id.rotate);
    mBtnHideDanmaku = (Button) findViewById(R.id.btn_hide);
    mBtnShowDanmaku = (Button) findViewById(R.id.btn_show);
    mBtnPauseDanmaku = (Button) findViewById(R.id.btn_pause);
    mBtnResumeDanmaku = (Button) findViewById(R.id.btn_resume);
    mBtnSendDanmaku = (Button) findViewById(R.id.btn_send);
    mBtnSendDanmakus = (Button) findViewById(R.id.btn_send_danmakus);
    mBtnRotate.setOnClickListener(this);
    mBtnHideDanmaku.setOnClickListener(this);
    mMediaController.setOnClickListener(this);
    mBtnShowDanmaku.setOnClickListener(this);
    mBtnPauseDanmaku.setOnClickListener(this);
    mBtnResumeDanmaku.setOnClickListener(this);
    mBtnSendDanmaku.setOnClickListener(this);
    mBtnSendDanmakus.setOnClickListener(this);
    // VideoView
    VideoView mVideoView = (VideoView) findViewById(R.id.videoview);
    // DanmakuView
    mDanmakuView = (IDanmakuView) findViewById(R.id.sv_danmaku);
    DanmakuGlobalConfig.DEFAULT.setDanmakuStyle(DanmakuGlobalConfig.DANMAKU_STYLE_STROKEN, 3).setDuplicateMergingEnabled(false);
    if (mDanmakuView != null) {
        mParser = createParser(this.getResources().openRawResource(R.raw.comments));
        mDanmakuView.setCallback(new Callback() {

            @Override
            public void updateTimer(DanmakuTimer timer) {
            }

            @Override
            public void prepared() {
                mDanmakuView.start();
            }
        });
        mDanmakuView.prepare(mParser);
        mDanmakuView.showFPS(true);
        mDanmakuView.enableDanmakuDrawingCache(true);
        ((View) mDanmakuView).setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                mMediaController.setVisibility(View.VISIBLE);
            }
        });
    }
    if (mVideoView != null) {
        mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {

            @Override
            public void onPrepared(MediaPlayer mediaPlayer) {
                mediaPlayer.start();
            }
        });
        // mVideoView.setVideoPath(Environment.getExternalStorageDirectory() + "/1.flv");
        mVideoView.setVideoURI(Uri.parse("http://us-chicago.acgvideo.com/e/e9/3444659.mp4?expires=1429119900&ssig=o8fAECKGmZkIsdZE31EYOQ&o=401361084&rate=0"));
    }
}
Also used : Callback(master.flame.danmaku.controller.DrawHandler.Callback) VideoView(android.widget.VideoView) DanmakuTimer(master.flame.danmaku.danmaku.model.DanmakuTimer) View(android.view.View) VideoView(android.widget.VideoView) DanmakuSurfaceView(master.flame.danmaku.ui.widget.DanmakuSurfaceView) IDanmakuView(master.flame.danmaku.controller.IDanmakuView) MediaPlayer(android.media.MediaPlayer)

Aggregations

MediaPlayer (android.media.MediaPlayer)1 View (android.view.View)1 VideoView (android.widget.VideoView)1 Callback (master.flame.danmaku.controller.DrawHandler.Callback)1 IDanmakuView (master.flame.danmaku.controller.IDanmakuView)1 DanmakuTimer (master.flame.danmaku.danmaku.model.DanmakuTimer)1 DanmakuSurfaceView (master.flame.danmaku.ui.widget.DanmakuSurfaceView)1