VideoProvider
abstract class VideoProvider
kotlin.Any | |
↳ | android.telecom.Connection.VideoProvider |
Provides a means of controlling the video session associated with a Connection
.
Implementations create a custom subclass of VideoProvider
and the ConnectionService
creates an instance sets it on the Connection
using Connection#setVideoProvider(VideoProvider)
. Any connection which supports video should set the VideoProvider
.
The VideoProvider
serves two primary purposes: it provides a means for Telecom and InCallService
implementations to issue requests related to the video session; it provides a means for the ConnectionService
to report events and information related to the video session to Telecom and the InCallService
implementations.
InCallService
implementations interact with the VideoProvider
via android.telecom.InCallService.VideoCall
.
Summary
Constants | |
---|---|
static Int |
A camera failure has occurred for the selected camera. |
static Int |
Session event raised by Telecom when |
static Int |
Issued after |
static Int |
Video is not being received (no protocol pause was issued). |
static Int |
Video reception has resumed after a |
static Int |
Video transmission has begun. |
static Int |
Video transmission has stopped. |
static Int |
Session modify request failed. |
static Int |
Session modify request ignored due to invalid parameters. |
static Int |
Session modify request rejected by remote user. |
static Int |
Session modify request was successful. |
static Int |
Session modify request timed out. |
Public constructors | |
---|---|
Public methods | |
---|---|
open Unit |
changeCameraCapabilities(cameraCapabilities: VideoProfile.CameraCapabilities!) Used to inform listening |
open Unit |
changePeerDimensions(width: Int, height: Int) Used to inform listening |
open Unit |
changeVideoQuality(videoQuality: Int) Used to inform listening |
open Unit |
handleCallSessionEvent(event: Int) Used to inform listening |
abstract Unit |
Issues a request to the |
abstract Unit |
Issues a request to the |
abstract Unit |
onSendSessionModifyRequest(fromProfile: VideoProfile!, toProfile: VideoProfile!) Issues a request to modify the properties of the current video session. |
abstract Unit |
onSendSessionModifyResponse(responseProfile: VideoProfile!) Provides a response to a request to change the current video session properties. |
abstract Unit |
onSetCamera(cameraId: String!) Sets the camera to be used for the outgoing video. |
abstract Unit |
onSetDeviceOrientation(rotation: Int) Sets the device orientation, in degrees. |
abstract Unit |
onSetDisplaySurface(surface: Surface!) Sets the surface to be used for displaying the video received from the remote device. |
abstract Unit |
onSetPauseImage(uri: Uri!) Provides the |
abstract Unit |
onSetPreviewSurface(surface: Surface!) Sets the surface to be used for displaying a preview of what the user's camera is currently capturing. |
abstract Unit |
Sets the camera zoom ratio. |
open Unit |
receiveSessionModifyRequest(videoProfile: VideoProfile!) Used to inform listening |
open Unit |
receiveSessionModifyResponse(status: Int, requestedProfile: VideoProfile!, responseProfile: VideoProfile!) Used to inform listening |
open Unit |
setCallDataUsage(dataUsage: Long) Used to inform listening |
Constants
SESSION_EVENT_CAMERA_FAILURE
static val SESSION_EVENT_CAMERA_FAILURE: Int
A camera failure has occurred for the selected camera. The VideoProvider
can use this as a cue to inform the user the camera is not available.
Value: 5
See Also
SESSION_EVENT_CAMERA_PERMISSION_ERROR
static val SESSION_EVENT_CAMERA_PERMISSION_ERROR: Int
Session event raised by Telecom when android.telecom.InCallService.VideoCall#setCamera(String)
is called and the caller does not have the necessary android.Manifest.permission#CAMERA
permission.
Value: 7
See Also
SESSION_EVENT_CAMERA_READY
static val SESSION_EVENT_CAMERA_READY: Int
Issued after SESSION_EVENT_CAMERA_FAILURE
when the camera is once again ready for operation. The VideoProvider
can use this as a cue to inform the user that the camera has become available again.
Value: 6
See Also
SESSION_EVENT_RX_PAUSE
static val SESSION_EVENT_RX_PAUSE: Int
Video is not being received (no protocol pause was issued).
Value: 1
See Also
SESSION_EVENT_RX_RESUME
static val SESSION_EVENT_RX_RESUME: Int
Video reception has resumed after a SESSION_EVENT_RX_PAUSE
.
Value: 2
See Also
SESSION_EVENT_TX_START
static val SESSION_EVENT_TX_START: Int
Video transmission has begun. This occurs after a negotiated start of video transmission when the underlying protocol has actually begun transmitting video to the remote party.
Value: 3
See Also
SESSION_EVENT_TX_STOP
static val SESSION_EVENT_TX_STOP: Int
Video transmission has stopped. This occurs after a negotiated stop of video transmission when the underlying protocol has actually stopped transmitting video to the remote party.
Value: 4
See Also
SESSION_MODIFY_REQUEST_FAIL
static val SESSION_MODIFY_REQUEST_FAIL: Int
Session modify request failed.
Value: 2
SESSION_MODIFY_REQUEST_INVALID
static val SESSION_MODIFY_REQUEST_INVALID: Int
Session modify request ignored due to invalid parameters.
Value: 3
SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE
static val SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE: Int
Session modify request rejected by remote user.
Value: 5
SESSION_MODIFY_REQUEST_SUCCESS
static val SESSION_MODIFY_REQUEST_SUCCESS: Int
Session modify request was successful.
Value: 1
SESSION_MODIFY_REQUEST_TIMED_OUT
static val SESSION_MODIFY_REQUEST_TIMED_OUT: Int
Session modify request timed out.
Value: 4
Public constructors
Public methods
changeCameraCapabilities
open fun changeCameraCapabilities(cameraCapabilities: VideoProfile.CameraCapabilities!): Unit
Used to inform listening InCallService
implementations when the capabilities of the current camera have changed.
The VideoProvider
should call this in response to VideoProvider#onRequestCameraCapabilities()
, or when the current camera is changed via VideoProvider#onSetCamera(String)
.
Received by the InCallService
via InCallService.VideoCall.Callback#onCameraCapabilitiesChanged(
.
Parameters | |
---|---|
cameraCapabilities |
VideoProfile.CameraCapabilities!: The new camera capabilities. |
changePeerDimensions
open fun changePeerDimensions(
width: Int,
height: Int
): Unit
Used to inform listening InCallService
implementations when the dimensions of the peer's video have changed.
This could occur if, for example, the peer rotates their device, changing the aspect ratio of the video, or if the user switches between the back and front cameras.
Received by the InCallService
via InCallService.VideoCall.Callback#onPeerDimensionsChanged(int, int)
.
Parameters | |
---|---|
width |
Int: The updated peer video width. |
height |
Int: The updated peer video height. |
changeVideoQuality
open fun changeVideoQuality(videoQuality: Int): Unit
Used to inform listening InCallService
implementations when the video quality of the call has changed.
Received by the InCallService
via InCallService.VideoCall.Callback#onVideoQualityChanged(int)
.
Parameters | |
---|---|
videoQuality |
Int: The updated video quality. Valid values: VideoProfile#QUALITY_HIGH , VideoProfile#QUALITY_MEDIUM , VideoProfile#QUALITY_LOW , VideoProfile#QUALITY_DEFAULT . |
handleCallSessionEvent
open fun handleCallSessionEvent(event: Int): Unit
Used to inform listening InCallService
implementations when the VideoProvider
reports a call session event.
Received by the InCallService
via InCallService.VideoCall.Callback#onCallSessionEvent(int)
.
onRequestCameraCapabilities
abstract fun onRequestCameraCapabilities(): Unit
Issues a request to the VideoProvider
to retrieve the camera capabilities.
The VideoProvider
should respond by communicating the capabilities of the chosen camera via VideoProvider#changeCameraCapabilities(VideoProfile.CameraCapabilities)
.
Sent from the InCallService
via InCallService.VideoCall#requestCameraCapabilities()
.
onRequestConnectionDataUsage
abstract fun onRequestConnectionDataUsage(): Unit
Issues a request to the VideoProvider
to retrieve the current data usage for the video component of the current Connection
.
The VideoProvider
should respond by communicating current data usage, in bytes, via VideoProvider#setCallDataUsage(long)
.
Sent from the InCallService
via InCallService.VideoCall#requestCallDataUsage()
.
onSendSessionModifyRequest
abstract fun onSendSessionModifyRequest(
fromProfile: VideoProfile!,
toProfile: VideoProfile!
): Unit
Issues a request to modify the properties of the current video session.
Example scenarios include: requesting an audio-only call to be upgraded to a bi-directional video call, turning on or off the user's camera, sending a pause signal when the InCallService
is no longer the foreground application.
If the VideoProvider
determines a request to be invalid, it should call receiveSessionModifyResponse(int,android.telecom.VideoProfile,android.telecom.VideoProfile)
to report the invalid request back to the InCallService
.
Where a request requires confirmation from the user of the peer device, the VideoProvider
must communicate the request to the peer device and handle the user's response. receiveSessionModifyResponse(int,android.telecom.VideoProfile,android.telecom.VideoProfile)
is used to inform the InCallService
of the result of the request.
Sent from the InCallService
via InCallService.VideoCall#sendSessionModifyRequest(VideoProfile)
.
Parameters | |
---|---|
fromProfile |
VideoProfile!: The video profile prior to the request. |
toProfile |
VideoProfile!: The video profile with the requested changes made. |
onSendSessionModifyResponse
abstract fun onSendSessionModifyResponse(responseProfile: VideoProfile!): Unit
Provides a response to a request to change the current video session properties.
For example, if the peer requests and upgrade from an audio-only call to a bi-directional video call, could decline the request and keep the call as audio-only. In such a scenario, the responseProfile
would have a video state of VideoProfile#STATE_AUDIO_ONLY
. If the user had decided to accept the request, the video state would be VideoProfile#STATE_BIDIRECTIONAL
.
Sent from the InCallService
via InCallService.VideoCall#sendSessionModifyResponse(VideoProfile)
in response to a InCallService.VideoCall.Callback#onSessionModifyRequestReceived(VideoProfile)
callback.
Parameters | |
---|---|
responseProfile |
VideoProfile!: The response video profile. |
onSetCamera
abstract fun onSetCamera(cameraId: String!): Unit
Sets the camera to be used for the outgoing video.
The VideoProvider
should respond by communicating the capabilities of the chosen camera via VideoProvider#changeCameraCapabilities(VideoProfile.CameraCapabilities)
.
Sent from the InCallService
via InCallService.VideoCall#setCamera(String)
.
Parameters | |
---|---|
cameraId |
String!: The id of the camera (use ids as reported by CameraManager#getCameraIdList() ). |
onSetDeviceOrientation
abstract fun onSetDeviceOrientation(rotation: Int): Unit
Sets the device orientation, in degrees. Assumes that a standard portrait orientation of the device is 0 degrees.
Sent from the InCallService
via InCallService.VideoCall#setDeviceOrientation(int)
.
Parameters | |
---|---|
rotation |
Int: The device orientation, in degrees. |
onSetDisplaySurface
abstract fun onSetDisplaySurface(surface: Surface!): Unit
Sets the surface to be used for displaying the video received from the remote device.
Sent from the InCallService
via InCallService.VideoCall#setDisplaySurface(Surface)
.
Parameters | |
---|---|
surface |
Surface!: The Surface . |
onSetPauseImage
abstract fun onSetPauseImage(uri: Uri!): Unit
Provides the VideoProvider
with the Uri
of an image to be displayed to the peer device when the video signal is paused.
Sent from the InCallService
via InCallService.VideoCall#setPauseImage(Uri)
.
Parameters | |
---|---|
uri |
Uri!: URI of image to display. |
onSetPreviewSurface
abstract fun onSetPreviewSurface(surface: Surface!): Unit
Sets the surface to be used for displaying a preview of what the user's camera is currently capturing. When video transmission is enabled, this is the video signal which is sent to the remote device.
Sent from the InCallService
via InCallService.VideoCall#setPreviewSurface(Surface)
.
Parameters | |
---|---|
surface |
Surface!: The Surface . |
onSetZoom
abstract fun onSetZoom(value: Float): Unit
Sets the camera zoom ratio.
Sent from the InCallService
via InCallService.VideoCall#setZoom(float)
.
Parameters | |
---|---|
value |
Float: The camera zoom ratio; for the current camera, should be a value in the range defined by android.hardware.camera2.CameraCharacteristics#CONTROL_ZOOM_RATIO_RANGE . |
receiveSessionModifyRequest
open fun receiveSessionModifyRequest(videoProfile: VideoProfile!): Unit
Used to inform listening InCallService
implementations when the VideoProvider
receives a session modification request.
Received by the InCallService
via InCallService.VideoCall.Callback#onSessionModifyRequestReceived(VideoProfile)
,
Parameters | |
---|---|
videoProfile |
VideoProfile!: The requested video profile. |
receiveSessionModifyResponse
open fun receiveSessionModifyResponse(
status: Int,
requestedProfile: VideoProfile!,
responseProfile: VideoProfile!
): Unit
Used to inform listening InCallService
implementations when the VideoProvider
receives a response to a session modification request.
Received by the InCallService
via InCallService.VideoCall.Callback#onSessionModifyResponseReceived(int,
.
Parameters | |
---|---|
status |
Int: Status of the session modify request. Valid values are VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS , VideoProvider#SESSION_MODIFY_REQUEST_FAIL , VideoProvider#SESSION_MODIFY_REQUEST_INVALID , VideoProvider#SESSION_MODIFY_REQUEST_TIMED_OUT , VideoProvider#SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE |
requestedProfile |
VideoProfile!: The original request which was sent to the peer device. |
responseProfile |
VideoProfile!: The actual profile changes agreed to by the peer device. |
setCallDataUsage
open fun setCallDataUsage(dataUsage: Long): Unit
Used to inform listening InCallService
implementations when the data usage of the video associated with the current Connection
has changed.
This could be in response to a preview request via onRequestConnectionDataUsage()
, or as a periodic update by the VideoProvider
. Where periodic updates of data usage are provided, they should be provided at most for every 1 MB of data transferred and no more than once every 10 sec.
Received by the InCallService
via InCallService.VideoCall.Callback#onCallDataUsageChanged(long)
.
Parameters | |
---|---|
dataUsage |
Long: The updated data usage (in bytes). Reported as the cumulative bytes used since the start of the call. |