@voicenter-team/opensips-js 1.0.99 → 1.0.100

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -302,6 +302,13 @@ declare type CommonLogMethodType = (...args: unknown[]) => void
302
302
 
303
303
  declare type conferenceStartListener = () => void
304
304
 
305
+ declare const CONFERENCING_MODE: {
306
+ WHITEBOARD: string;
307
+ IMAGE_WHITEBOARD: string;
308
+ };
309
+
310
+ declare type ConferencingModeType = typeof CONFERENCING_MODE[keyof typeof CONFERENCING_MODE];
311
+
305
312
  declare type connectionListener = (value: boolean) => void
306
313
 
307
314
  declare interface ConnectOptions {
@@ -434,6 +441,12 @@ declare interface JanusSessionEventMap {
434
441
  'peerconnection:setremotedescriptionfailed': Listener_2;
435
442
  }
436
443
 
444
+ declare type KonvaDrawerOptions = {
445
+ strokeWidth?: number
446
+ strokeColor?: string
447
+ emptyDrawerRectColor?: string
448
+ }
449
+
437
450
  declare type Listener = (event: unknown) => void
438
451
 
439
452
  declare type Listener_2 = (event: unknown) => void
@@ -446,6 +459,8 @@ declare type ListenerEventType = EndEvent | IncomingEvent | OutgoingEvent | Inco
446
459
 
447
460
  declare type ListenersKeyType = keyof OpenSIPSEventMap
448
461
 
462
+ declare type MaskEffectTypeConfigType = 'bokehEffect' | 'backgroundImageEffect';
463
+
449
464
  declare type memberHangupListener = (event: object) => void
450
465
 
451
466
  declare type memberJoinListener = (event: object) => void
@@ -776,6 +791,10 @@ declare interface OutgoingMSRPSessionEvent {
776
791
 
777
792
  declare type OutgoingMSRPSessionListener = (event: OutgoingMSRPSessionEvent) => void;
778
793
 
794
+ declare interface PluginConfig {
795
+ immediate: boolean;
796
+ }
797
+
779
798
  declare type readyListener = (value: boolean) => void
780
799
 
781
800
  declare interface RemoteIdentityCallType {
@@ -836,6 +855,53 @@ declare interface RTCSessionExtended extends RTCSession {
836
855
  init_icncoming(request: IncomingRequest): void
837
856
  }
838
857
 
858
+ export declare class ScreenSharePlugin extends BaseNewStreamPlugin {
859
+ constructor();
860
+ generateStream(): Promise<MediaStream>;
861
+ kill(): Promise<void>;
862
+ }
863
+
864
+ declare interface ScreenShareWhiteboardOptions {
865
+ selectors: ScreenShareWhiteboardSelectors;
866
+ }
867
+
868
+ export declare class ScreenShareWhiteBoardPlugin extends BaseProcessStreamPlugin {
869
+ private static video;
870
+ private static wrapperEl;
871
+ private static screenShareKonvaDrawer;
872
+ private static initialStream;
873
+ private imageSrc;
874
+ private konvaDrawer;
875
+ mode: ConferencingModeType;
876
+ private screenSharePlugin;
877
+ private selectors;
878
+ constructor(screenSharePlugin: any, options?: Partial<ScreenShareWhiteboardOptions>);
879
+ private createVideoElement;
880
+ private getAspectRatioDimensions;
881
+ /**
882
+ * Starts stream processing to add mask effect for it
883
+ * This method is useful in cases like drawing over the screen share as we
884
+ * already have a screen share stream and there is no need to create another one
885
+ * @param {MediaStream} stream
886
+ * @return {MediaStream} processed stream with mask effect
887
+ */
888
+ start(stream: any): Promise<MediaStream>;
889
+ /**
890
+ * Stops stream processing
891
+ */
892
+ stop(): any;
893
+ setupScreenShareDrawerOptions(options: KonvaDrawerOptions): void;
894
+ }
895
+
896
+ declare interface ScreenShareWhiteboardSelectors {
897
+ container: string;
898
+ compositeCanvasContainer: string;
899
+ compositeCanvas: string;
900
+ drawerContainer: string;
901
+ videoElement: string;
902
+ videoElementContainer: string;
903
+ }
904
+
839
905
  declare type startBlurListener = () => void
840
906
 
841
907
  declare type startScreenShareListener = (event: MediaStream) => void
@@ -844,6 +910,68 @@ declare type stopBlurListener = () => void
844
910
 
845
911
  declare type stopScreenShareListener = () => void
846
912
 
913
+ declare interface StreamMaskOptions {
914
+ effect: MaskEffectTypeConfigType;
915
+ base64Image?: string;
916
+ visualizationConfig?: VisualizationConfigType;
917
+ }
918
+
919
+ export declare class StreamMaskPlugin extends BaseProcessStreamPlugin {
920
+ private visualizationConfig;
921
+ private maskEffectType;
922
+ private base64ImageMask;
923
+ private rafId;
924
+ private timeoutId;
925
+ private segmenter;
926
+ private camera;
927
+ private canvas;
928
+ private ctx;
929
+ private visibilityState;
930
+ constructor(options: StreamMaskOptions, pluginConfig?: PluginConfig);
931
+ /**
932
+ * Starts stream processing to add mask effect for it
933
+ * @param {MediaStream} stream
934
+ * @param {'bokehEffect' | 'backgroundImageEffect'} effect - defines the mask effect type
935
+ * @param {MediaStreamConstraints} options - media stream constraints
936
+ * @param {object} options - (optional) additional mask effect options
937
+ * @return {MediaStream} processed stream with mask effect
938
+ */
939
+ start(stream: any): Promise<MediaStream>;
940
+ /**
941
+ * Listens to visibility change (like switching active tab)
942
+ * and switches between different kinds of requestAnimationFrame
943
+ */
944
+ private processVisibilityChange;
945
+ /**
946
+ * Adds audio tracks to MediaStream which contains only video tracks
947
+ * @param {MediaStream} stream - stream with only video tracks
948
+ * @param {MediaStreamConstraints} options - media stream constraints
949
+ * @return {MediaStream} combined stream with both audio and video tracks
950
+ */
951
+ private populateWithAudioTracks;
952
+ /**
953
+ * Stops stream processing
954
+ */
955
+ stop(): void;
956
+ setupVisualizationConfig(config: VisualizationConfigType): void;
957
+ /**
958
+ * Starts rendering process by calling itself recursively.
959
+ * Uses requestAnimationFrame method for recursive invoking.
960
+ */
961
+ private renderPrediction;
962
+ /**
963
+ * Creates Body Segmenter which is used for people segmentation and poses estimation
964
+ * @return {segmenter} segmenter instance
965
+ */
966
+ private createSegmenter;
967
+ /**
968
+ * Render function which draws masked effect to canvas.
969
+ */
970
+ private renderResult;
971
+ private applyBokehEffect;
972
+ private applyBackgroundImageEffect;
973
+ }
974
+
847
975
  declare interface StreamMediaType extends HTMLAudioElement {
848
976
  className: string
849
977
  setSinkId (id: string): Promise<void>
@@ -957,6 +1085,15 @@ declare class VideoModule {
957
1085
 
958
1086
  declare type VideoModuleName = typeof MODULES.VIDEO
959
1087
 
1088
+ declare type VisualizationConfigType = {
1089
+ foregroundThreshold?: number;
1090
+ maskOpacity?: number;
1091
+ maskBlur?: number;
1092
+ pixelCellWidth?: number;
1093
+ backgroundBlur?: number;
1094
+ edgeBlur?: number;
1095
+ };
1096
+
960
1097
  declare interface WebrtcMetricsConfigType {
961
1098
  refreshEvery?: number
962
1099
  startAfter?: number
@@ -969,4 +1106,31 @@ declare interface WebrtcMetricsConfigType {
969
1106
  ticket?: boolean
970
1107
  }
971
1108
 
1109
+ declare interface WhiteboardElementSelectors {
1110
+ container: string;
1111
+ drawerContainer: string;
1112
+ }
1113
+
1114
+ declare interface WhiteboardOptions {
1115
+ mode: ConferencingModeType;
1116
+ imageSrc?: string;
1117
+ selectors: Partial<WhiteboardElementSelectors>;
1118
+ }
1119
+
1120
+ export declare class WhiteBoardPlugin extends BaseNewStreamPlugin {
1121
+ private visualizationConfig;
1122
+ private rafId;
1123
+ private imageSrc;
1124
+ private konvaDrawer;
1125
+ private selectors;
1126
+ mode: ConferencingModeType;
1127
+ constructor(options: WhiteboardOptions);
1128
+ setupDrawerOptions(options: KonvaDrawerOptions): void;
1129
+ setupDrawerImage(imageSrc: any): void;
1130
+ private drawEmptyWhiteboard;
1131
+ private drawImageWhiteboard;
1132
+ generateStream(): Promise<void>;
1133
+ kill(): Promise<void>;
1134
+ }
1135
+
972
1136
  export { }