Android MediaController - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android MediaController class.

This code example shows how to use the following methods: setAnchorView, setEnabled, setMediaPlayer, show
        } 
 
        private void attachMediaController() { 
            if (mMediaController != null) {
                if (!mMediaControllerAttached) {
                    mMediaController.setMediaPlayer(this);
                    View anchorView = this.getParent() instanceof View ?
                            (View)this.getParent() : this;
                    mMediaController.setAnchorView(anchorView);
                    mMediaController.setEnabled(true);
                    mMediaControllerAttached = true;
                    mTimer.scheduleAtFixedRate(mImageTask, 0, 1000 / mFrameRate);
                } 
                mMediaController.show();
            } 
        } 
 
        @Override 
        public boolean onTouchEvent(MotionEvent event) {
            attachMediaController(); 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        mVideoView.onResume();
    } 
 
    private View createView() {
        mVideoView = new VideoDumpView(this);
        mVideoView.setMediaController(new MediaController(context));
 
        LinearLayout mainLayout = new LinearLayout(this);
        mainLayout.addView(mVideoView, new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.MATCH_PARENT));
 
        return mainLayout;
    } 
 
    protected void onStop() { 
        if (mVideoView != null) {
            if (mVideoView.isPlaying()) {
                mVideoView.stopPlayback();
            } 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setAnchorView, setEnabled, setMediaPlayer, show
 
    // MediaPlayer.OnPreparedListener 
    public void onPrepared(MediaPlayer mp)
    { 
        Log.i(TAG, "CallPlayer onPrepared about to construct MediaController object");
        controller = new MediaController(this, true); // enble fast forward
        //controller = new MyMediaController(this, true); // enble fast forward 
        //controller = new MediaController(getApplicationContext()); // why is useing 'this' different than 'getApplicationContext()' ? 
 
        controller.setMediaPlayer(aplayer);
        controller.setAnchorView(anchor);
        controller.setEnabled(true);
        controller.show(0); //aplayer.getDuration());
         
        // controller disappears after 3 seconds no matter what... set timer to handle re-showing it? 
    } 
 
    public boolean onInfo(MediaPlayer mp, int what, int extra)
    { 
        Log.i(TAG, "CallPlayer onInfo with what " + what + " extra " + extra);
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setBackgroundColor, setAnchorView, setEnabled, setMediaPlayer, show
This code example shows how to use the following methods: isShowing, show
	} 
 
	@Override 
	public void onWindowFocusChanged(boolean hasFocus) {
		super.onWindowFocusChanged(hasFocus);
		if(hasFocus && begin && !controller.isShowing()) {
			begin = false;
			controller.show(0);
			mediaplayer.start();
		} 
	} 
 
	@Override 
	public void onDestroy() { 
		super.onDestroy(); 
		mediaplayer.release();
	} 
 
	///////////////////// 
	// Set up the view // 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android MediaController Questions & Answers:

See Code Examples for Android MediaController Methods: