Java Code Examples for android.view.TextureView#getSurfaceTexture()
The following examples show how to use
android.view.TextureView#getSurfaceTexture() .
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: SimpleExoPlayer.java From MediaSDK with Apache License 2.0 | 5 votes |
@Override public void setVideoTextureView(@Nullable TextureView textureView) { verifyApplicationThread(); removeSurfaceCallbacks(); if (textureView != null) { clearVideoDecoderOutputBufferRenderer(); } this.textureView = textureView; if (textureView == null) { setVideoSurfaceInternal(/* surface= */ null, /* ownsSurface= */ true); maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0); } else { if (textureView.getSurfaceTextureListener() != null) { Log.w(TAG, "Replacing existing SurfaceTextureListener."); } textureView.setSurfaceTextureListener(componentListener); SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture() : null; if (surfaceTexture == null) { setVideoSurfaceInternal(/* surface= */ null, /* ownsSurface= */ true); maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0); } else { setVideoSurfaceInternal(new Surface(surfaceTexture), /* ownsSurface= */ true); maybeNotifySurfaceSizeChanged(textureView.getWidth(), textureView.getHeight()); } } }
Example 2
Source File: SimpleExoPlayer.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public void setVideoTextureView(TextureView textureView) { if (this.textureView == textureView) { return; } removeSurfaceCallbacks(); this.textureView = textureView; needSetSurface = true; if (textureView == null) { setVideoSurfaceInternal(null, true); maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0); } else { if (textureView.getSurfaceTextureListener() != null) { Log.w(TAG, "Replacing existing SurfaceTextureListener."); } textureView.setSurfaceTextureListener(componentListener); SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture() : null; if (surfaceTexture == null) { setVideoSurfaceInternal(/* surface= */ null, /* ownsSurface= */ true); maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0); } else { setVideoSurfaceInternal(new Surface(surfaceTexture), /* ownsSurface= */ true); maybeNotifySurfaceSizeChanged(textureView.getWidth(), textureView.getHeight()); } } }
Example 3
Source File: SimpleExoPlayer.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public void setVideoTextureView(TextureView textureView) { if (this.textureView == textureView) { return; } removeSurfaceCallbacks(); this.textureView = textureView; needSetSurface = true; if (textureView == null) { setVideoSurfaceInternal(null, true); maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0); } else { if (textureView.getSurfaceTextureListener() != null) { Log.w(TAG, "Replacing existing SurfaceTextureListener."); } textureView.setSurfaceTextureListener(componentListener); SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture() : null; if (surfaceTexture == null) { setVideoSurfaceInternal(/* surface= */ null, /* ownsSurface= */ true); maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0); } else { setVideoSurfaceInternal(new Surface(surfaceTexture), /* ownsSurface= */ true); maybeNotifySurfaceSizeChanged(textureView.getWidth(), textureView.getHeight()); } } }
Example 4
Source File: SimpleExoPlayer.java From K-Sonic with MIT License | 5 votes |
/** * Sets the {@link TextureView} onto which video will be rendered. The player will track the * lifecycle of the surface automatically. * * @param textureView The texture view. */ public void setVideoTextureView(TextureView textureView) { removeSurfaceCallbacks(); this.textureView = textureView; if (textureView == null) { setVideoSurfaceInternal(null, true); } else { if (textureView.getSurfaceTextureListener() != null) { Log.w(TAG, "Replacing existing SurfaceTextureListener."); } SurfaceTexture surfaceTexture = textureView.getSurfaceTexture(); setVideoSurfaceInternal(surfaceTexture == null ? null : new Surface(surfaceTexture), true); textureView.setSurfaceTextureListener(componentListener); } }
Example 5
Source File: VideoViewImpl.java From openwebrtc-android-sdk with BSD 2-Clause "Simplified" License | 5 votes |
private TextureViewTagger(String tag, TextureView textureView) { mTag = tag; mTextureView = textureView; if (textureView.isAvailable()) { Surface surface = new Surface(textureView.getSurfaceTexture()); WindowRegistry.get().register(mTag, surface); } mTextureView.setSurfaceTextureListener(this); }
Example 6
Source File: SimpleExoPlayer.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void setVideoTextureView(TextureView textureView) { if (this.textureView == textureView) { return; } verifyApplicationThread(); removeSurfaceCallbacks(); this.textureView = textureView; needSetSurface = true; if (textureView == null) { setVideoSurfaceInternal(null, true); maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0); } else { if (textureView.getSurfaceTextureListener() != null) { Log.w(TAG, "Replacing existing SurfaceTextureListener."); } textureView.setSurfaceTextureListener(componentListener); SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture() : null; if (surfaceTexture == null) { setVideoSurfaceInternal(/* surface= */ null, /* ownsSurface= */ true); maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0); } else { setVideoSurfaceInternal(new Surface(surfaceTexture), /* ownsSurface= */ true); maybeNotifySurfaceSizeChanged(textureView.getWidth(), textureView.getHeight()); } } }
Example 7
Source File: SimpleExoPlayer.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public void setVideoTextureView(TextureView textureView) { if (this.textureView == textureView) { return; } verifyApplicationThread(); removeSurfaceCallbacks(); this.textureView = textureView; needSetSurface = true; if (textureView == null) { setVideoSurfaceInternal(null, true); maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0); } else { if (textureView.getSurfaceTextureListener() != null) { Log.w(TAG, "Replacing existing SurfaceTextureListener."); } textureView.setSurfaceTextureListener(componentListener); SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture() : null; if (surfaceTexture == null) { setVideoSurfaceInternal(/* surface= */ null, /* ownsSurface= */ true); maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0); } else { setVideoSurfaceInternal(new Surface(surfaceTexture), /* ownsSurface= */ true); maybeNotifySurfaceSizeChanged(textureView.getWidth(), textureView.getHeight()); } } }
Example 8
Source File: FragmentShowImage.java From iGap-Android with GNU Affero General Public License v3.0 | 4 votes |
private void setMediaPlayer(MediaPlayer mMediaPlayer, final TextureView mTextureView, final ImageView imgPlay, final TouchImageView touchImageView) { if (mTextureView == null) { return; } Surface surfaceTexture = new Surface(mTextureView.getSurfaceTexture()); if (surfaceTexture == null) { return; } try { if (mMediaPlayer != null) { mMediaPlayer.setSurface(surfaceTexture); mMediaPlayer.setLooping(false); mMediaPlayer.prepareAsync(); } } catch (IllegalStateException e) { e.getMessage(); } mMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { getRealSize(mp, mTextureView); imgPlay.setVisibility(View.GONE); mp.start(); MusicPlayer.pauseSound(); mTextureView.setVisibility(View.VISIBLE); touchImageView.animate().setDuration(700).alpha(0F).start(); G.handler.postDelayed(new Runnable() { @Override public void run() { touchImageView.setVisibility(View.GONE); touchImageView.clearAnimation(); } }, 700); videoController.setEnabled(true); videoController.show(); } }); }
Example 9
Source File: UVCDevice.java From DeviceConnect-Android with MIT License | 4 votes |
public void setPreviewDisplay(final TextureView display) { Surface surface = new Surface(display.getSurfaceTexture()); mCamera.setPreviewDisplay(surface); }