- All Superinterfaces:
- All Known Implementing Classes:
public interface VideoCapturer extends VideoCapturerGeneric video capturing interface that extends
This interface provides an extension of the WebRTC video capturing interface. Implementations of this interface or
VideoCapturercan be used when creating local video tracks. As a result, callers can leverage capturers provided by the SDK, capturers provided by WebRTC, or custom capturers.
LocalVideoTrackAPI directly relates to the video capturer programming model. When a caller creates a local video track, the following methods are called in the order listed.
VideoCapturer.isScreencast()- The return value is used to create a
VideoCapturer.initialize(SurfaceTextureHelper, Context, CapturerObserver)- This method is called so the video capturer can setup to capture frames. The video capturer should retain a reference to the capturer observer and prepare to forward frames. If the video capturer wants to deliver texture frames, it should do this by rendering on the SurfaceTexture provided by
surfaceTextureHelper, register itself as a listener, and forward the frames to the capturer observer. This method will be called exactly once before
VideoCapturer.startCapture(int, int, int). The local video track retains ownership of the
VideoCapturer.startCapture(int, int, int)- The video capturer should start capturing in a format as close as possible to
width x heightat
framerate. The video capturer should capture and deliver frames to the capturer observer provided in initialize on a dedicated thread.
When a caller releases a local video track, the following methods are called in the order listed.
VideoCapturer.stopCapture()- The video capturer should stop capturing frames. The SDK expects this method to block until frames have stopped being captured.
VideoCapturer.dispose()- Perform final cleanup.
Each of these methods are called on the same thread that creates and releases a local video track which for most cases will be the main thread. As a result, video capturers should minimize the amount of work done in each callback and delegate operations on a dedicated thread. A recommended approach would be to create a capturing thread when
VideoCapturer.initialize(SurfaceTextureHelper, Context, CapturerObserver)is called and then begin capturing and delivering frames to the capturer observer on the capturing thread when
VideoCapturer.startCapture(int, int, int)is called.
Capturers should then stop capturing and join the capturer thread when
VideoCapturer.stopCapture()} is called.
- See Also:
All Methods Instance Methods Default Methods Modifier and Type Method Description
changeCaptureFormat(int width, int height, int framerate)
dispose()This method provides an optional step to perform a final cleanup.
Methods inherited from interface tvi.webrtc.VideoCapturer
initialize, isScreencast, startCapture, stopCapture
default VideoFormat getCaptureFormat()
default void changeCaptureFormat(int width, int height, int framerate)
- Specified by:
default void dispose()This method provides an optional step to perform a final cleanup.
- Specified by: