Android Open Source - NativeVideoPlayerComponent Native Video Player Activity






From Project

Back to project page NativeVideoPlayerComponent.

License

The source code is released under:

MIT License

If you think the Android project NativeVideoPlayerComponent listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.anchorer.videoplayer.example;
//  w ww . ja va 2  s  . co m
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageButton;
import android.widget.SeekBar;
import android.widget.TextView;

import org.anchorer.videoplayer.BaseMediaControllerHolder;
import org.anchorer.videoplayer.BaseNativeVideoPlayerActivity;
import org.anchorer.videoplayer.NativeMediaController;

/**
 * ???UI?????????Demo?
 *
 * Created by Anchorer on 2014/9/23.
 */
public class NativeVideoPlayerActivity extends BaseNativeVideoPlayerActivity implements NativeMediaController.MediaControllerGenerator {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // ?????Intent????????????????Activity?onCreate()??????????Intent??
        // ...
        // int videoId = mIntent.getIntExtra("videoId", 0);
        // ...

        // ???????????????????????????MediaPlayer?????????
        // ...
        /*
        // ?????????????
        mPlayer.setOnInfoListener(new MediaPlayer.OnInfoListener() {
            @Override
            public boolean onInfo(MediaPlayer mp, int what, int extra) {
                return false;
            }
        });
        */
        // ...
    }

    @Override
    public BaseMediaControllerHolder generateMediaController() {
        LayoutInflater inflater = LayoutInflater.from(this);
        View view = inflater.inflate(R.layout.video_native_media_controler_custom, null);

        BaseMediaControllerHolder holder = new BaseMediaControllerHolder();
        holder.parentLayout = view;
        holder.pauseButton = (ImageButton) view.findViewById(R.id.video_native_media_controller_custom_btn_start);
        holder.currentTimeView = (TextView) view.findViewById(R.id.video_native_media_controller_custom_currenttime);
        holder.totalTimeView = (TextView) view.findViewById(R.id.video_native_media_controller_custom_totaltime);
        holder.seekbar = (SeekBar) view.findViewById(R.id.video_native_media_controller_custom_seekbar);
        holder.fullScreenButton = (ImageButton) view.findViewById(R.id.video_native_media_controller_custom_btn_unfullscreen);
        holder.pauseResId = R.drawable.selector_video_btn_pause;
        holder.startResId = R.drawable.selector_video_btn_start;
        holder.fullscreenResId = R.drawable.selector_video_btn_fullscreen;
        holder.unfullscreenResId = R.drawable.selector_video_btn_unfullscreen;

        return holder;
    }
}




Java Source Code List

Anchorer.myapplication.ApplicationTest.java
org.anchorer.videoplayer.ApplicationTest.java
org.anchorer.videoplayer.BaseMediaControllerHolder.java
org.anchorer.videoplayer.BaseNativeVideoPlayerActivity.java
org.anchorer.videoplayer.NativeMediaController.java
org.anchorer.videoplayer.example.NativeVideoPlayerActivity.java
org.anchorer.videoplayer.example.StartActivity.java