meet::MediaApiClientInterface

This is an abstract class.

#include <media_api_client_interface.h>

Interface for the Meet Media API client.

Summary

This client implementation is meant to be used for one connection lifetime and then thrown away; if integrators need a new connection, they should create a new instance of MediaApiClientInterface.

Constructors and Destructors

~MediaApiClientInterface()

Public functions

ConnectActiveConference(absl::string_view join_endpoint, absl::string_view conference_id, absl::string_view access_token)=0
virtual absl::Status
Attempts to connect with Meet servers.
LeaveConference(int64_t request_id)=0
virtual absl::Status
Convenience method for sending a SessionControlChannelFromClient request with a LeaveRequest to Meet servers.
SendRequest(const ResourceRequest & request)=0
virtual absl::Status
Sends a resource request to Meet servers.

Public static functions

Create(const MediaApiClientConfiguration & api_config, rtc::scoped_refptr< MediaApiClientObserverInterface > api_session_observer)
absl::StatusOr< std::unique_ptr< MediaApiClientInterface > >
Creates a new instance of MediaApiClientInterface.

Public functions

ConnectActiveConference

virtual absl::Status ConnectActiveConference(
  absl::string_view join_endpoint,
  absl::string_view conference_id,
  absl::string_view access_token
)=0

Attempts to connect with Meet servers.

This process involves communicating the intent to join an active Meet conference. It establishes the signaled SRTP and SCTP connections with the backend.

Once fully joined, if audio was enabled, the client will begin receiving any available streams immediately. If video was enabled, the client will not receive any video streams until a meet::SetVideoAssignmentRequest is successfully sent to Meet servers and applied.

Details
Parameters
join_endpoint
Must be a valid URL, including the protocol and host. There aren't very robust checks performed on the provided URL. It is expected that the URL is well-formed.

LeaveConference

virtual absl::Status LeaveConference(
  int64_t request_id
)=0

Convenience method for sending a SessionControlChannelFromClient request with a LeaveRequest to Meet servers.

This tells the server that the client should be disconnected from the conference. The request will use the provided request ID. See MediaApiClientInterface::SendRequest for more information.

If successful, the client will receive a SessionControlChannelToClient resource update with the same request ID, a session status of meet::SessionStatus::ConferenceConnectionState::kDisconnected, and a meet::LeaveResponse.

If this is called before the client is fully joined, the client will immediately transition to the disconnected state, as the Meet servers will not necessarily respond to the request until the client is fully joined.

SendRequest

virtual absl::Status SendRequest(
  const ResourceRequest & request
)=0

Sends a resource request to Meet servers.

Details
Parameters
request
This request must have a non-zero, unique request_id. For example, a SessionControlRequest's request ID must be non-zero and unique to other requests' IDs. The request ID can be used to associate the request to the response or error in the MediaApiClientObserverInterface.

~MediaApiClientInterface

virtual  ~MediaApiClientInterface()=default

Public static functions

Create

absl::StatusOr< std::unique_ptr< MediaApiClientInterface > > Create(
  const MediaApiClientConfiguration & api_config,
  rtc::scoped_refptr< MediaApiClientObserverInterface > api_session_observer
)

Creates a new instance of MediaApiClientInterface.

It is configured with the required codecs to support streaming media from Meet conferences. Required SCTP data channels will be opened and the proper number of SRTP streams will be signaled with Meet servers.

Details
Parameters
api_session_observer
This observer will be retained by the client until the client is destroyed.