Example usage for android.media MediaPlayer equals

List of usage examples for android.media MediaPlayer equals

Introduction

In this page you can find the example usage for android.media MediaPlayer equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:com.android.onemedia.playback.LocalRenderer.java

private boolean isCurrentPlayer(MediaPlayer player) {
    return player.equals(mPlayer);
}

From source file:com.android.onemedia.playback.LocalRenderer.java

/**
 * Checks if the holder is ready and either sets up a callback to wait for
 * it or sets it directly. If/*w w  w .  j  ava  2  s  . c om*/
 *
 * @param holder
 * @param player
 * @return
 */
private boolean isHolderReady(final SurfaceHolder holder, final MediaPlayer player) {
    mHolder = holder;
    if (holder != null) {
        if (holder.getSurface() != null && holder.getSurface().isValid()) {
            player.setDisplay(holder);
            return true;
        } else {
            Log.w(TAG, "Holder not null, waiting for it to be ready");
            // If the holder isn't ready yet add a callback to set the
            // holder when it's ready.
            SurfaceHolder.Callback cb = new SurfaceHolder.Callback() {
                @Override
                public void surfaceDestroyed(SurfaceHolder arg0) {
                }

                @Override
                public void surfaceCreated(SurfaceHolder arg0) {
                    if (player.equals(mPlayer)) {
                        player.setDisplay(arg0);
                        preparePlayer(player, true);
                    }
                }

                @Override
                public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) {
                }
            };
            mHolderCB = cb;
            holder.addCallback(cb);
            return false;
        }
    }
    return true;
}