@zoom/videosdk-ui-toolkit 2.3.5-1 → 2.3.15-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -675,11 +675,256 @@ export type CustomizationOptions = {
675
675
  debug?: boolean;
676
676
  };
677
677
 
678
+ /**
679
+ * PTZ (Pan-Tilt-Zoom) camera control interface
680
+ *
681
+ * Need to call joinSession before using this API
682
+ * @category Camera Control
683
+ */
684
+ export interface PTZController {
685
+ /**
686
+ * Checks if the browser supports PTZ camera control
687
+ * @returns true if PTZ is supported, false otherwise
688
+ * @example
689
+ * ```js
690
+ * const supported = UIToolkit.ptz.isBrowserSupported();
691
+ * if (supported) {
692
+ * console.log('PTZ camera control is supported');
693
+ * }
694
+ * ```
695
+ */
696
+ isBrowserSupported(): boolean;
697
+
698
+ /**
699
+ * Gets the PTZ capability of the local camera
700
+ * @returns Promise resolving to the PTZ capability object
701
+ * @example
702
+ * ```js
703
+ * const capability = await UIToolkit.ptz.getCapability();
704
+ * console.log('PTZ capabilities:', capability);
705
+ * ```
706
+ */
707
+ getCapability(): Promise<unknown>;
708
+
709
+ /**
710
+ * Gets the PTZ capability of a remote participant's camera
711
+ * @param userId - The user ID of the participant
712
+ * @returns Promise resolving to the PTZ capability object
713
+ * @example
714
+ * ```js
715
+ * const capability = await UIToolkit.ptz.getFarEndCapability(12345);
716
+ * ```
717
+ */
718
+ getFarEndCapability(userId: number): Promise<unknown>;
719
+
720
+ /**
721
+ * Requests control of a remote participant's camera
722
+ * @param userId - The user ID of the participant
723
+ * @returns Promise that resolves when the request is sent
724
+ * @example
725
+ * ```js
726
+ * await UIToolkit.ptz.requestControl(12345);
727
+ * ```
728
+ */
729
+ requestControl(userId: number): Promise<void>;
730
+
731
+ /**
732
+ * Approves a camera control request from another participant
733
+ * @param userId - The user ID of the participant requesting control
734
+ * @returns Promise that resolves when the approval is processed
735
+ * @example
736
+ * ```js
737
+ * await UIToolkit.ptz.approveControl(12345);
738
+ * ```
739
+ */
740
+ approveControl(userId: number): Promise<void>;
741
+
742
+ /**
743
+ * Declines a camera control request from another participant
744
+ * @param userId - The user ID of the participant requesting control
745
+ * @returns Promise that resolves when the decline is processed
746
+ * @example
747
+ * ```js
748
+ * await UIToolkit.ptz.declineControl(12345);
749
+ * ```
750
+ */
751
+ declineControl(userId: number): Promise<void>;
752
+
753
+ /**
754
+ * Gives up control of a remote participant's camera
755
+ * @param userId - The user ID of the participant whose camera control to release
756
+ * @returns Promise that resolves when control is released
757
+ * @example
758
+ * ```js
759
+ * await UIToolkit.ptz.giveUpControl(12345);
760
+ * ```
761
+ */
762
+ giveUpControl(userId: number): Promise<void>;
763
+
764
+ /**
765
+ * Sends a PTZ control command to a remote participant's camera
766
+ * @param options - Object containing cmd (command type), userId, and range (magnitude)
767
+ * @param options.cmd - PTZ command type (e.g., 1 for left, 2 for right, 3 for up, 4 for down, 5 for zoom in, 6 for zoom out)
768
+ * @param options.userId - The user ID of the participant
769
+ * @param options.range - Optional magnitude of the control action (0-100)
770
+ * @returns Promise that resolves when the command is sent
771
+ * @example
772
+ * ```js
773
+ * // Pan left
774
+ * await UIToolkit.ptz.control({ cmd: 1, userId: 12345, range: 50 });
775
+ *
776
+ * // Zoom in
777
+ * await UIToolkit.ptz.control({ cmd: 5, userId: 12345, range: 30 });
778
+ * ```
779
+ */
780
+ control(options: { cmd: number; userId: number; range?: number }): Promise<void>;
781
+ }
782
+
783
+ /**
784
+ * Internationalization (i18n) interface
785
+ *
786
+ * Need to call joinSession before using this API
787
+ * @category Localization
788
+ * @example
789
+ * ```js
790
+ * UIToolkit.onSessionJoined(async () => {
791
+ * // Simple language change (must have pre-loaded resources)
792
+ * await UIToolkit.i18n.setLanguage("zh-CN");
793
+ *
794
+ * // Load language from URL
795
+ * await UIToolkit.i18n.setLanguage("zh-TW", "https://example.com/lang/zh-TW.json");
796
+ *
797
+ * // Add inline resources for custom language
798
+ * const enJson = UIToolkit.i18n.getInstance().getResourceBundle("en-US", "translation") || {};
799
+ * const jpJson = Object.assign({}, enJson, {
800
+ * "notification.enable_audio_button": "参加",
801
+ * "notification.enable_audio_content": "このセッションに参加しますか?",
802
+ * "notification.enable_audio_title": "参加音声",
803
+ * "settings.tab_audio": "音声",
804
+ * "settings.tab_background": "背景",
805
+ * "settings.tab_general": "一般",
806
+ * "settings.tab_help": "ヘルプ",
807
+ * "settings.tab_mask": "マスク",
808
+ * "settings.tab_playback": "再生",
809
+ * "settings.tab_raw_data": "生データ",
810
+ * "settings.tab_second_audio": "セカンド音声",
811
+ * "settings.tab_statistics": "統計",
812
+ * "settings.tab_troubleshoot": "トラブルシューティング",
813
+ * });
814
+ * await UIToolkit.i18n.setLanguage("ja-JP", jpJson);
815
+ * });
816
+ *
817
+ * // Listen for language changes and load resources dynamically
818
+ * UIToolkit.onLanguageChange((language) => {
819
+ * console.log("uikit.onLanguageChange", language);
820
+ * if (language === "ko-KR") {
821
+ * void UIToolkit.i18n.setLanguage("ko-KR", "https://example.com/lang/ko-KR.json");
822
+ * } else if (language === "vi-VN") {
823
+ * void UIToolkit.i18n.setLanguage("vi-VN", "https://example.com/lang/vi-VN.json");
824
+ * } else {
825
+ * console.log("language not found", language);
826
+ * }
827
+ * });
828
+ * ```
829
+ */
830
+ export interface I18nController {
831
+ /**
832
+ * Sets the UI language and optionally loads additional translation resources
833
+ * @param language - The language code (e.g., "en-US", "zh-CN")
834
+ * @param resources - Optional translation resources (object or URL to JSON file)
835
+ * @returns Promise that resolves when language is set and resources are loaded
836
+ */
837
+ setLanguage(language: string, resources?: Record<string, unknown> | string): Promise<void>;
838
+
839
+ /**
840
+ * Sets the list of available languages in the language selector
841
+ * @param languages - Array of language codes to show in the settings
842
+ * @example
843
+ * ```js
844
+ * // Show multiple language options, if language not in the list, it will not be shown in the language selector
845
+ * UIToolkit.i18n.setLanguageList(["en-US", "zh-CN", "zh-TW", "ja-JP"]);
846
+ *
847
+ * // Restrict to specific languages
848
+ * UIToolkit.i18n.setLanguageList(["en-US", "zh-CN"]);
849
+ * ```
850
+ */
851
+ setLanguageList(languages: string[]): void;
852
+
853
+ /**
854
+ * Gets the i18next instance for advanced usage
855
+ * @returns The i18next instance
856
+ * @example
857
+ * ```js
858
+ * // Access i18next directly for advanced features
859
+ * const i18n = UIToolkit.i18n.getInstance();
860
+ * const translation = i18n.t("settings.language_title");
861
+ * const hasResources = i18n.hasResourceBundle("ja-JP", "translation");
862
+ * const enJson = i18n.getResourceBundle("en-US", "translation");
863
+ * ```
864
+ */
865
+ getInstance(): unknown;
866
+
867
+ /**
868
+ * Gets the current UI language, default is en-US see all keys at https://source.zoom.us/uitoolkit/{VERSION}/en-US.json
869
+ * @returns The current language code (e.g., "en-US")
870
+ * @example
871
+ * ```js
872
+ * const currentLang = UIToolkit.i18n.getLanguage();
873
+ * console.log("Current language:", currentLang);
874
+ * ```
875
+ */
876
+ getLanguage(): string;
877
+
878
+ /**
879
+ * Gets the list of available languages set by setLanguageList
880
+ * @returns Array of language codes, defaults support ["en-US", "zh-CN"]
881
+ * @example
882
+ * ```js
883
+ * const languages = UIToolkit.i18n.getLanguageList();
884
+ * console.log("Available languages:", languages);
885
+ * ```
886
+ */
887
+ getLanguageList(): string[];
888
+
889
+ /**
890
+ * Checks if a language has loaded translation resources
891
+ * @param language - The language code to check
892
+ * @returns true if resources exist, false otherwise
893
+ * @example
894
+ * ```js
895
+ * if (UIToolkit.i18n.hasLanguageResources("ja-JP")) {
896
+ * await UIToolkit.i18n.setLanguage("ja-JP");
897
+ * } else {
898
+ * console.log("Japanese resources not loaded");
899
+ * }
900
+ * ```
901
+ */
902
+ hasLanguageResources(language: string): boolean;
903
+ }
904
+
678
905
  /**
679
906
  * Zoom Video SDK UI Toolkit API
680
907
  * Provides methods for managing video sessions and UI components
681
908
  */
