Code example for Surface

Methods: release

0
        @Override 
        public void onCompletion(final MediaPlayer mp) { 
            currentState = STATE_PLAYBACK_COMPLETED; 
            targetState = STATE_PLAYBACK_COMPLETED; 
            Log.d(LOG_TAG, "Video completed number " + number); 
            surface.release(); 
        } 
    }; 
 
    private MediaPlayer.OnPreparedListener preparedListener = new MediaPlayer.OnPreparedListener() {
        @Override 
        public void onPrepared(final MediaPlayer mp) { 
            currentState = STATE_PREPARED; 
            Log.d(LOG_TAG, "Video prepared for " + number); 
            videoWidth = mp.getVideoWidth(); 
            videoHeight = mp.getVideoHeight(); 
            requestLayout(); 
            invalidate(); 
            if ((videoWidth != 0) && (videoHeight != 0)) { 
                Log.d(LOG_TAG, "Video size for number " + number + ": " + videoWidth + '/' + videoHeight); 
                if (targetState == STATE_PLAYING) {