Package tvi.webrtc
Class Camera1Capturer
- java.lang.Object
-
- tvi.webrtc.Camera1Capturer
-
- All Implemented Interfaces:
CameraVideoCapturer
,VideoCapturer
public class Camera1Capturer extends java.lang.Object
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface tvi.webrtc.CameraVideoCapturer
CameraVideoCapturer.CameraEventsHandler, CameraVideoCapturer.CameraStatistics, CameraVideoCapturer.CameraSwitchHandler, CameraVideoCapturer.MediaRecorderHandler
-
-
Constructor Summary
Constructors Constructor Description Camera1Capturer(java.lang.String cameraName, CameraVideoCapturer.CameraEventsHandler eventsHandler, boolean captureToTexture)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changeCaptureFormat(int width, int height, int framerate)
protected void
createCameraSession(CameraSession.CreateSessionCallback createSessionCallback, CameraSession.Events events, android.content.Context applicationContext, SurfaceTextureHelper surfaceTextureHelper, java.lang.String cameraName, int width, int height, int framerate)
void
dispose()
Perform any final cleanup here.protected java.lang.String
getCameraName()
CameraSession
getCameraSession()
Returns the current camera session.android.os.Handler
getHandler()
Returns the camera thread Handler.void
initialize(SurfaceTextureHelper surfaceTextureHelper, android.content.Context applicationContext, CapturerObserver capturerObserver)
This function is used to initialize the camera thread, the android application context, and the capture observer.boolean
isScreencast()
void
printStackTrace()
void
startCapture(int width, int height, int framerate)
Start capturing frames in a format that is as close as possible towidth x height
andframerate
.void
stopCapture()
Stop capturing.void
switchCamera(CameraVideoCapturer.CameraSwitchHandler switchEventsHandler)
Switch camera to the next valid camera id.void
switchCamera(CameraVideoCapturer.CameraSwitchHandler switchEventsHandler, java.lang.String cameraName)
Switch camera to the specified camera id.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface tvi.webrtc.CameraVideoCapturer
addMediaRecorderToCamera, removeMediaRecorderFromCamera
-
-
-
-
Constructor Detail
-
Camera1Capturer
public Camera1Capturer(java.lang.String cameraName, CameraVideoCapturer.CameraEventsHandler eventsHandler, boolean captureToTexture)
-
-
Method Detail
-
createCameraSession
protected void createCameraSession(CameraSession.CreateSessionCallback createSessionCallback, CameraSession.Events events, android.content.Context applicationContext, SurfaceTextureHelper surfaceTextureHelper, java.lang.String cameraName, int width, int height, int framerate)
-
initialize
public void initialize(SurfaceTextureHelper surfaceTextureHelper, android.content.Context applicationContext, CapturerObserver capturerObserver)
Description copied from interface:VideoCapturer
This function is used to initialize the camera thread, the android application context, and the capture observer. It will be called only once and before any startCapture() request. The camera thread is guaranteed to be valid until dispose() is called. If the VideoCapturer wants to deliver texture frames, it should do this by rendering on the SurfaceTexture insurfaceTextureHelper
, register itself as a listener, and forward the frames to CapturerObserver.onFrameCaptured(). The caller still has ownership ofsurfaceTextureHelper
and is responsible for making sure surfaceTextureHelper.dispose() is called. This also means that the caller can reuse the SurfaceTextureHelper to initialize a new VideoCapturer once the previous VideoCapturer has been disposed.- Specified by:
initialize
in interfaceVideoCapturer
-
startCapture
public void startCapture(int width, int height, int framerate)
Description copied from interface:VideoCapturer
Start capturing frames in a format that is as close as possible towidth x height
andframerate
.- Specified by:
startCapture
in interfaceVideoCapturer
-
stopCapture
public void stopCapture()
Description copied from interface:VideoCapturer
Stop capturing. This function should block until capture is actually stopped.- Specified by:
stopCapture
in interfaceVideoCapturer
-
changeCaptureFormat
public void changeCaptureFormat(int width, int height, int framerate)
- Specified by:
changeCaptureFormat
in interfaceVideoCapturer
-
dispose
public void dispose()
Description copied from interface:VideoCapturer
Perform any final cleanup here. No more capturing will be done after this call.- Specified by:
dispose
in interfaceVideoCapturer
-
switchCamera
public void switchCamera(CameraVideoCapturer.CameraSwitchHandler switchEventsHandler)
Description copied from interface:CameraVideoCapturer
Switch camera to the next valid camera id. This can only be called while the camera is running. This function can be called from any thread.- Specified by:
switchCamera
in interfaceCameraVideoCapturer
-
getCameraSession
@Nullable public CameraSession getCameraSession()
Returns the current camera session. This method will return null if the capturer is stopped.
-
getHandler
@Nullable public android.os.Handler getHandler()
Returns the camera thread Handler. This method will return null if the capturer has been disposed.
-
switchCamera
public void switchCamera(CameraVideoCapturer.CameraSwitchHandler switchEventsHandler, java.lang.String cameraName)
Description copied from interface:CameraVideoCapturer
Switch camera to the specified camera id. This can only be called while the camera is running. This function can be called from any thread.- Specified by:
switchCamera
in interfaceCameraVideoCapturer
-
isScreencast
public boolean isScreencast()
- Specified by:
isScreencast
in interfaceVideoCapturer
- Returns:
- true if-and-only-if this is a screen capturer.
-
printStackTrace
public void printStackTrace()
-
getCameraName
protected java.lang.String getCameraName()
-
-