682
909
  export interface UIToolkit {
910
+ /**
911
+ * PTZ (Pan-Tilt-Zoom) camera control interface
912
+ * Provides methods for controlling PTZ-capable cameras
913
+ *
914
+ * Need to call joinSession before using this API
915
+ * @category Camera Control
916
+ */
917
+ ptz: PTZController;
918
+
919
+ /**
920
+ * Internationalization (i18n) interface
921
+ * Provides methods for managing UI language and translations
922
+ *
923
+ * Need to call joinSession before using this API
924
+ * @category Localization
925
+ */
926
+ i18n: I18nController;
927
+
683
928
  /**
684
929
  * Opens the video preview in a specified container.
685
930
  * Use this before joining a session to test video settings.
@@ -704,19 +949,19 @@ export interface UIToolkit {
704
949
  * @param container - DOM element to render the session UI
705
950
  * @param config - Session configuration options
706
951
  */
707
- joinSession(container: HTMLElement, config: CustomizationOptions): void;
952
+ joinSession(container: HTMLElement, config: CustomizationOptions): Promise<void>;
708
953
 
709
954
  /**
710
955
  * Leaves the session
711
956
  */
712
- leaveSession(): void;
957
+ leaveSession(): Promise<void>;
713
958
 
714
959
  /**
715
960
  * Closes the current video session.
716
961
  *
717
962
  * @param container - DOM element containing the session
718
963
  */
719
- closeSession(container?: HTMLElement): void;
964
+ closeSession(container?: HTMLElement): Promise<void>;
720
965
  /**
721
966
  * Changes the view type
722
967
  * @param viewType - The view type to change to.
@@ -784,6 +1029,37 @@ export interface UIToolkit {
784
1029
  */
785
1030
  offViewTypeChange(callback: () => void): void;
786
1031
 
1032
+ /**
1033
+ * Registers a callback for when the UI language changes.
1034
+ * The callback will be triggered when the user changes the language in settings.
1035
+ *
1036
+ * @param callback - Function to execute on language change, receives the new language code (e.g., "en-US", "zh-CN").
1037
+ * @category Events
1038
+ * @example
1039
+ * ```js
1040
+ * // Listen for language changes and load resources dynamically
1041
+ * UIToolkit.onLanguageChange((language) => {
1042
+ * console.log("Language changed to:", language);
1043
+ *
1044
+ * // Dynamically load language resources from URL
1045
+ * if (language === "zh-TW") {
1046
+ * UIToolkit.i18n.setLanguage("zh-TW", "https://example.com/lang/zh-TW.json")
1047
+ * .then(() => console.log("Traditional Chinese resources loaded"))
1048
+ * .catch((err) => console.error("Failed to load language:", err));
1049
+ * }
1050
+ * });
1051
+ * ```
1052
+ */
1053
+ onLanguageChange(callback: (language: string) => void): void;
1054
+
1055
+ /**
1056
+ * Removes a previously registered language change callback.
1057
+ *
1058
+ * @param callback - Function to remove from event listeners.
1059
+ * @category Events
1060
+ */
1061
+ offLanguageChange(callback: (language: string) => void): void;
1062
+
787
1063
  /**
788
1064
  * Registers a callback for a specific event.
789
1065
  *
@@ -1022,7 +1298,7 @@ export interface UIToolkit {
1022
1298
  * Destroys the UI toolkit instance and cleans up resources.
1023
1299
  * @returns void
1024
1300
  */
1025
- destroy(): void;
1301
+ destroy(): Promise<void>;
1026
1302
 
1027
1303
  /**
1028
1304
  * Get the version of the UI toolkit, Video SDK and Tailwind CSS