当前知识库站点已不再维护。请移步新版知识库:https://help.rongcloud.cn/

如何获取自己的网络状态、音量等数据。

直播场景下如何获取远端主播的音量; 会议场景下如何获取远端与会人员的音量;
发布时间: 2021-12-08 18:28

回答:

用户需要实现房间质量数据的代理回调方法,通过回调数据中的 trackId 后缀为 audio 的对应的数据中的 audioLevel字段来显示。

1、首先要设置代理:

[[RCRTCEngine sharedInstance] setStatusReportDelegate:self];

2、然后实现代理方法:

- (void)didReportStatusForm:(RCRTCStatusForm*)form;

 (参考文档:https://doc.rongcloud.cn/meeting/IOS/5.X/advance/analysis  )

     数据报表数据格式举例说明:

{ 
    cpuUsage = 36.90, 
    cpuUsageOfOS = 19.97, 
    totalRecvBitRate = 359.41, 
    totalSendBitRate = 436.45, 
    networkType = wlan,  rtt = 17,  
    ipAddress = 119.57.75.116:11875,  
    availableReceiveBandwidth = 131078,  
    availableSendBandwidth = 424540, 
    //发送方 
    sendStats = (    
                    "{  trackId = 123_RongCloudRTC_video, //视频
                        audioLevel = 0, 
                        streamId = 123_RongCloudRTC,
                        userId = 123, 
                        bitRate = 246.57, 
                        frameHeight = 1280, 
                        frameWidth = 720, 
                        mediaType = video, 
                        packetLoss = 0.00, 
                        rtt = 10, 
                        frameRate = 13, 
                        jitterReceived = 0, 
                        firsReceived = 0, 
                        codecName = H264, 
                        codecImpName = VideoToolbox, 
                        state = 1 
                     }",    
                     "{ 
                        trackId = 123_RongCloudRTC_audio,            //音频
                        audioLevel = 9, 
                        streamId = 123_RongCloudRTC, 
                        userId = 123, bitRate = 40.08, 
                        frameHeight = -1, 
                        frameWidth = -1,
                        mediaType = audio, 
                        packetLoss = 0.00, 
                        rtt = 11, 
                        frameRate = -1, 
                        jitterReceived = 4, 
                        firsReceived = 0, 
                        codecName = opus, 
                        codecImpName = (null), 
                        state = 1
                      }",    
                      "{ 
                        trackId = 123_RongCloudRTC_tiny_video, //小流视频
                        audioLevel = 0, 
                        streamId = 123_RongCloudRTC_tiny, 
                        userId = 123, 
                        bitRate = 146.46, 
                        frameHeight = 176, 
                        frameWidth = 144, 
                        mediaType = video, 
                        packetLoss = 0.00, 
                        rtt = 10, 
                        frameRate = 15, 
                        jitterReceived = 0, 
                        firsReceived = 0, 
                        codecName = H264, 
                        codecImpName = VideoToolbox, 
                        state = 1 
                      }"
                 ), 
    //接收方
    recvStats = (    
                      "{ 
                        trackId = 1423_RongCloudRTC_video,     //视频
                        audioLevel = 0, 
                        streamId = 1423_RongCloudRTC, 
                        userId = 1423, 
                        bitRate = 297.49, 
                        frameHeight = 1280, 
                        frameWidth = 720, 
                        mediaType = video, 
                        packetLoss = 0.00, 
                        rtt = 0, 
                        frameRate = 15, 
                        jitterReceived = 0, 
                        firsReceived = 0, 
                        codecName = H264, 
                        codecImpName = VideoToolbox, 
                        state = -1 
                       }",     
                      "{ 
                        trackId = 1423_RongCloudRTC_audio,     //音频
                        audioLevel = 3,                        //音量
                        streamId = 1423_RongCloudRTC, 
                        userId = 1423, 
                        bitRate = 38.66, 
                        frameHeight = -1, 
                        frameWidth = -1, 
                        mediaType = audio, 
                        packetLoss = 0.00, 
                        rtt = 0, 
                        frameRate = -1, 
                        jitterReceived = 4, 
                        firsReceived = 0, 
                        codecName = opus, 
                        codecImpName = (null), 
                        state = -1 
                       }"
                    ) 
}