Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
agora::media::base::MediaSource Struct Reference

`#include <AgoraMediaPlayerTypes.h>`

## Public Member Functions
| MediaSource ()

## Public Attributes
const char * | url
const char * | uri
int64_t | startPos
bool | autoPlay
bool | enableCache
bool | enableMultiAudioTrack
Optional< bool > | isAgoraSource
Optional< bool > | isLiveSource
IMediaPlayerCustomDataProvider * | provider

## Constructor & Destructor Documentation

## ◆ MediaSource()

agora::media::base::MediaSource::MediaSource | ( |  | ) |
| inline

## Member Data Documentation

## ◆ url

const char* agora::media::base::MediaSource::url

The URL of the media file that you want to play.

## ◆ uri

const char* agora::media::base::MediaSource::uri

The URI of the media file

When caching is enabled, if the url cannot distinguish the cache file name, the uri must be able to ensure that the cache file name corresponding to the url is unique.

## ◆ startPos

int64_t agora::media::base::MediaSource::startPos

Set the starting position for playback, in ms.

## ◆ autoPlay

bool agora::media::base::MediaSource::autoPlay

Determines whether to autoplay after opening a media resource.

- true: (Default) Autoplay after opening a media resource.
- false: Do not autoplay after opening a media resource.

## ◆ enableCache

bool agora::media::base::MediaSource::enableCache

Determines whether to enable cache streaming to local files. If enable cached, the media player will use the url or uri as the cache index.

Note
  The local cache function only supports on-demand video/audio streams and does not support live streams. Caching video and audio files based on the HLS protocol (m3u8) to your local device is not supported.

- true: Enable cache.
- false: (Default) Disable cache.

## ◆ enableMultiAudioTrack

bool agora::media::base::MediaSource::enableMultiAudioTrack

Determines whether to enable multi-track audio stream decoding. Then you can select multi audio track of the media file for playback or publish to channel

Note
  If you use the selectMultiAudioTrack API, you must set enableMultiAudioTrack to true.

- true: Enable MultiAudioTrack;.
- false: (Default) Disable MultiAudioTrack;.

## ◆ isAgoraSource

Optional<bool> agora::media::base::MediaSource::isAgoraSource

Determines whether the opened media resource is a stream through the Agora Broadcast Streaming Network(CDN).

- true: It is a stream through the Agora Broadcast Streaming Network.
- false: (Default) It is not a stream through the Agora Broadcast Streaming Network.

## ◆ isLiveSource

Optional<bool> agora::media::base::MediaSource::isLiveSource

Determines whether the opened media resource is a live stream. If is a live stream, it can speed up the opening of media resources.

- true: It is a live stream.
- false: (Default) It is not is a live stream.

## ◆ provider

IMediaPlayerCustomDataProvider* agora::media::base::MediaSource::provider

External custom data source object