ZegoMediaPlayerFileReaderDelegate Protocol Reference

Conforms to NSObject
Declared in zego-api-mediaplayer-oc.h

– open:playerIndex: required method

打开文件

- (int)open:(NSString *)path playerIndex:(ZegoMediaPlayerIndex)playerIndex

Parameters

path

文件路径, 该路径为传入时的路径

playerIndex

播放器序号

Return Value

成功返回0,失败返回-1

Declared In

zego-api-mediaplayer-oc.h

– close: required method

关闭文件

- (void)close:(ZegoMediaPlayerIndex)playerIndex

Parameters

playerIndex

播放器序号

Declared In

zego-api-mediaplayer-oc.h

– read:size:playerIndex: required method

读取文件 返回文件内容

- (int)read:(unsigned char *)buf size:(int)size playerIndex:(ZegoMediaPlayerIndex)playerIndex

Parameters

buf

读取的文件内容写入的buf地址,预期需写入size 大小。

size

为预期写入buf的文件大小

playerIndex

播放器序号

Return Value

非0 为 实际 写入buf 的文件大小,返回0表示EOF, 失败返回-1

Declared In

zego-api-mediaplayer-oc.h

– seek:seekMode:playerIndex: required method

定位文件位置(可参照fseek)实现

- (long long)seek:(long long)pos seekMode:(int)seekMode playerIndex:(ZegoMediaPlayerIndex)playerIndex

Parameters

pos

文件位置

seekMode

需要实现 seekMode = 0 时表示文件开头,seekMode = 1 时表示当前位置. 可参照fseek 函数实现

playerIndex

播放器序号

Return Value

返回seek后的位置距离文件起始点的offset大小,失败返回-1

Declared In

zego-api-mediaplayer-oc.h

– getSize: required method

获取文件大小

- (long long)getSize:(ZegoMediaPlayerIndex)playerIndex

Parameters

playerIndex

播放器序号

Return Value

返回文件大小

Declared In

zego-api-mediaplayer-oc.h