Package com.sinch.android.rtc.video
Interface VideoController
-
public interface VideoController
Interface for controlling different video settings. AnVideoController
object is only valid while theSinchClient
is started. As soon as theSinchClient
is stopped, this object is invalidated and must not be used.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getCaptureDevicePosition()
android.view.View
getLocalView()
android.view.View
getRemoteView()
void
setCaptureDevicePosition(int facing)
Sets the camera to use for capturing videovoid
setLocalVideoFrameListener(LocalVideoFrameListener listener)
Sets a listener for the local video frames.void
setLocalVideoResizeBehaviour(VideoScalingType type)
Controls how the local view will resize to fit the view.void
setLocalVideoZOrder(boolean onTopOfRemoteView)
Sets whether local video (preview from camera) should be rendered on top of remove video view (default behaviour) or vice versa in case views are overlapping.void
setRemoteVideoFrameListener(RemoteVideoFrameListener listener)
Sets a listener for the remote video frames.void
setResizeBehaviour(VideoScalingType type)
Controls how the remote view will resize to fit the view.void
setTorchMode(boolean enabled)
Enables/disables flash torch mode during current video session.void
toggleCaptureDevicePosition()
Toggles the capture device position.
-
-
-
Method Detail
-
getLocalView
android.view.View getLocalView()
- Returns:
- A View containing the local users camera preview
-
getRemoteView
android.view.View getRemoteView()
- Returns:
- A View containing the remote users camera feed
-
setResizeBehaviour
void setResizeBehaviour(VideoScalingType type)
Controls how the remote view will resize to fit the view. The default behaviour isVideoScalingType.ASPECT_FIT
.- Parameters:
type
- The scaling type- Throws:
java.lang.IllegalArgumentException
- if type is invalid.- See Also:
VideoScalingType for possible values.
-
setLocalVideoResizeBehaviour
void setLocalVideoResizeBehaviour(VideoScalingType type)
Controls how the local view will resize to fit the view. The default behaviour isVideoScalingType.ASPECT_FIT
.- Parameters:
type
- The scaling type- Throws:
java.lang.IllegalArgumentException
- if type is invalid.- See Also:
VideoScalingType for possible values.
-
getCaptureDevicePosition
int getCaptureDevicePosition()
- Returns:
- The current device facing position, one of Camera.CameraInfo.CAMERA_FACING_FRONT or Camera.CameraInfo.CAMERA_FACING_BACK
-
setCaptureDevicePosition
void setCaptureDevicePosition(int facing)
Sets the camera to use for capturing video- Parameters:
facing
- one of Camera.CameraInfo.CAMERA_FACING_FRONT or Camera.CameraInfo.CAMERA_FACING_BACK- Throws:
java.lang.IllegalArgumentException
- if facing is invalid.- See Also:
- android.hardware.Camera.CameraInfo
-
toggleCaptureDevicePosition
void toggleCaptureDevicePosition()
Toggles the capture device position. If current facing position is Camera.CameraInfo.CAMERA_FACING_FRONT, sets it to Camera.CameraInfo.CAMERA_FACING_BACK. If current facing position is Camera.CameraInfo.CAMERA_FACING_BACK, sets it to Camera.CameraInfo.CAMERA_FACING_FRONT.
-
setRemoteVideoFrameListener
void setRemoteVideoFrameListener(RemoteVideoFrameListener listener)
Sets a listener for the remote video frames. Blocks rendering. In-place modification of provided I420 frame would affect rendering. If heavy operation is required, which does not affect rendering, e.g. saving screen-shot in JPEG - spawn a work thread and work with a copy of the frame. SeeVideoUtils
for I420 into NV21 conversion.See
IMPORTANT: set to null when listener is no longer needed - it will increase performance by eliminating otherwise necessary conversion from captured texture-based frame into memory buffer-backed I420 frame.RemoteVideoFrameListener
for more information.- Parameters:
listener
- will be called on each frame from the remote video stream.
-
setLocalVideoFrameListener
void setLocalVideoFrameListener(LocalVideoFrameListener listener)
Sets a listener for the local video frames. If @param listener is set, frames are not sent to remote side directly. Instead,LocalVideoFrameListener
is called, and processed frame should be returned viaProcessedVideoFrameListener
interface.- Parameters:
listener
- will be called on each frame captured from camera. SeeLocalVideoFrameListener
andProcessedVideoFrameListener
for more information.
-
setLocalVideoZOrder
void setLocalVideoZOrder(boolean onTopOfRemoteView)
Sets whether local video (preview from camera) should be rendered on top of remove video view (default behaviour) or vice versa in case views are overlapping.- Parameters:
onTopOfRemoteView
- if set to false will make remove video rendered on top of preview.
-
setTorchMode
void setTorchMode(boolean enabled)
Enables/disables flash torch mode during current video session. Might be ignored if not available.- Parameters:
enabled
- sets flash torch mode ON if true.
-
-