Search in sources :

Example 31 with MediaController

use of android.widget.MediaController in project android-aosp-mms by slvn.

the class SlideshowActivity method initMediaController.

private void initMediaController() {
    mMediaController = new MediaController(SlideshowActivity.this, false);
    mMediaController.setMediaPlayer(new SmilPlayerController(mSmilPlayer));
    mMediaController.setAnchorView(findViewById(R.id.slide_view));
    mMediaController.setPrevNextListeners(new OnClickListener() {

        public void onClick(View v) {
            mSmilPlayer.next();
        }
    }, new OnClickListener() {

        public void onClick(View v) {
            mSmilPlayer.prev();
        }
    });
}
Also used : MediaController(android.widget.MediaController) OnClickListener(android.view.View.OnClickListener) View(android.view.View)

Example 32 with MediaController

use of android.widget.MediaController in project JustAndroid by chinaltz.

the class PictureVideoPlayActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.picture_activity_video_play);
    video_path = getIntent().getStringExtra("video_path");
    picture_left_back = (ImageView) findViewById(R.id.picture_left_back);
    mVideoView = (VideoView) findViewById(R.id.video_view);
    mVideoView.setBackgroundColor(Color.BLACK);
    iv_play = (ImageView) findViewById(R.id.iv_play);
    mMediaController = new MediaController(this);
    mVideoView.setOnCompletionListener(this);
    mVideoView.setOnPreparedListener(this);
    mVideoView.setMediaController(mMediaController);
    picture_left_back.setOnClickListener(this);
    iv_play.setOnClickListener(this);
}
Also used : MediaController(android.widget.MediaController)

Example 33 with MediaController

use of android.widget.MediaController in project coursera-android by aporter.

the class AudioVideoVideoPlayActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    // Get a reference to the VideoView
    mVideoView = findViewById(R.id.videoViewer);
    // Add a Media controller to allow forward/reverse/pause/resume
    final MediaController mMediaController = new MediaController(AudioVideoVideoPlayActivity.this, true);
    mMediaController.setEnabled(false);
    mVideoView.setMediaController(mMediaController);
    mVideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/raw/moon"));
    // Add an OnPreparedListener to enable the MediaController once the video is ready
    mVideoView.setOnPreparedListener(new OnPreparedListener() {

        @Override
        public void onPrepared(MediaPlayer mp) {
            mMediaController.setEnabled(true);
        }
    });
}
Also used : MediaController(android.widget.MediaController) OnPreparedListener(android.media.MediaPlayer.OnPreparedListener) MediaPlayer(android.media.MediaPlayer)

Example 34 with MediaController

use of android.widget.MediaController in project AndroidSDK-RecipeBook by gabu.

the class Recipe068 method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // フルスクリーン表示にします
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    // タイトルバーを非表示にします
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);
    mVideoView = (VideoView) findViewById(R.id.video_view);
    mMediaController = new MediaController(this);
    mVideoView.setMediaController(mMediaController);
    mVideoView.setOnPreparedListener(new OnPreparedListener() {

        public void onPrepared(MediaPlayer mp) {
            mVideoView.start();
            showTelop();
        }
    });
    mFrameLayout = (FrameLayout) findViewById(R.id.frame_layout);
}
Also used : MediaController(android.widget.MediaController) OnPreparedListener(android.media.MediaPlayer.OnPreparedListener) MediaPlayer(android.media.MediaPlayer)

Example 35 with MediaController

use of android.widget.MediaController in project cw-advandroid by commonsguy.

the class VideoDemo method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    getWindow().setFormat(PixelFormat.TRANSLUCENT);
    setContentView(R.layout.main);
    File clip = new File(Environment.getExternalStorageDirectory(), "test.mp4");
    if (clip.exists()) {
        video = (VideoView) findViewById(R.id.video);
        video.setVideoPath(clip.getAbsolutePath());
        ctlr = new MediaController(this);
        ctlr.setMediaPlayer(video);
        video.setMediaController(ctlr);
        video.requestFocus();
        video.start();
    }
}
Also used : MediaController(android.widget.MediaController) File(java.io.File)

Aggregations

MediaController (android.widget.MediaController)35 MediaPlayer (android.media.MediaPlayer)10 View (android.view.View)7 LinearLayout (android.widget.LinearLayout)6 VideoView (android.widget.VideoView)5 OnPreparedListener (android.media.MediaPlayer.OnPreparedListener)3 OnClickListener (android.view.View.OnClickListener)3 File (java.io.File)3 Intent (android.content.Intent)2 ActionBar (android.support.v7.app.ActionBar)2 KeyEvent (android.view.KeyEvent)2 Button (android.widget.Button)2 OCFile (com.owncloud.android.datamodel.OCFile)2 AccountNotFoundException (com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException)2 SharedPreferences (android.content.SharedPreferences)1 Uri (android.net.Uri)1 Nullable (android.support.annotation.Nullable)1 MotionEvent (android.view.MotionEvent)1 InputMethodManager (android.view.inputmethod.InputMethodManager)1 ProgressBar (android.widget.ProgressBar)1