janus-simple-videoroom-client 2.0.1 → 2.2.0

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/dist/index.d.ts CHANGED
@@ -33,6 +33,16 @@ interface JanusPublishOptions {
33
33
  description: string;
34
34
  }[];
35
35
  }
36
+ interface JanusPublisherConfigureOptions extends JanusPublishOptions {
37
+ keyframe?: boolean;
38
+ streams?: Array<{
39
+ mid: JanusMid;
40
+ keyframe?: boolean;
41
+ send?: boolean;
42
+ min_delay?: number;
43
+ max_delay?: number;
44
+ }>;
45
+ }
36
46
  interface JanusSubscriberConfigureOptions {
37
47
  mid?: JanusMid;
38
48
  send?: boolean;
@@ -79,8 +89,8 @@ export interface VideoRoomPublisher {
79
89
  publisherId: string | number;
80
90
  onTrackAdded(callback: (track: MediaStreamTrack) => void): void;
81
91
  onTrackRemoved(callback: (track: MediaStreamTrack) => void): void;
82
- configure(configureOptions: JanusPublishOptions): Promise<void>;
83
- restart(mediaOptions?: JanusMediaOptions): Promise<void>;
92
+ configure(configureOptions: JanusPublisherConfigureOptions): Promise<void>;
93
+ restart(mediaOptions?: JanusMediaOptions, publishOptions?: JanusPublishOptions): Promise<void>;
84
94
  unpublish(): Promise<void>;
85
95
  }
86
96
  export interface VideoRoomSubscriber {
package/dist/index.js CHANGED
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createVideoRoomClient = exports.Janus = void 0;
12
+ exports.Janus = void 0;
13
+ exports.createVideoRoomClient = createVideoRoomClient;
13
14
  /**
14
15
  * Remove this once janus.js properly imports webrtc-adapter.
15
16
  * Currently janus npm package depends on webrtc-adapter but does not import it, and so it gets dropped during tree shaking.
@@ -28,7 +29,6 @@ function createVideoRoomClient(options) {
28
29
  };
29
30
  });
30
31
  }
31
- exports.createVideoRoomClient = createVideoRoomClient;
32
32
  function createVideoRoomSession(server, options) {
33
33
  return __awaiter(this, void 0, void 0, function* () {
34
34
  const eventTarget = makeEventTarget();
@@ -344,15 +344,13 @@ function createVideoRoomPublisher(handle, publisherId, opts) {
344
344
  });
345
345
  });
346
346
  },
347
- restart(mediaOptions = options.mediaOptions) {
348
- return __awaiter(this, void 0, void 0, function* () {
347
+ restart() {
348
+ return __awaiter(this, arguments, void 0, function* (mediaOptions = options.mediaOptions, publishOptions) {
349
349
  const offerJsep = yield new Promise(function (fulfill, reject) {
350
350
  handle.createOffer(Object.assign(Object.assign({}, mediaOptions), { success: fulfill, error: reject }));
351
351
  });
352
352
  const response = yield handle.sendAsyncRequest({
353
- message: {
354
- request: "configure",
355
- },
353
+ message: Object.assign(Object.assign({}, publishOptions), { request: "configure" }),
356
354
  jsep: offerJsep,
357
355
  expectResponse: r => r.message.videoroom == "event" && r.message.configured == "ok"
358
356
  });
@@ -478,8 +476,8 @@ function createVideoRoomSubscriber(session, roomId, streams, opts) {
478
476
  });
479
477
  });
480
478
  },
481
- restart(mediaOptions = options.mediaOptions) {
482
- return __awaiter(this, void 0, void 0, function* () {
479
+ restart() {
480
+ return __awaiter(this, arguments, void 0, function* (mediaOptions = options.mediaOptions) {
483
481
  const response = yield handle.sendAsyncRequest({
484
482
  message: {
485
483
  request: "configure",
@@ -590,8 +588,8 @@ function createStreamingSubscriber(session, mountPointId, options) {
590
588
  mountPointId = newMountPointId;
591
589
  });
592
590
  },
593
- restart(newOptions = options) {
594
- return __awaiter(this, void 0, void 0, function* () {
591
+ restart() {
592
+ return __awaiter(this, arguments, void 0, function* (newOptions = options) {
595
593
  const response = yield handle.sendAsyncRequest({
596
594
  message: Object.assign(Object.assign({}, newOptions === null || newOptions === void 0 ? void 0 : newOptions.watchOptions), { request: "watch", id: mountPointId }),
597
595
  expectResponse: r => { var _a; return r.message.streaming == "event" && ((_a = r.message.result) === null || _a === void 0 ? void 0 : _a.status) == "preparing"; }
@@ -632,7 +630,7 @@ function handleOffer(handle, offerJsep, mediaOptions) {
632
630
  expectResponse: r => {
633
631
  var _a;
634
632
  return r.message.videoroom == "event" && r.message.started == "ok" ||
635
- r.message.streaming == "event" && ((_a = r.message.result) === null || _a === void 0 ? void 0 : _a.status) == "starting";
633
+ r.message.streaming == "event" && ((_a = r.message.result) === null || _a === void 0 ? void 0 : _a.status) == "started";
636
634
  }
637
635
  });
638
636
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "janus-simple-videoroom-client",
3
- "version": "2.0.1",
3
+ "version": "2.2.0",
4
4
  "description": "Provides a simple high-level API that makes it easy to work with the Janus VideoRoom plugin",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,12 +22,12 @@
22
22
  },
23
23
  "homepage": "https://github.com/ken107/janus-videoroom-js#readme",
24
24
  "devDependencies": {
25
- "ts-loader": "^9.5.1",
26
- "typescript": "^4.9.4",
27
- "webpack": "^5.90.1",
28
- "webpack-cli": "^5.1.4"
25
+ "ts-loader": "^9.5.4",
26
+ "typescript": "^5.9.3",
27
+ "webpack": "^5.104.1",
28
+ "webpack-cli": "^6.0.1"
29
29
  },
30
30
  "dependencies": {
31
- "janus-gateway": "^1.2.1"
31
+ "janus-gateway": "^1.3.3"
32
32
  }
33
33
  }