Suggestions

close search

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal

subscriber.h File Reference

OpenTok Subscriber. More...

#include "config.h"
#include "stream.h"
#include "error.h"
#include "video_frame.h"

Data Structures

struct  otc_subscriber_audio_stats
struct  otc_subscriber_video_stats
struct  otc_subscriber_callbacks

Typedefs

typedef struct otc_subscriber otc_subscriber

Enumerations

enum  otc_video_reason { OTC_VIDEO_REASON_PUBLISH_VIDEO = 1, OTC_VIDEO_REASON_SUBSCRIBE_TO_VIDEO = 2, OTC_VIDEO_REASON_QUALITY = 3, OTC_VIDEO_REASON_CODEC_NOT_SUPPORTED = 4 }
enum  otc_subscriber_error_code {
  OTC_SUBSCRIBER_INTERNAL_ERROR = 2000, OTC_SUBSCRIBER_SESSION_DISCONNECTED = 1541, OTC_SUBSCRIBER_SERVER_CANNOT_FIND_STREAM = 1604, OTC_SUBSCRIBER_STREAM_LIMIT_EXCEEDED = 1605,
  OTC_SUBSCRIBER_TIMED_OUT = 1542, OTC_SUBSCRIBER_WEBRTC_ERROR = 1600
}

Functions

otc_subscriberotc_subscriber_new (const otc_stream *stream, const struct otc_subscriber_callbacks *callbacks)
otc_status otc_subscriber_delete (otc_subscriber *subscriber)
otc_streamotc_subscriber_get_stream (const otc_subscriber *subscriber)
otc_status otc_subscriber_set_subscribe_to_video (otc_subscriber *subscriber, otc_bool subscribe_to_video)
otc_status otc_subscriber_set_subscribe_to_audio (otc_subscriber *subscriber, otc_bool subscribe_to_audio)
otc_bool otc_subscriber_get_subscribe_to_video (const otc_subscriber *subscriber)
otc_bool otc_subscriber_get_subscribe_to_audio (const otc_subscriber *subscriber)
otc_sessionotc_subscriber_get_session (const otc_subscriber *subscriber)
otc_status otc_subscriber_set_preferred_resolution (otc_subscriber *subscriber, uint32_t preferred_width, uint32_t preferred_height)
otc_status otc_subscriber_get_preferred_resolution (const otc_subscriber *subscriber, uint32_t *preferred_width, uint32_t *preferred_height)
otc_status otc_subscriber_set_preferred_framerate (otc_subscriber *subscriber, float preferred_framerate)
otc_status otc_subscriber_get_preferred_framerate (const otc_subscriber *subscriber, float *preferred_framerate)
const char * otc_subscriber_get_subscriber_id (const otc_subscriber *subscriber)
void * otc_subscriber_get_user_data (const otc_subscriber *subscriber)

Detailed Description

OpenTok Subscriber.

This file includes the type definition for an OpenTok subscriber along with several function declarations.

Typedef Documentation

◆ otc_subscriber

OpenTok subscriber type definition.

A type representing the consumer of audio and video from a stream in the OpenTok session.

Enumeration Type Documentation

◆ otc_subscriber_error_code

Error code enumeration for OpenTok subscribers.

This enumeration represents several error codes associated with a subscriber.

Enumerator
OTC_SUBSCRIBER_INTERNAL_ERROR 

Internal error when subscribing.

OTC_SUBSCRIBER_SESSION_DISCONNECTED 

Attempting to subscribe to a stream in a session that you have disconnected from.

OTC_SUBSCRIBER_SERVER_CANNOT_FIND_STREAM 

The subscriber failed because the stream is missing. This can happen if the subscriber is created at the same time the stream is removed from the session.

OTC_SUBSCRIBER_STREAM_LIMIT_EXCEEDED 

The client tried to subscribe to a stream in a session that has exceeded the limit for simultaneous streams.

OTC_SUBSCRIBER_TIMED_OUT 

Timeout while attempting to subscribe.

OTC_SUBSCRIBER_WEBRTC_ERROR 

Subscriber WebRTC failure.

◆ otc_video_reason

Enum for reasons for a video to be started, stopped, resumed, etc.

Enumerator
OTC_VIDEO_REASON_PUBLISH_VIDEO 

The client publishing the stream stopped streaming video.

OTC_VIDEO_REASON_SUBSCRIBE_TO_VIDEO 

The local client stopped subscribing to video.

OTC_VIDEO_REASON_QUALITY 

The video event was caused by a change to the video stream quality.

OTC_VIDEO_REASON_CODEC_NOT_SUPPORTED 

The video event was caused when video in the subscriber stream was disabled because the stream uses a video codec that is not supported on the device.

Function Documentation

◆ otc_subscriber_delete()

otc_status otc_subscriber_delete ( otc_subscriber subscriber)

Releases a subscriber instance, including all hardware and UI resources bound to it.

