Agora RTC Objective-C API Reference Refactor

Properties
AgoraMediaSource Class Reference

Inherits <NSObject>.

## Properties
NSString *_Nullable | url
NSString *_Nullable | uri
NSUInteger | startPos
BOOL | autoPlay
BOOL | enableCache
BOOL | enableMultiAudioTrack
BOOL | isAgoraSource
BOOL | isLiveSource
AgoraRtcMediaPlayerCustomSourceOnReadCallback _Nonnull | playerOnReadCallback

## Property Documentation

## ◆ url

- (NSString* _Nullable) url
| read write nonatomic copy

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

## ◆ uri

- (NSString* _Nullable) uri
| read write nonatomic copy

The URI of the media file.

## ◆ startPos

- (NSUInteger) startPos
| read write nonatomic assign

Set the starting position for playback, in seconds (ms)

## ◆ autoPlay

- (BOOL) autoPlay
| read write nonatomic assign

Determines whether to autoplay after opening a media resource.

- `YES`: (Default) Autoplay after opening a media resource.
- `NO`: Do not autoplay after opening a media resource.

## ◆ enableCache

- (BOOL) enableCache
| read write nonatomic assign

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.

- `YES`: Enable cache.
- `NO`: (Default) Disable cache.

## ◆ enableMultiAudioTrack

- (BOOL) enableMultiAudioTrack
| read write nonatomic assign

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.

- `YES`: Enable MultiAudioTrack;.
- `NO`: (Default) Disable MultiAudioTrack;.

## ◆ isAgoraSource

- (BOOL) isAgoraSource
| read write nonatomic assign

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

- `YES`: It is a stream through the Agora Broadcast Streaming Network.
- `NO`: (Default) It is not a stream through the Agora Broadcast Streaming Network.

## ◆ isLiveSource

- (BOOL) isLiveSource
| read write nonatomic assign

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

- `YES`: It is a live stream.
- `NO`: (Default) It is not is a live stream.

## ◆ playerOnReadCallback

- (AgoraRtcMediaPlayerCustomSourceOnReadCallback _Nonnull) playerOnReadCallback
| read write nonatomic copy

External custom data source callback

## ◆ playerOnSeekCallback

- (AgoraRtcMediaPlayerCustomSourceOnSeekCallback _Nonnull) playerOnSeekCallback
| read write nonatomic copy