vani-meeting-client 0.5.1 → 0.5.4

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.
@@ -1,6 +1,6 @@
1
1
  import { MeetingStartRequest, VaniEventListener, Device, MessagePayload } from ".";
2
2
  import { GetDevicesType } from "./user-media-handler/UserMediaHandler";
3
- import { Track } from "./model/Track";
3
+ import { Track, TrackKind } from "./model/Track";
4
4
  import { TaskResponse } from "./model/TaskResponse";
5
5
  import { Participant } from "./model/Participant";
6
6
  export declare class MeetingHandler {
@@ -22,6 +22,8 @@ export declare class MeetingHandler {
22
22
  muteUser(userId?: string): Promise<TaskResponse>;
23
23
  resumeCamera(userId?: string): Promise<TaskResponse>;
24
24
  unmute(userId?: string): Promise<TaskResponse>;
25
+ resumeStreamWithoutAdding(streamKind: TrackKind): TaskResponse | undefined;
26
+ pauseStreamWithoutStopping(streamKind: TrackKind): TaskResponse | undefined;
25
27
  stopTrack(track: Track): void;
26
28
  addCustomTrack(track: Track): void;
27
29
  pauseIncomingTrack(track: Track): void;
@@ -227,6 +227,14 @@ var MeetingHandler = /** @class */ (function () {
227
227
  });
228
228
  });
229
229
  };
230
+ MeetingHandler.prototype.resumeStreamWithoutAdding = function (streamKind) {
231
+ var _a;
232
+ return (_a = this.userMediaHandler) === null || _a === void 0 ? void 0 : _a.resumeStreamWithoutAdding(streamKind);
233
+ };
234
+ MeetingHandler.prototype.pauseStreamWithoutStopping = function (streamKind) {
235
+ var _a;
236
+ return (_a = this.userMediaHandler) === null || _a === void 0 ? void 0 : _a.pauseStreamWithoutStopping(streamKind);
237
+ };
230
238
  MeetingHandler.prototype.stopTrack = function (track) {
231
239
  var _a;
232
240
  (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.removeTrack(track);
@@ -1,6 +1,7 @@
1
1
  import { Device } from "..";
2
2
  import { Base } from "../base/Base";
3
3
  import { TaskResponse } from "../model/TaskResponse";
4
+ import { TrackKind } from "../model/Track";
4
5
  export declare enum GetDevicesType {
5
6
  AudioIn = "audioinput",
6
7
  VideoIn = "videoinput",
@@ -30,4 +31,6 @@ export declare class UserMediaHandler extends Base {
30
31
  muteUser(userId?: string): Promise<TaskResponse>;
31
32
  resumeCamera(userId?: string): Promise<TaskResponse>;
32
33
  unmute(userId?: string): Promise<TaskResponse>;
34
+ pauseStreamWithoutStopping(streamKind: TrackKind): TaskResponse;
35
+ resumeStreamWithoutAdding(streamKind: TrackKind): TaskResponse;
33
36
  }
@@ -669,6 +669,48 @@ var UserMediaHandler = /** @class */ (function (_super) {
669
669
  });
670
670
  });
671
671
  };
672
+ UserMediaHandler.prototype.pauseStreamWithoutStopping = function (streamKind) {
673
+ var _a, _b, _c;
674
+ var track = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfTrackByType(streamKind);
675
+ if (track && track.track) {
676
+ track.track.enabled = false;
677
+ if (streamKind === TrackKind.Audio) {
678
+ var data = { userId: (_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.userId, type: "audio", status: "pause" };
679
+ var audioPause = { message: data, type: WebSocketBasicEvents.AudioVideoPauseResume };
680
+ this.communicationHandler.sendWebSocketMessage(WebSocketBasicEvents.AudioVideoPauseResume, audioPause);
681
+ }
682
+ else {
683
+ var data = { userId: (_c = this.meetingStartRequest) === null || _c === void 0 ? void 0 : _c.userId, type: "video", status: "pause" };
684
+ var audioPause = { message: data, type: WebSocketBasicEvents.AudioVideoPauseResume };
685
+ this.communicationHandler.sendWebSocketMessage(WebSocketBasicEvents.AudioVideoPauseResume, audioPause);
686
+ }
687
+ return { message: "Success", error: 'NoError', isSuccess: true };
688
+ }
689
+ else {
690
+ return ({ message: "No Track Found", error: 'NoDevice', isSuccess: false });
691
+ }
692
+ };
693
+ UserMediaHandler.prototype.resumeStreamWithoutAdding = function (streamKind) {
694
+ var _a, _b, _c;
695
+ var track = (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.getSelfTrackByType(streamKind);
696
+ if (track && track.track) {
697
+ track.track.enabled = true;
698
+ if (streamKind === TrackKind.Audio) {
699
+ var data = { userId: (_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.userId, type: "audio", status: "resume" };
700
+ var audioPause = { message: data, type: WebSocketBasicEvents.AudioVideoPauseResume };
701
+ this.communicationHandler.sendWebSocketMessage(WebSocketBasicEvents.AudioVideoPauseResume, audioPause);
702
+ }
703
+ else {
704
+ var data = { userId: (_c = this.meetingStartRequest) === null || _c === void 0 ? void 0 : _c.userId, type: "video", status: "resume" };
705
+ var audioPause = { message: data, type: WebSocketBasicEvents.AudioVideoPauseResume };
706
+ this.communicationHandler.sendWebSocketMessage(WebSocketBasicEvents.AudioVideoPauseResume, audioPause);
707
+ }
708
+ return { message: "Success", error: 'NoError', isSuccess: true };
709
+ }
710
+ else {
711
+ return ({ message: "No Track Found", error: 'NoDevice', isSuccess: false });
712
+ }
713
+ };
672
714
  return UserMediaHandler;
673
715
  }(Base));
674
716
  export { UserMediaHandler };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "0.5.1",
3
+ "version": "0.5.4",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",