// Path: TigerVideoPlayer/src/main/java/cn/ittiger/player/state/PlayState.java
// public final class PlayState {
//     public static final int STATE_NORMAL = 0;
//     public static final int STATE_LOADING = 1;
//     public static final int STATE_PLAYING = 2;
//     public static final int STATE_PLAYING_BUFFERING_START = 3;
//     public static final int STATE_PAUSE = 4;
//     public static final int STATE_AUTO_COMPLETE = 5;
//     public static final int STATE_ERROR = 6;
// }


import android.graphics.SurfaceTexture;
import android.view.TextureView;
import cn.ittiger.player.state.PlayState;
package cn.ittiger.player.media;



/**
 * @author: laohu on 2017/9/10
 * @site: http://ittiger.cn
 */
public abstract class AbsSimplePlayer implements IPlayer, TextureView.SurfaceTextureListener {
    protected TextureView mTextureView;
    protected SurfaceTexture mSurfaceTexture;
    protected PlayCallback mPlayCallback;

    /**
     * 此函数中给播放器设置数据源开始loading视频数据
     *
     * 此时TextureView已经初始化完成
     */
    protected abstract void prepare();

    @Override
    public void setPlayCallback(PlayCallback playCallback) {

        mPlayCallback = playCallback;
    }

    @Override
    public void setTextureView(TextureView textureView) {

        if(mTextureView != null) {
            mTextureView.setSurfaceTextureListener(null);
        }
        mSurfaceTexture = null;
        mTextureView = textureView;
        if(textureView != null) {
            mTextureView.setSurfaceTextureListener(this);
        }
    }

    @Override
    public boolean isPlaying() {

// Path: TigerVideoPlayer/src/main/java/cn/ittiger/player/state/PlayState.java
// public final class PlayState {
//     public static final int STATE_NORMAL = 0;
//     public static final int STATE_LOADING = 1;
//     public static final int STATE_PLAYING = 2;
//     public static final int STATE_PLAYING_BUFFERING_START = 3;
//     public static final int STATE_PAUSE = 4;
//     public static final int STATE_AUTO_COMPLETE = 5;
//     public static final int STATE_ERROR = 6;
// }


// Path: TigerVideoPlayer/src/main/java/cn/ittiger/player/media/AbsSimplePlayer.java
import android.graphics.SurfaceTexture;
import android.view.TextureView;
import cn.ittiger.player.state.PlayState;

package cn.ittiger.player.media;



/**
 * @author: laohu on 2017/9/10
 * @site: http://ittiger.cn
 */
public abstract class AbsSimplePlayer implements IPlayer, TextureView.SurfaceTextureListener {
    protected TextureView mTextureView;
    protected SurfaceTexture mSurfaceTexture;
    protected PlayCallback mPlayCallback;

    /**
     * 此函数中给播放器设置数据源开始loading视频数据
     *
     * 此时TextureView已经初始化完成
     */
    protected abstract void prepare();

    @Override
    public void setPlayCallback(PlayCallback playCallback) {

        mPlayCallback = playCallback;
    }

    @Override
    public void setTextureView(TextureView textureView) {

        if(mTextureView != null) {
            mTextureView.setSurfaceTextureListener(null);
        }
        mSurfaceTexture = null;
        mTextureView = textureView;
        if(textureView != null) {
            mTextureView.setSurfaceTextureListener(this);
        }
    }

    @Override
    public boolean isPlaying() {

        return (getState() == PlayState.STATE_PLAYING ||