Java Code Examples for tv.danmaku.ijk.media.player.IMediaPlayer#setSurface()

The following examples show how to use tv.danmaku.ijk.media.player.IMediaPlayer#setSurface() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextureRenderView.java    From DanDanPlayForAndroid with MIT License 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTexture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
            textureHolder.setSurfaceTextureHost(mTextureView.mSurfaceCallback);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 2
Source File: TextureRenderView.java    From GiraffePlayer with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTecture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 3
Source File: TextureRenderView.java    From WliveTV with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTexture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
            textureHolder.setSurfaceTextureHost(mTextureView.mSurfaceCallback);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 4
Source File: TextureRenderView.java    From IjkPlayerDemo with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTecture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 5
Source File: TextureRenderView.java    From ZZShow with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTexture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
            textureHolder.setSurfaceTextureHost(mTextureView.mSurfaceCallback);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 6
Source File: TextureRenderView.java    From MD with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTexture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
            textureHolder.setSurfaceTextureHost(mTextureView.mSurfaceCallback);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 7
Source File: TextureRenderView.java    From LivePlayback with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTexture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
            textureHolder.setSurfaceTextureHost(mTextureView.mSurfaceCallback);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 8
Source File: TextureRenderView.java    From HeroVideo-master with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTecture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 9
Source File: TextureRenderView.java    From MVideo with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.textureCallBack.setOwnSurfaceTexture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
            textureHolder.setSurfaceTextureHost(mTextureView.textureCallBack);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 10
Source File: TextureRenderView.java    From TvPlayer with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTexture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
            textureHolder.setSurfaceTextureHost(mTextureView.mSurfaceCallback);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 11
Source File: TextureRenderView.java    From DMusic with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTexture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
            textureHolder.setSurfaceTextureHost(mTextureView.mSurfaceCallback);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 12
Source File: TextureRenderView.java    From MKVideoPlayer with MIT License 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTecture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 13
Source File: TextureRenderView.java    From ShareBox with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTexture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
            textureHolder.setSurfaceTextureHost(mTextureView.mSurfaceCallback);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 14
Source File: TextureRenderView.java    From HeroVideo-master with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTecture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 15
Source File: TextureRenderView.java    From TVRemoteIME with GNU General Public License v2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTexture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
            textureHolder.setSurfaceTextureHost(mTextureView.mSurfaceCallback);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 16
Source File: ParsingMediaManager.java    From ParsingPlayer with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void bindSurfaceHolder(IMediaPlayer mp, SurfaceTexture surfaceTexture) {
    if (mp == null) return;
    if (surfaceTexture == null) {
        mp.setDisplay(null);
        return;
    }
    mp.setSurface(new Surface(surfaceTexture));
}
 
Example 17
Source File: TextureRenderView.java    From talk-android with MIT License 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTexture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
            textureHolder.setSurfaceTextureHost(mTextureView.mSurfaceCallback);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
Example 18
Source File: TextureRenderView.java    From AndroidTvDemo with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp)
{
    if (mp == null)
        return;
    
    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) && (mp instanceof ISurfaceTextureHolder))
    {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder)mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTexture(false);
        
        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null)
        {
            mTextureView.setSurfaceTexture(surfaceTexture);
        }
        else
        {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
            textureHolder.setSurfaceTextureHost(mTextureView.mSurfaceCallback);
        }
    }
    else
    {
        mp.setSurface(openSurface());
    }
}