TUICallObserver.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. //
  2. // TUICallObserver.h
  3. // TUICalling
  4. //
  5. // Created by noah on 2022/7/8.
  6. // Copyright © 2022 Tencent. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <TUICallEngine/TUICallDefine.h>
  10. @class TUIRoomId, TUINetworkQualityInfo;
  11. NS_ASSUME_NONNULL_BEGIN
  12. @protocol TUICallObserver <NSObject>
  13. @optional
  14. /**
  15. * An error occurred inside the SDK.
  16. *
  17. * @param code Error code
  18. * @param message Error message
  19. */
  20. - (void)onError:(int)code message:(NSString * _Nullable)message
  21. NS_SWIFT_NAME(onError(code:message:));
  22. /**
  23. * Callback for receiving a call request (received only by the callee)
  24. *
  25. * @param callerId Caller
  26. * @param calleeIdList List of callee
  27. * @param groupId GroupID
  28. * @param callMediaType Call type,eg: audio、video
  29. * @param userData The extended field added by the user, corresponding to the TUICallDefine.CallParams.userData field set when the caller sends an invitation.
  30. */
  31. - (void)onCallReceived:(NSString *)callerId
  32. calleeIdList:(NSArray<NSString *> *)calleeIdList
  33. groupId:(NSString * _Nullable)groupId
  34. callMediaType:(TUICallMediaType)callMediaType
  35. userData:(NSString * _Nullable)userData
  36. NS_SWIFT_NAME(onCallReceived(callerId:calleeIdList:groupId:callMediaType:userData:));
  37. /**
  38. * Callback for receiving a call request (received only by the callee)
  39. *
  40. * @param callerId Caller
  41. * @param calleeIdList List of callee
  42. * @param groupId GroupID
  43. * @param callMediaType Call type,eg: audio、video
  44. */
  45. - (void)onCallReceived:(NSString *)callerId
  46. calleeIdList:(NSArray<NSString *> *)calleeIdList
  47. groupId:(NSString * _Nullable)groupId
  48. callMediaType:(TUICallMediaType)callMediaType
  49. NS_SWIFT_NAME(onCallReceived(callerId:calleeIdList:groupId:callMediaType:))
  50. __attribute__((deprecated("use onCallReceived:calleeIdList:groupId:callMediaType:userData:")));
  51. /**
  52. * A user who cancel the call
  53. *
  54. * @param callerId User who cancel the call request
  55. */
  56. - (void)onCallCancelled:(NSString *)callerId
  57. NS_SWIFT_NAME(onCallCancelled(callerId:));
  58. /**
  59. * Call start(received by both caller and callee)
  60. *
  61. * @param roomId Current call room ID
  62. * @param callMediaType Call type,eg: audio、video
  63. * @param callRole Call role
  64. */
  65. - (void)onCallBegin:(TUIRoomId *)roomId callMediaType:(TUICallMediaType)callMediaType callRole:(TUICallRole)callRole
  66. NS_SWIFT_NAME(onCallBegin(roomId:callMediaType:callRole:));
  67. /**
  68. * Call end(received by both caller and callee)
  69. *
  70. * @param roomId Current call room ID
  71. * @param callMediaType Call type,eg: audio、video
  72. * @param callRole Call role
  73. * @param totalTime Total time of the call
  74. */
  75. - (void)onCallEnd:(TUIRoomId *)roomId callMediaType:(TUICallMediaType)callMediaType callRole:(TUICallRole)callRole totalTime:(float)totalTime
  76. NS_SWIFT_NAME(onCallEnd(roomId:callMediaType:callRole:totalTime:));
  77. /**
  78. * Call type change
  79. *
  80. * @param oldCallMediaType Old call type
  81. * @param newCallMediaType New call type
  82. */
  83. - (void)onCallMediaTypeChanged:(TUICallMediaType)oldCallMediaType newCallMediaType:(TUICallMediaType)newCallMediaType
  84. NS_SWIFT_NAME(onCallMediaTypeChanged(oldCallMediaType:newCallMediaType:));
  85. /**
  86. * A user who reject the call
  87. *
  88. * @param userId User who reject the call
  89. */
  90. - (void)onUserReject:(NSString *)userId
  91. NS_SWIFT_NAME(onUserReject(userId:));
  92. /**
  93. * A user who did not answer the call
  94. *
  95. * @param userId User who did not answer the call
  96. */
  97. - (void)onUserNoResponse:(NSString *)userId
  98. NS_SWIFT_NAME(onUserNoResponse(userId:));
  99. /**
  100. * A user who is busy
  101. *
  102. * @param userId User who is busy
  103. */
  104. - (void)onUserLineBusy:(NSString *)userId
  105. NS_SWIFT_NAME(onUserLineBusy(userId:));
  106. /**
  107. * A user who join the call
  108. *
  109. * @param userId User who join the call
  110. */
  111. - (void)onUserJoin:(NSString *)userId
  112. NS_SWIFT_NAME(onUserJoin(userId:));
  113. /**
  114. * A user who leave the call
  115. *
  116. * @param userId User who leave the call
  117. */
  118. - (void)onUserLeave:(NSString *)userId
  119. NS_SWIFT_NAME(onUserLeave(userId:));
  120. /**
  121. * A remote user published/unpublished primary stream video
  122. *
  123. * @param userId User ID of the remote user
  124. * @param isVideoAvailable Whether the user published (or unpublished) primary stream video
  125. */
  126. - (void)onUserVideoAvailable:(NSString *)userId isVideoAvailable:(BOOL)isVideoAvailable
  127. NS_SWIFT_NAME(onUserVideoAvailable(userId:isVideoAvailable:));
  128. /**
  129. * A remote user published/unpublished audio
  130. *
  131. * @param userId User ID of the remote user
  132. * @param isAudioAvailable Whether the user published (or unpublished) audio.
  133. */
  134. - (void)onUserAudioAvailable:(NSString *)userId isAudioAvailable:(BOOL)isAudioAvailable
  135. NS_SWIFT_NAME(onUserAudioAvailable(userId:isAudioAvailable:));
  136. /**
  137. * All user volume change
  138. *
  139. * @param volumeMap The total volume of all users. Value range: 0 - 100
  140. */
  141. - (void)onUserVoiceVolumeChanged:(NSDictionary<NSString *, NSNumber *> *)volumeMap
  142. NS_SWIFT_NAME(onUserVoiceVolumeChanged(volumeMap:));
  143. /**
  144. * Real-time network quality statistics
  145. *
  146. * @param networkQualityList All users Real-time network quality statistics
  147. */
  148. - (void)onUserNetworkQualityChanged:(NSArray<TUINetworkQualityInfo *> *)networkQualityList
  149. NS_SWIFT_NAME(onUserNetworkQualityChanged(networkQualityList:));
  150. /**
  151. * The callback of the current user being kicked off, the user can be prompted on the UI at this time, and call init() function of TUICallEngine to log in again.
  152. */
  153. - (void)onKickedOffline
  154. NS_SWIFT_NAME(onKickedOffline());
  155. /**
  156. * The callback of the login credentials expired when online, you need to generate a new userSig and call init() function of TUICallEngine to log in again.
  157. */
  158. - (void)onUserSigExpired
  159. NS_SWIFT_NAME(onUserSigExpired());
  160. @end
  161. NS_ASSUME_NONNULL_END