Code example for MediaPlayer

Methods: pausepreparereleasesetDataSource

1
        mp.release();
    } 
 
    public static void preparePauseRelease(String filePath) throws Exception {
        Log.v(TAG, "preparePauseRelease" + filePath);
        MediaPlayer mp = new MediaPlayer();
        mp.setDataSource(filePath);
        mp.prepare();
        mp.pause();
        mp.release();
    } 
     
    static MediaPlayer.OnVideoSizeChangedListener mOnVideoSizeChangedListener =
        new MediaPlayer.OnVideoSizeChangedListener() { 
            public void onVideoSizeChanged(MediaPlayer mp, int width, int height) { 
                synchronized (videoSizeChanged) { 
                    Log.v(TAG, "sizechanged notification received ..."); 
                    videoSizeChanged.notify(); 
                } 
            } 
Contextual code suggestions in your IDE  Get Codota for Java