Skip to content

Commit

Permalink
feat(iOS): add getOption interface
Browse files Browse the repository at this point in the history
(cherry picked from commit 86a3474)
(cherry picked from commit 6b7d7c45fd97d8377fd1a57be96733ae5752f194)
  • Loading branch information
skufly authored and pingkai committed Mar 20, 2020
1 parent bb41c9a commit f42a468
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
10 changes: 10 additions & 0 deletions platform/Apple/source/CicadaDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ typedef enum CicadaPropertyKey: NSUInteger {
CICADA_KEY_CONNECT_INFO = 1,
} CicadaPropertyKey;

typedef enum CicadaOption: NSUInteger {
/**
* @brief 渲染的fps。类型为Float
*/
/****
* @brief render fps. Return value type is Float
*/
CICADA_OPTION_RENDER_FPS = 0,
} CicadaOption;

/**
@brief CicadaErrorModel为播放错误信息描述
*/
Expand Down
14 changes: 14 additions & 0 deletions platform/Apple/source/CicadaPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,20 @@ OBJC_EXPORT
*/
-(void) setDefaultBandWidth:(int)bandWidth;

/**
* @brief 获取播放器的参数
*
* @param key 参数值
* @return 相关信息
*/
/****
* @brief Get player information
*
* @param key The key
* @return The information
*/
-(NSString *) getOption:(CicadaOption)key;

/**
@brief 获取SDK版本号信息
*/
Expand Down
19 changes: 19 additions & 0 deletions platform/Apple/source/CicadaPlayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,25 @@ -(void) setDefaultBandWidth:(int)bandWidth
}
}

-(NSString *) getOption:(CicadaOption)key
{
if (nullptr == self.player) {
return @"";
}

char value[256] = {0};

switch (key) {
case CICADA_OPTION_RENDER_FPS:
self.player->GetOption("renderFps", value);
break;
default:
break;
}

return [NSString stringWithUTF8String:value];
}

+ (NSString *) getSDKVersion
{
string version = MediaPlayer::GetSdkVersion();
Expand Down

0 comments on commit f42a468

Please sign in to comment.