Java Code Examples for android.graphics.SurfaceTexture.OnFrameAvailableListener

The following are Jave code examples for showing how to use OnFrameAvailableListener of the android.graphics.SurfaceTexture class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: AppRTC-Android   File: SurfaceTextureHelper.java   Source Code and License Vote up 5 votes
@TargetApi(21)
private static void setOnFrameAvailableListener(SurfaceTexture surfaceTexture,
    SurfaceTexture.OnFrameAvailableListener listener, Handler handler) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    surfaceTexture.setOnFrameAvailableListener(listener, handler);
  } else {
    // The documentation states that the listener will be called on an arbitrary thread, but in
    // pratice, it is always the thread on which the SurfaceTexture was constructed. There are
    // assertions in place in case this ever changes. For API >= 21, we use the new API to
    // explicitly specify the handler.
    surfaceTexture.setOnFrameAvailableListener(listener);
  }
}