Parameters
subscriberThe subcriber to be deleted.
Returns
Return value indicating either error or success.

◆ otc_subscriber_get_preferred_framerate()

otc_status otc_subscriber_get_preferred_framerate ( const otc_subscriber subscriber,
float *  preferred_framerate 
)

Returns the preferred frame rate for the subscriber's stream.

Parameters
subscriberThe subscriber instance.
preferred_framerateThe preferred framerate associated with the subscriber.
Returns
Return value indicating either error or success.
See also
otc_error_code

◆ otc_subscriber_get_preferred_resolution()

otc_status otc_subscriber_get_preferred_resolution ( const otc_subscriber subscriber,
uint32_t *  preferred_width,
uint32_t *  preferred_height 
)

Returns the preferred resolution for the subscriber's stream.

Parameters
subscriberThe subscriber instance.
preferred_widthThe preferred width of the subscriber.
preferred_heightThe preferred height of the subscriber.
Returns
Return value indicating either error or success.
See also
otc_error_code

◆ otc_subscriber_get_session()

otc_session* otc_subscriber_get_session ( const otc_subscriber subscriber)

Returns the otc_session associated this instance.

Parameters
subscriberThe subscriber instance.
Returns
The otc_session associated this instance. This can be null if there is an error.

◆ otc_subscriber_get_stream()

otc_stream* otc_subscriber_get_stream ( const otc_subscriber subscriber)

Returns the stream associated with the subscriber.

Parameters
subscriberThe subscriber instance to get the stream from.
Returns
The stream associated with the subscriber. This can be null if there is an error.

◆ otc_subscriber_get_subscribe_to_audio()

otc_bool otc_subscriber_get_subscribe_to_audio ( const otc_subscriber subscriber)

Returns whether the subscriber is subscribed to the stream's audio or not.

Parameters
subscriberThe subscriber instance.
Returns
Whether the subscriber is subscribed to the stream's audio or not.

◆ otc_subscriber_get_subscribe_to_video()

otc_bool otc_subscriber_get_subscribe_to_video ( const otc_subscriber subscriber)

Returns whether the subscriber is subscribed to the stream's video or not.

Parameters
subscriberThe subscriber instance.
Returns
Whether the subscriber is subscribed to the stream's video or not.

◆ otc_subscriber_get_subscriber_id()

const char* otc_subscriber_get_subscriber_id ( const otc_subscriber subscriber)

Gets a unique identifier for a given subscriber.

Parameters
subscriberThe subscriber instance.
Returns
A unique identifier for the subscriber. This can be null if there is an error.

◆ otc_subscriber_get_user_data()

void* otc_subscriber_get_user_data ( const otc_subscriber subscriber)

Gets user data for a given subscriber.

Parameters
subscriberThe subscriber instance.
Returns
A pointer to the user data in memory.

◆ otc_subscriber_new()

otc_subscriber* otc_subscriber_new ( const otc_stream stream,
const struct otc_subscriber_callbacks callbacks 
)

Creates a new Subscriber for a given Stream.

Parameters
streamThe Stream object corresponding to the stream you will subscribe to.
callbacksStruct with function pointers of the subscriber's callbacks.
Returns
The new Subscriber instance. This can be null if there is an error.

◆ otc_subscriber_set_preferred_framerate()

otc_status otc_subscriber_set_preferred_framerate ( otc_subscriber subscriber,
float  preferred_framerate 
)

Sets the preferred frame rate for the subscriber's stream.

Parameters
subscriberThe subscriber instance which will be affected.
preferred_framerateThe preferred framerate of the subscriber.
Returns
Return value indicating either error or success.
See also
otc_error_code

◆ otc_subscriber_set_preferred_resolution()

otc_status otc_subscriber_set_preferred_resolution ( otc_subscriber subscriber,
uint32_t  preferred_width,
uint32_t  preferred_height 
)

Sets the preferred resolution for the subscriber's stream.

Parameters
subscriberThe subscriber instance which will be affected.
preferred_widthThe preferred width of the subscriber.
preferred_heightThe preferred height of the subscriber.
Returns
Return value indicating either error or success.
See also
otc_error_code

◆ otc_subscriber_set_subscribe_to_audio()

otc_status otc_subscriber_set_subscribe_to_audio ( otc_subscriber subscriber,
otc_bool  subscribe_to_audio 
)

Subscribes to the stream's audio.

Parameters
subscriberThe subscriber instance which will be affected.
subscribe_to_audioWhether to subscribe to audio or not.
Returns
Return value indicating either error or success.

◆ otc_subscriber_set_subscribe_to_video()

otc_status otc_subscriber_set_subscribe_to_video ( otc_subscriber subscriber,
otc_bool  subscribe_to_video 
)

Subscribes to the stream's video.

Parameters
subscriberThe subscriber instance which will be affected.
subscribe_to_videoWhether to subscribe to video or not.
Returns
Return value indicating either error or success.