SellyCloudSDK_demo/SellyCloudSDK/sdk/SellyCloudSDK.framework/Headers/SellyRTCSessionDelegate.h

125 lines
3.8 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// SellyRTCSessionDelegate.h
// SellyCloudSDK
//
// Created by Caleb on 5/11/25.
//
#import <Foundation/Foundation.h>
#import "SellyRTCP2pStats.h"
#import "SellyRTCVideoFrame.h"
@class SellyRTCSession;
NS_ASSUME_NONNULL_BEGIN
//流的连接状态
typedef enum : NSUInteger {
SellyRTCConnectStateDisconnected, //断开连接
SellyRTCConnectStateConnecting, //连接中
SellyRTCConnectStateConnected, //连接成功
SellyRTCConnectStateReconnecting, //重连
} SellyRTCConnectState;
@protocol SellyRTCSessionDelegate <NSObject>
@optional
/**
通话报错无法恢复,需要结束流程
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session onError:(NSError *)error;
/** A remote user's video was enabled or disabled.
@param enabled Enabled or disabled:
* Yes: User has enabled the video function.
* No: User has disabled the video function.
@param userId Remote user ID.
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session videoEnabled:(BOOL)enabled userId:(nullable NSString *)userId;
/** A remote user's audio was enabled or disabled.
@param enabled Enabled or disabled:
* Yes: User has enabled the audio function.
* No: User has disabled the audio function.
@param userId Remote user ID.
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session audioEnabled:(BOOL)enabled userId:(nullable NSString *)userId;
/**
收到对方自定义消息
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session didReceiveMessage:(NSString *)message userId:(nullable NSString *)userId;
/**
@brief stream连接状态发生改变
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session connectionStateChanged:(SellyRTCConnectState)state userId:(nullable NSString *)userId;
/**
@brief 会话连接状态发生改变
会话重连期间内ice会持续重启直到超时
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session onRoomConnectionStateChanged:(SellyRoomConnectionState)state;
//视频前处理
- (CVPixelBufferRef)rtcSession:(SellyRTCSession * _Nonnull)session onCaptureVideoFrame:(CVPixelBufferRef)pixelBuffer;
/**
* Occurs each time the SDK receives a video frame sent by the remote user.
*
* After you successfully register the video frame observer, the SDK triggers this callback each time a
* video frame is received. In this callback, you can get the video data sent by the remote user. You
* can then post-process the data according to your scenarios.
*
@return Determines whether to ignore the current video frame if the pre-processing fails:
* - true: Do not ignore.
* - false: Ignore, in which case this method does not sent the current video frame to the SDK.
*/
- (BOOL)rtcSession:(SellyRTCSession *)session onRenderVideoFrame:(SellyRTCVideoFrame *)videoFrame userId:(NSString *)userId;
/**
统计功能
如果是单聊 userId = nil
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session onStats:(SellyRTCP2pStats *)stats userId:(nullable NSString *)userId;
/**
用户加入频道
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session onUserJoined:(nullable NSString *)userId;
/**
用户离开频道
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session onUserLeave:(nullable NSString *)userId;
/**
通话时长回调
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session onDuration:(NSInteger)duration;
/**
收到token将要过期消息
@param token The token that will expire in 60 seconds.
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session tokenWillExpire:(NSString *)token;
/**
收到token已过期消息
token过期后依然可以正常通话但是断网重连会失败
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session tokenExpired:(NSString *)token;
/**
屏幕分享状态发生变化
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session onScreenShareStatusChanged:(SellyScreenShareState)state;
@end
NS_ASSUME_NONNULL_END