ZMVideoSDKDelegate.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. //
  2. // ZMVideoSDKDelegate.h
  3. // ZMVideoSDK
  4. //
  5. #import <AppKit/AppKit.h>
  6. #import "ZMVideoSDKDef.h"
  7. @class ZMVideoSDKUserHelper;
  8. @class ZMVideoSDKVideoHelper;
  9. @class ZMVideoSDKAudioHelper;
  10. @class ZMVideoSDKShareHelper;
  11. @class ZMVideoSDKLiveStreamHelper;
  12. @class ZMVideoSDKChatHelper;
  13. @class ZMVideoSDKAudioRawData;
  14. @class ZMVideoSDKUser;
  15. @class ZMVideoSDKChatMessage;
  16. @class ZMVideoSDKPasswordHandler;
  17. @class ZMVideoSDKCameraControlRequestHandler;
  18. @class ZMVideoSDKRawDataPipe;
  19. @class ZMVideoSDKLiveTranscriptionLanguage;
  20. @class ZMVideoSDKSSLCertificateInfo;
  21. @class ZMVideoSDKProxySettingHandler;
  22. @class ZMVideoSDKRecordingConsentHandler;
  23. @class ZMVideoSDKLiveTranscriptionMessageInfo;
  24. @class ZMVideoSDKAnnotationHelper;
  25. @class ZMVideoSDKVideoCanvas;
  26. @class ZMVideoSDKSendFile;
  27. @class ZMVideoSDKReceiveFile;
  28. /**
  29. @brief A listener class that groups together the callbacks related to a session.
  30. */
  31. @protocol ZMVideoSDKDelegate <NSObject>
  32. @optional
  33. /**
  34. @brief Callback: Invoked when the current user joins the session.
  35. */
  36. - (void)onSessionJoin;
  37. /**
  38. @brief Callback: Invoked when the current user leaves the session.
  39. */
  40. - (void)onSessionLeave;
  41. /**
  42. @brief Callback: Invoked when errors occur.
  43. @param ErrorType Provides error code associated with the error. See {@link ZMVideoSDKErrors} for more information.
  44. @param details Detailed errorCode.
  45. */
  46. - (void)onError:(ZMVideoSDKErrors)ErrorType detail:(int)details;
  47. /**
  48. @brief Callback: Invoked when a user joins the session.
  49. @param userHelper User help utility.
  50. @param userArray List of users who have just joined the session.
  51. */
  52. - (void)onUserJoin:(ZMVideoSDKUserHelper*)userHelper userList:(NSArray<ZMVideoSDKUser *>*)userArray;
  53. /**
  54. @brief Triggered when other users leave session.
  55. @param userHelper The pointer of user helper object.
  56. @param userArray An array contains the users leaved.
  57. */
  58. - (void)onUserLeave:(ZMVideoSDKUserHelper*)userHelper userList:(NSArray<ZMVideoSDKUser *>*)userArray;
  59. /**
  60. @brief Callback: Invoked when a user makes changes to their video, such as starting or stopping their video.
  61. @param videoHelper The pointer of video helper object.
  62. @param userArray The array contain user objoct.
  63. */
  64. - (void)onUserVideoStatusChanged:(ZMVideoSDKVideoHelper*)videoHelper userList:(NSArray<ZMVideoSDKUser *>*)userArray;
  65. /**
  66. @brief Callback: Invoked when a user makes changes to their audio, such as muting or unmuting their audio.
  67. @param audioHelper The pointer of audio helper object.
  68. @param userArray The array contain user objoct.
  69. */
  70. - (void)onUserAudioStatusChanged:(ZMVideoSDKAudioHelper*)audioHelper userList:(NSArray<ZMVideoSDKUser *>*)userArray;
  71. /**
  72. @brief Callback: Invoked when a user makes changes to their sharing status, such as starting screen sharing, starting view sharing, or stopping sharing.
  73. @param shareHelper The pointer of share helper object.
  74. @param user The pointer of user helper object.
  75. @param status The current status of share.
  76. @param shareType The current type of share.
  77. */
  78. - (void)onUserShareStatusChanged:(ZMVideoSDKShareHelper*)shareHelper user:(ZMVideoSDKUser*)user status:(ZMVideoSDKShareStatus)status shareType:(ZMVideoSDKShareType)shareType;
  79. /**
  80. @brief Callback: Invoked when a user makes changes to their live stream status.
  81. @param liveStreamHelper The pointer of live stream helper object.
  82. @param status The current status of live stream.
  83. */
  84. - (void)onLiveStreamStatusChanged:(ZMVideoSDKLiveStreamHelper*)liveStreamHelper liveStreamStatus:(ZMVideoSDKLiveStreamStatus)status;
  85. /**
  86. @brief Callback: Invoked when receiving a chat message.
  87. @param chatHelper The pointer of chat helper object.
  88. @param chatMessage The pointer of chat message object.
  89. */
  90. - (void)onChatNewMessageNotify:(ZMVideoSDKChatHelper*)chatHelper chatMessage:(ZMVideoSDKChatMessage*)chatMessage;
  91. /**
  92. @brief Callback: Invoked when the session host changes.
  93. @param userHelper The pointer of user helper object.
  94. @param user The pointer of user object.
  95. */
  96. - (void)onUserHostChanged:(ZMVideoSDKUserHelper*)userHelper user:(ZMVideoSDKUser*)user;
  97. /**
  98. @brief Callback: Invoked when the active audio changes.
  99. @param audioHelper The pointer of audio helper object.
  100. @param userArray Active audio list.
  101. */
  102. - (void)onUserActiveAudioChanged:(ZMVideoSDKAudioHelper*)audioHelper userList:(NSArray<ZMVideoSDKUser *>*)userArray;
  103. /**
  104. @brief Callback: Invoked when the session requires a password to join.
  105. @param handle The pointer to password handler object.
  106. */
  107. - (void)onSessionNeedPassword:(ZMVideoSDKPasswordHandler*)handle;
  108. /**
  109. @brief Callback: Invoked when the provided session password is wrong or invalid.
  110. @param handle The pointer to password handler object.
  111. */
  112. - (void)onSessionPasswordWrong:(ZMVideoSDKPasswordHandler*)handle;
  113. /**
  114. @brief Callback: Invoked when mixed (all users) audio raw data received.
  115. @param data The pointer of audio raw data.
  116. */
  117. - (void)onMixedAudioRawDataReceived:(ZMVideoSDKAudioRawData*)data;
  118. /**
  119. @brief Callback: Invoked when individual user's audio raw data received.
  120. @param data Raw audio data. {@link ZMVideoSDKAudioRawData}.
  121. @param user The user object associated with the raw audio data.
  122. */
  123. - (void)onOneWayAudioRawDataReceived:(ZMVideoSDKAudioRawData*)data user:(ZMVideoSDKUser*)user;
  124. /**
  125. @brief Callback: Invoked when the manager of the session changes.
  126. @param user The pointer of user object.
  127. */
  128. - (void)onUserManagerChanged:(ZMVideoSDKUser*)user;
  129. /**
  130. @brief Callback: Invoked when a user changes their name.
  131. @param user The pointer of user object.
  132. */
  133. - (void)onUserNameChanged:(ZMVideoSDKUser*)user;
  134. /**
  135. @brief Callback: Invoked when receiving shared raw audio data.
  136. @param data Raw audio data. {@link ZMVideoSDKAudioRawData}.
  137. */
  138. - (void)onSharedAudioRawDataReceived:(ZMVideoSDKAudioRawData*)data;
  139. /**
  140. @brief Callback: Invoked when cloud recording status has paused, stopped, resumed, or otherwise changed.
  141. @param status Cloud recording status defined in {@link ZMRecordingStatus}.
  142. */
  143. - (void)onCloudRecordingStatus:(ZMRecordingStatus)status DEPRECATED_MSG_ATTRIBUTE("Use -onCloudRecordingStatus:recordAgreementHandler: instead");
  144. /**
  145. @brief Callback: Invoked when cloud recording status has paused, stopped, resumed, or otherwise changed.
  146. @param status Cloud recording status defined in {@link ZMRecordingStatus}.
  147. @param handler When the cloud recording starts, this object is used to let the user choose whether to accept or not.
  148. */
  149. - (void)onCloudRecordingStatus:(ZMRecordingStatus)status recordingConsentHandler:(ZMVideoSDKRecordingConsentHandler *)handler;
  150. /**
  151. @brief Invoked when a user consents to individual recording.
  152. @param user The pointer to the user object.
  153. */
  154. - (void)onUserRecordingConsent:(ZMVideoSDKUser *)user;
  155. /**
  156. @brief Once the command channel is active, this callback is triggered each time a message is received.
  157. @param commandContent Received command.
  158. @param user The user who sent the command.
  159. */
  160. - (void)onCommandReceived:(NSString*)commandContent senderUser:(ZMVideoSDKUser*)user;
  161. /**
  162. @brief Callback for when the current user is granted camera control access.
  163. @note Once the current user sends the camera control request, this callback will be triggered with the result of the request.
  164. @param user The pointer to the user who received the request.
  165. @param isApproved The result of the camera control request.
  166. */
  167. - (void)onCameraControlRequestResult:(ZMVideoSDKUser*)user approved:(BOOL)isApproved;
  168. /**
  169. @brief Callback interface for when the current user has received a camera control request.
  170. @note This will be triggered when another user requests control of the current users camera.
  171. @param user The pointer to the user who sent the request.
  172. @param requestType The request type.
  173. @param cameraControlRequestHandler The pointer to the helper instance of the camera controller. See {@link ZMVideoSDKCameraControlRequestHandler}.
  174. */
  175. - (void)onCameraControlRequestReceived:(ZMVideoSDKUser*)user cameraControlRequestType:(ZMVideoSDKCameraControlRequestType)requestType requestHandler:(ZMVideoSDKCameraControlRequestHandler*)cameraControlRequestHandler;
  176. /**
  177. @brief When the SDK attempts to establish a connection for the command channel when joining a session, this callback is triggered once the connection attempt for the command channel is completed.
  178. @param isSuccess YES: Success, command channel is ready to be used. NO: Failure, command channel was unable to connect.
  179. */
  180. - (void)onCommandChannelConnectResult:(BOOL)isSuccess;
  181. /**
  182. @brief Callback: Invoked when a host requests you to unmute yourself.
  183. */
  184. - (void)onHostAskUnmute;
  185. /**
  186. @brief Callback: Invoked when the invite by phone status changes to any other valid status such as Calling, Ringing, Success, or Failed.
  187. @param status Invite by phone status. See {@link ZMPhoneStatus}.
  188. @param reason Invite by phone failed reason. See {@link ZMPhoneFailedReason}.
  189. */
  190. - (void)onInviteByPhoneStatus:(ZMPhoneStatus)status reason:(ZMPhoneFailedReason)reason;
  191. /**
  192. @brief Callback: Invoked when someone in a given session enables or disables multi-camera. All participants in the session receive this callback.
  193. @param status The status of camera, refer to {@link ZMVideoSDKMultiCameraStreamStatus}.
  194. @param user The user who enabled multi-camera. See {@link ZMVideoSDKUser}.
  195. @param videoPipe The data pipe for the multi-camera. See {@link ZMVideoSDKMultiCameraStreamStatus}.
  196. */
  197. - (void)onMultiCameraStreamStatusChanged:(ZMVideoSDKMultiCameraStreamStatus)status user:(ZMVideoSDKUser *)user rawDataPipe:(ZMVideoSDKRawDataPipe *)videoPipe;
  198. /**
  199. @brief Notify the current mic or speaker volume when testing.
  200. @param micVolume Specify the volume of the mic.
  201. @param speakerVolume Specify the volume of the speaker.
  202. */
  203. - (void)onMicSpeakerVolumeChanged:(unsigned int)micVolume speakerVolume:(unsigned int)speakerVolume;
  204. /**
  205. @brief Notify that either mic device or speaker device status changed.
  206. @param type The audio device type.
  207. @param status The audio device status.
  208. */
  209. - (void)onAudioDeviceStatusChanged:(ZMVideoSDKAudioDeviceType)type status:(ZMVideoSDKAudioDeviceStatus)status;
  210. /**
  211. @brief Notify the mic status when testing.
  212. @param status The mic status.
  213. */
  214. - (void)onTestMicStatusChanged:(ZMVideoSDKMicTestStatus)status;
  215. /**
  216. @brief Notify the user that a mic/speaker device is selected when testing. Then the SDK will close the mic/speaker testing. The user shall restart the test manually if he still wants to test.
  217. */
  218. - (void)onSelectedAudioDeviceChanged;
  219. /**
  220. @brief Notify that the camera list has updated.
  221. */
  222. - (void)onCameraListChanged;
  223. /**
  224. @brief Callback: Invoked when live transcription status changes.
  225. @param status The live transcription status. See {@link ZMVideoSDKLiveTranscriptionStatus}.
  226. */
  227. - (void)onLiveTranscriptionStatus:(ZMVideoSDKLiveTranscriptionStatus)status;
  228. /**
  229. @brief Live transcription message received callback.
  230. @param message The live transcription message content.
  231. @param user The pointer to the user who speaks the message. For more details, refer to {@link ZMVideoSDKUser}.
  232. @param type The live transcription operation type. For more details, refer to {@link ZMVideoSDKLiveTranscriptionOperationType}.
  233. */
  234. - (void)onLiveTranscriptionMsgReceived:(NSString *)message user:(ZMVideoSDKUser *)user type:(ZMVideoSDKLiveTranscriptionOperationType)type DEPRECATED_MSG_ATTRIBUTE("Use -onLiveTranscriptionMsgInfoReceived: instead");
  235. /**
  236. @brief Callback: Invoked when a live transcription message is received.
  237. @param messageInfo The live transcription message, refer to {@link ZMVideoSDKLiveTranscriptionMessageInfo}.
  238. */
  239. - (void)onLiveTranscriptionMsgInfoReceived:(ZMVideoSDKLiveTranscriptionMessageInfo*)messageInfo;
  240. /**
  241. @brief Original language message received callback.
  242. @param messageInfo The spoken language message, see {@link ZMVideoSDKLiveTranscriptionMessageInfo}.
  243. */
  244. - (void)onOriginalLanguageMsgReceived:(ZMVideoSDKLiveTranscriptionMessageInfo*)messageInfo;
  245. /**
  246. @brief Callback: Invoked when a live translation error occurs.
  247. @param spokenLanguage The spoken message language.
  248. @param transcriptLanguage The message language you want to translate.
  249. */
  250. - (void)onLiveTranscriptionMsgError:(ZMVideoSDKLiveTranscriptionLanguage*)spokenLanguage transcriptLanguage:(ZMVideoSDKLiveTranscriptionLanguage*)transcriptLanguage;
  251. /**
  252. @brief Callback: Invoked when a user deletes a chat message.
  253. @param chatHelper The pointer to chat helper object.
  254. @param msgID The deleted message's ID.
  255. @param type Indicates by whom the message was deleted, which is defined in {@link ZMVideoSDKChatMessageDeleteType}.
  256. */
  257. - (void)onChatMsgDeleteNotification:(ZMVideoSDKChatHelper*)chatHelper messageID:(NSString *)msgID deleteBy:(ZMVideoSDKChatMessageDeleteType)type;
  258. /**
  259. @brief Callback event of the chat privilege of participant has changed.
  260. @param chatHelper The pointer to chat helper object.
  261. @param privilege The new chat privilege.
  262. */
  263. - (void)onChatPrivilegeChanged:(ZMVideoSDKChatHelper*)chatHelper chatPrivilegeType:(ZMVideoSDKChatPrivilegeType)privilege;
  264. /**
  265. @brief Notification callback of completing the proxy detection.
  266. */
  267. - (void)onProxyDetectComplete;
  268. /**
  269. @brief The callback will be triggered if the proxy requests to input the username and password. Use the handler to configure the related information. For more details, see {@link ZMVideoSDKProxySettingHandler}.
  270. @param handler The handler will be destroyed once the function calls end.
  271. */
  272. - (void)onProxySettingNotification:(ZMVideoSDKProxySettingHandler *)handler;
  273. /**
  274. @brief The callback will be triggered when the SSL is verified. Use the handler to check the related information. For more details, see {@link ZMVideoSDKSSLCertificateInfo}.
  275. @param handler The handler will be destroyed once the function calls end.
  276. */
  277. - (void)onSSLCertVerifiedFailNotification:(ZMVideoSDKSSLCertificateInfo *)info;
  278. /**
  279. @brief Callback event of the user's video network quality changes.
  280. @param status Video network quality. For more details, see {@link ZMVideoSDKNetworkStatus}.
  281. @param user The pointer to a user object. For more details, refer to {@link ZMVideoSDKUser}.
  282. */
  283. - (void)onUserVideoNetworkStatusChanged:(ZMVideoSDKNetworkStatus)status user:(ZMVideoSDKUser *)user;
  284. /**
  285. @brief Callback event of the call CRC device's status.
  286. @param status The call status. For more details, see {@link ZMVideoSDKCRCCallStatus}.
  287. */
  288. - (void)onCallCRCDeviceStatusChanged:(ZMVideoSDKCRCCallStatus)status;
  289. /**
  290. @brief Callback event for the vidoe canvas that failed to subscribe.
  291. @param failReason The fail reason. For more details, see {@link ZMVideoSDKSubscribeFailReason}.
  292. @param user The pointer to the user object whose view we would like to subscribe to. For more details, refer to {@link ZMVideoSDKUser}.
  293. @param view The view that failed to subscribe.
  294. */
  295. - (void)onVideoCanvasSubscribeFail:(ZMVideoSDKSubscribeFailReason)failReason user:(ZMVideoSDKUser*)user view:(NSView*)view;
  296. /**
  297. @brief Callback event for the share canvas that failed to subscribe.
  298. @param failReason The fail reason. For more details, see {@link ZMVideoSDKSubscribeFailReason}.
  299. @param user The pointer to the user object whose view we would like to subscribe to. For more details, refer to {@link ZMVideoSDKUser}.
  300. @param view The view that failed to subscribe.
  301. */
  302. - (void)onShareCanvasSubscribeFail:(ZMVideoSDKSubscribeFailReason)failReason user:(ZMVideoSDKUser*)user view:(NSView*)view;
  303. /**
  304. @brief Callback for the annotation helper clean up. SDK will release the ZoomVideoSDKAnnotationHelper object as well.
  305. @param helper The helper clean up object.
  306. */
  307. - (void)onAnnotationHelperCleanUp:(ZMVideoSDKAnnotationHelper*)helper;
  308. /**
  309. @brief Callback for the annotation privilege change.
  310. @param enable YES means the user is able to annotate, NO means the user is not able to annotate
  311. @param user The pointer to a user object who changed viewer's annotation privilege. For more details, refer to {@link ZMVideoSDKUser}.
  312. */
  313. - (void)onAnnotationPrivilegeChange:(BOOL)enable shareOwner:(ZMVideoSDKUser*)user;
  314. /**
  315. @brief Callback for the annotation helper activated. Notify that annotation windows have been created.
  316. @param view The view that annotating.
  317. */
  318. - (void)onAnnotationHelperActived:(NSView*)view;
  319. /**
  320. @brief Invoked when send file status make change.
  321. @param sendFile The pointer to send file object. For more details, refer to {@link ZMVideoSDKSendFile}.
  322. @param status The status of file transfer. For more details, refer to {@link ZMVideoSDKFileTransferStatus}.
  323. */
  324. - (void)onSendFile:(ZMVideoSDKSendFile *)sendFile status:(ZMVideoSDKFileTransferStatus)status;
  325. /**
  326. @brief Invoked when receive file status make change.
  327. @param receiveFile The pointer to receive file object. For more details, refer to {@link ZMVideoSDKReceiveFile}.
  328. @param status The status of file transfer. For more details, refer to {@link ZMVideoSDKFileTransferStatus}.
  329. */
  330. - (void)onReceiveFile:(ZMVideoSDKReceiveFile *)receiveFile status:(ZMVideoSDKFileTransferStatus)status;
  331. @end