zoom_video_sdk_camera_control_request_handler.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { ZoomVideoSDKErrors } from './zoom_video_sdk_defines.js'
  2. export default (function () {
  3. var instance
  4. /**
  5. * Zoom Video SDK Camera Control Request Handler
  6. * @module zoom_video_sdk_camera_control_request_handler
  7. * @return {ZoomVideoSDKCameraControlRequestHandler}
  8. */
  9. function init(opts) {
  10. const clientOpts = {...opts}
  11. // Private methods and variables
  12. if (!clientOpts.addon) {
  13. return null
  14. }
  15. const _addon = clientOpts.addon.GetCameraControlRequestHandler()
  16. return {
  17. // Public methods and variables
  18. /**
  19. * Approve the remote camera control request.
  20. * @method approve
  21. * @return {Number} If the function succeed, the return value is ZoomVideoSDKErrors_Success.
  22. Otherwise failed. To get extended error information, {@link ZoomVideoSDKErrors} enum.
  23. */
  24. approve: function () {
  25. if (_addon) {
  26. return _addon.Approve()
  27. }
  28. return ZoomVideoSDKErrors.ZoomVideoSDKErrors_Internal_Error
  29. },
  30. /**
  31. * Decline the remote camera control request.
  32. * @method decline
  33. * @return {Number} If the function succeed, the return value is ZoomVideoSDKErrors_Success.
  34. Otherwise failed. To get extended error information, {@link ZoomVideoSDKErrors} enum.
  35. */
  36. decline: function () {
  37. if (_addon) {
  38. return _addon.Decline()
  39. }
  40. return ZoomVideoSDKErrors.ZoomVideoSDKErrors_Internal_Error
  41. }
  42. }
  43. };
  44. return {
  45. getInstance: function (opts) {
  46. if (!instance) {
  47. instance = init(opts)
  48. }
  49. return instance
  50. }
  51. }
  52. })()