@sprucelabs/heartwood-view-controllers 118.0.11 → 118.0.12

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.
Files changed (49) hide show
  1. package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/cardSection.schema.js +5 -0
  2. package/build/.spruce/schemas/schemas.types.d.ts +8 -0
  3. package/build/controllerMap.d.ts +2 -0
  4. package/build/controllerMap.js +2 -0
  5. package/build/esm/.spruce/schemas/heartwoodViewControllers/v2021_02_11/cardSection.schema.js +5 -0
  6. package/build/esm/.spruce/schemas/schemas.types.d.ts +8 -0
  7. package/build/esm/controllerMap.d.ts +2 -0
  8. package/build/esm/controllerMap.js +2 -0
  9. package/build/esm/index.d.ts +3 -0
  10. package/build/esm/index.js +3 -0
  11. package/build/esm/schemas/v2021_02_11/cards/card.builder.d.ts +6 -0
  12. package/build/esm/schemas/v2021_02_11/cards/cardBody.builder.d.ts +6 -0
  13. package/build/esm/schemas/v2021_02_11/cards/cardSection.builder.d.ts +6 -0
  14. package/build/esm/schemas/v2021_02_11/cards/cardSection.builder.js +6 -0
  15. package/build/esm/schemas/v2021_02_11/dialog.builder.d.ts +6 -0
  16. package/build/esm/schemas/v2021_02_11/layout.builder.d.ts +6 -0
  17. package/build/esm/schemas/v2021_02_11/lockScreen.builder.d.ts +6 -0
  18. package/build/esm/schemas/v2021_02_11/skillView.builder.d.ts +6 -0
  19. package/build/esm/schemas/v2021_02_11/toolBelt.builder.d.ts +6 -0
  20. package/build/esm/tests/MockRtcPeerConnection.d.ts +64 -0
  21. package/build/esm/tests/MockRtcPeerConnection.js +136 -0
  22. package/build/esm/types/heartwood.types.d.ts +4 -0
  23. package/build/esm/viewControllers/webRtcStreaming/WebRtcStreamingCard.vc.d.ts +10 -0
  24. package/build/esm/viewControllers/webRtcStreaming/WebRtcStreamingCard.vc.js +22 -0
  25. package/build/esm/webRtcStreaming/WebRtcConnection.d.ts +23 -0
  26. package/build/esm/webRtcStreaming/WebRtcConnection.js +35 -0
  27. package/build/esm/webRtcStreaming/WebRtcStreamer.d.ts +11 -0
  28. package/build/esm/webRtcStreaming/WebRtcStreamer.js +30 -0
  29. package/build/index.d.ts +3 -0
  30. package/build/index.js +10 -4
  31. package/build/schemas/v2021_02_11/cards/card.builder.d.ts +6 -0
  32. package/build/schemas/v2021_02_11/cards/cardBody.builder.d.ts +6 -0
  33. package/build/schemas/v2021_02_11/cards/cardSection.builder.d.ts +6 -0
  34. package/build/schemas/v2021_02_11/cards/cardSection.builder.js +6 -0
  35. package/build/schemas/v2021_02_11/dialog.builder.d.ts +6 -0
  36. package/build/schemas/v2021_02_11/layout.builder.d.ts +6 -0
  37. package/build/schemas/v2021_02_11/lockScreen.builder.d.ts +6 -0
  38. package/build/schemas/v2021_02_11/skillView.builder.d.ts +6 -0
  39. package/build/schemas/v2021_02_11/toolBelt.builder.d.ts +6 -0
  40. package/build/tests/MockRtcPeerConnection.d.ts +64 -0
  41. package/build/tests/MockRtcPeerConnection.js +120 -0
  42. package/build/types/heartwood.types.d.ts +4 -0
  43. package/build/viewControllers/webRtcStreaming/WebRtcStreamingCard.vc.d.ts +10 -0
  44. package/build/viewControllers/webRtcStreaming/WebRtcStreamingCard.vc.js +24 -0
  45. package/build/webRtcStreaming/WebRtcConnection.d.ts +23 -0
  46. package/build/webRtcStreaming/WebRtcConnection.js +30 -0
  47. package/build/webRtcStreaming/WebRtcStreamer.d.ts +11 -0
  48. package/build/webRtcStreaming/WebRtcStreamer.js +22 -0
  49. package/package.json +1 -1
@@ -216,6 +216,11 @@ const cardSectionSchema = {
216
216
  hint: 'Will render content in an iframe in the body of the card.',
217
217
  options: { schema: portal_schema_1.default, }
218
218
  },
219
+ /** . */
220
+ 'webRtcStreamer': {
221
+ type: 'raw',
222
+ options: { valueType: `HeartwoodTypes.WebRtcStreamer`, }
223
+ },
219
224
  /** Alignment. */
220
225
  'alignment': {
221
226
  label: 'Alignment',
@@ -7110,6 +7110,7 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
7110
7110
  'gridSize'?: ("small" | "medium" | "large") | undefined | null;
7111
7111
  /** . Will render content in an iframe in the body of the card. */
7112
7112
  'portal'?: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Portal | undefined | null;
7113
+ 'webRtcStreamer'?: (HeartwoodTypes.WebRtcStreamer) | undefined | null;
7113
7114
  /** Alignment. */
7114
7115
  'alignment'?: ("left" | "center" | "right") | undefined | null;
7115
7116
  }
@@ -7360,6 +7361,13 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
7360
7361
  schema: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.PortalSchema;
7361
7362
  };
7362
7363
  };
7364
+ /** . */
7365
+ 'webRtcStreamer': {
7366
+ type: 'raw';
7367
+ options: {
7368
+ valueType: `HeartwoodTypes.WebRtcStreamer`;
7369
+ };
7370
+ };
7363
7371
  /** Alignment. */
7364
7372
  'alignment': {
7365
7373
  label: 'Alignment';
@@ -27,6 +27,7 @@ import StatsViewController from './viewControllers/reporting/Stats.vc';
27
27
  import SwipeCardViewController from './viewControllers/SwipeCard.vc';
28
28
  import TalkingSprucebotViewController from './viewControllers/TalkingSprucebot.vc';
29
29
  import ToolBeltViewController from './viewControllers/ToolBelt.vc';
30
+ import WebRtcStreamingCardViewController from './viewControllers/webRtcStreaming/WebRtcStreamingCard.vc';
30
31
  export declare const CORE_CONTROLLER_MAP: {
31
32
  form: typeof FormViewController;
32
33
  /**
@@ -98,4 +99,5 @@ export declare const CORE_CONTROLLER_MAP: {
98
99
  'bar-chart': typeof BarChartViewController;
99
100
  'line-graph': typeof LineGraphViewController;
100
101
  'lock-screen': typeof LockScreenSkillViewController;
102
+ 'web-rtc-streaming-card': typeof WebRtcStreamingCardViewController;
101
103
  };
@@ -33,6 +33,7 @@ const Stats_vc_1 = __importDefault(require("./viewControllers/reporting/Stats.vc
33
33
  const SwipeCard_vc_1 = __importDefault(require("./viewControllers/SwipeCard.vc"));
34
34
  const TalkingSprucebot_vc_1 = __importDefault(require("./viewControllers/TalkingSprucebot.vc"));
35
35
  const ToolBelt_vc_1 = __importDefault(require("./viewControllers/ToolBelt.vc"));
36
+ const WebRtcStreamingCard_vc_1 = __importDefault(require("./viewControllers/webRtcStreaming/WebRtcStreamingCard.vc"));
36
37
  exports.CORE_CONTROLLER_MAP = {
37
38
  form: Form_vc_1.default,
38
39
  /**
@@ -104,4 +105,5 @@ exports.CORE_CONTROLLER_MAP = {
104
105
  'bar-chart': BarChart_vc_1.default,
105
106
  'line-graph': _1.LineGraphViewController,
106
107
  'lock-screen': LockScreen_svc_1.default,
108
+ 'web-rtc-streaming-card': WebRtcStreamingCard_vc_1.default,
107
109
  };
@@ -211,6 +211,11 @@ const cardSectionSchema = {
211
211
  hint: 'Will render content in an iframe in the body of the card.',
212
212
  options: { schema: portalSchema_v2021_02_11, }
213
213
  },
214
+ /** . */
215
+ 'webRtcStreamer': {
216
+ type: 'raw',
217
+ options: { valueType: `HeartwoodTypes.WebRtcStreamer`, }
218
+ },
214
219
  /** Alignment. */
215
220
  'alignment': {
216
221
  label: 'Alignment',
@@ -7110,6 +7110,7 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
7110
7110
  'gridSize'?: ("small" | "medium" | "large") | undefined | null;
7111
7111
  /** . Will render content in an iframe in the body of the card. */
7112
7112
  'portal'?: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Portal | undefined | null;
7113
+ 'webRtcStreamer'?: (HeartwoodTypes.WebRtcStreamer) | undefined | null;
7113
7114
  /** Alignment. */
7114
7115
  'alignment'?: ("left" | "center" | "right") | undefined | null;
7115
7116
  }
@@ -7360,6 +7361,13 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
7360
7361
  schema: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.PortalSchema;
7361
7362
  };
7362
7363
  };
7364
+ /** . */
7365
+ 'webRtcStreamer': {
7366
+ type: 'raw';
7367
+ options: {
7368
+ valueType: `HeartwoodTypes.WebRtcStreamer`;
7369
+ };
7370
+ };
7363
7371
  /** Alignment. */
7364
7372
  'alignment': {
7365
7373
  label: 'Alignment';
@@ -27,6 +27,7 @@ import StatsViewController from './viewControllers/reporting/Stats.vc';
27
27
  import SwipeCardViewController from './viewControllers/SwipeCard.vc';
28
28
  import TalkingSprucebotViewController from './viewControllers/TalkingSprucebot.vc';
29
29
  import ToolBeltViewController from './viewControllers/ToolBelt.vc';
30
+ import WebRtcStreamingCardViewController from './viewControllers/webRtcStreaming/WebRtcStreamingCard.vc';
30
31
  export declare const CORE_CONTROLLER_MAP: {
31
32
  form: typeof FormViewController;
32
33
  /**
@@ -98,4 +99,5 @@ export declare const CORE_CONTROLLER_MAP: {
98
99
  'bar-chart': typeof BarChartViewController;
99
100
  'line-graph': typeof LineGraphViewController;
100
101
  'lock-screen': typeof LockScreenSkillViewController;
102
+ 'web-rtc-streaming-card': typeof WebRtcStreamingCardViewController;
101
103
  };
@@ -27,6 +27,7 @@ import StatsViewController from './viewControllers/reporting/Stats.vc.js';
27
27
  import SwipeCardViewController from './viewControllers/SwipeCard.vc.js';
28
28
  import TalkingSprucebotViewController from './viewControllers/TalkingSprucebot.vc.js';
29
29
  import ToolBeltViewController from './viewControllers/ToolBelt.vc.js';
30
+ import WebRtcStreamingCardViewController from './viewControllers/webRtcStreaming/WebRtcStreamingCard.vc.js';
30
31
  export const CORE_CONTROLLER_MAP = {
31
32
  form: FormViewController,
32
33
  /**
@@ -98,4 +99,5 @@ export const CORE_CONTROLLER_MAP = {
98
99
  'bar-chart': BarChartViewController,
99
100
  'line-graph': LineGraphViewController,
100
101
  'lock-screen': LockScreenSkillViewController,
102
+ 'web-rtc-streaming-card': WebRtcStreamingCardViewController,
101
103
  };
@@ -66,6 +66,9 @@ export * from './auth/Authenticator';
66
66
  export { default as buildBigForm } from './builders/buildBigForm';
67
67
  export { default as buildForm } from './builders/buildForm';
68
68
  export { default as buildSkillView } from './builders/buildSkillView';
69
+ export { WebRtcStreamer, default as WebRtcStreamerImpl, } from './webRtcStreaming/WebRtcStreamer';
70
+ export { default as WebRtcConnection } from './webRtcStreaming/WebRtcConnection';
71
+ export { default as MocRtcPeerConnection } from './tests/MockRtcPeerConnection';
69
72
  export { default as calendarEventColorsSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/calendarEventColors.schema';
70
73
  export { default as bigFormSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/bigForm.schema';
71
74
  export { default as skillViewSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/skillView.schema';
@@ -65,6 +65,9 @@ export * from './auth/Authenticator.js';
65
65
  export { default as buildBigForm } from './builders/buildBigForm.js';
66
66
  export { default as buildForm } from './builders/buildForm.js';
67
67
  export { default as buildSkillView } from './builders/buildSkillView.js';
68
+ export { default as WebRtcStreamerImpl, } from './webRtcStreaming/WebRtcStreamer.js';
69
+ export { default as WebRtcConnection } from './webRtcStreaming/WebRtcConnection.js';
70
+ export { default as MocRtcPeerConnection } from './tests/MockRtcPeerConnection.js';
68
71
  export { default as calendarEventColorsSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/calendarEventColors.schema.js';
69
72
  export { default as bigFormSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/bigForm.schema.js';
70
73
  export { default as skillViewSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/skillView.schema.js';
@@ -29531,6 +29531,12 @@ declare const _default: {
29531
29531
  };
29532
29532
  };
29533
29533
  };
29534
+ webRtcStreamer: {
29535
+ type: "raw";
29536
+ options: {
29537
+ valueType: string;
29538
+ };
29539
+ };
29534
29540
  alignment: {
29535
29541
  type: "select";
29536
29542
  label: string;
@@ -22495,6 +22495,12 @@ declare const _default: {
22495
22495
  };
22496
22496
  };
22497
22497
  };
22498
+ webRtcStreamer: {
22499
+ type: "raw";
22500
+ options: {
22501
+ valueType: string;
22502
+ };
22503
+ };
22498
22504
  alignment: {
22499
22505
  type: "select";
22500
22506
  label: string;
@@ -22445,6 +22445,12 @@ declare const _default: {
22445
22445
  };
22446
22446
  };
22447
22447
  };
22448
+ webRtcStreamer: {
22449
+ type: "raw";
22450
+ options: {
22451
+ valueType: string;
22452
+ };
22453
+ };
22448
22454
  alignment: {
22449
22455
  type: "select";
22450
22456
  label: string;
@@ -239,6 +239,12 @@ export default buildSchema({
239
239
  }),
240
240
  },
241
241
  },
242
+ webRtcStreamer: {
243
+ type: 'raw',
244
+ options: {
245
+ valueType: 'HeartwoodTypes.WebRtcStreamer',
246
+ },
247
+ },
242
248
  alignment: {
243
249
  type: 'select',
244
250
  label: 'Alignment',
@@ -29562,6 +29562,12 @@ declare const _default: {
29562
29562
  };
29563
29563
  };
29564
29564
  };
29565
+ webRtcStreamer: {
29566
+ type: "raw";
29567
+ options: {
29568
+ valueType: string;
29569
+ };
29570
+ };
29565
29571
  alignment: {
29566
29572
  type: "select";
29567
29573
  label: string;
@@ -29542,6 +29542,12 @@ declare const _default: {
29542
29542
  };
29543
29543
  };
29544
29544
  };
29545
+ webRtcStreamer: {
29546
+ type: "raw";
29547
+ options: {
29548
+ valueType: string;
29549
+ };
29550
+ };
29545
29551
  alignment: {
29546
29552
  type: "select";
29547
29553
  label: string;
@@ -29587,6 +29587,12 @@ declare const _default: {
29587
29587
  };
29588
29588
  };
29589
29589
  };
29590
+ webRtcStreamer: {
29591
+ type: "raw";
29592
+ options: {
29593
+ valueType: string;
29594
+ };
29595
+ };
29590
29596
  alignment: {
29591
29597
  type: "select";
29592
29598
  label: string;
@@ -29581,6 +29581,12 @@ declare const _default: {
29581
29581
  };
29582
29582
  };
29583
29583
  };
29584
+ webRtcStreamer: {
29585
+ type: "raw";
29586
+ options: {
29587
+ valueType: string;
29588
+ };
29589
+ };
29584
29590
  alignment: {
29585
29591
  type: "select";
29586
29592
  label: string;
@@ -29603,6 +29603,12 @@ declare const _default: {
29603
29603
  };
29604
29604
  };
29605
29605
  };
29606
+ webRtcStreamer: {
29607
+ type: "raw";
29608
+ options: {
29609
+ valueType: string;
29610
+ };
29611
+ };
29606
29612
  alignment: {
29607
29613
  type: "select";
29608
29614
  label: string;
@@ -0,0 +1,64 @@
1
+ export default class MocRtcPeerConnection implements RTCPeerConnection {
2
+ static instance: MocRtcPeerConnection;
3
+ private constructorOptions?;
4
+ private offerOptions?;
5
+ offer: RTCSessionDescription;
6
+ private lastAddedEventListener?;
7
+ constructor(options?: RTCConfiguration);
8
+ assertGeneratedOfferEquals(offer: RTCSessionDescriptionInit): void;
9
+ assertCreatedWithOptions(expected: {
10
+ sdpSemantics: string;
11
+ iceServers: never[];
12
+ }): void;
13
+ assertCalledCreateOfferWith(expected: RTCOfferOptions): void;
14
+ assertSetsResponseToConnectionLocalDescription(): void;
15
+ assertSetAnswerEquals(options: {
16
+ type: string;
17
+ sdp: string;
18
+ }): void;
19
+ assertTrackListenerSet(expected: () => void): void;
20
+ canTrickleIceCandidates: boolean | null;
21
+ connectionState: RTCPeerConnectionState;
22
+ currentLocalDescription: RTCSessionDescription | null;
23
+ currentRemoteDescription: RTCSessionDescription | null;
24
+ iceConnectionState: RTCIceConnectionState;
25
+ iceGatheringState: RTCIceGatheringState;
26
+ localDescription: RTCSessionDescription | null;
27
+ onconnectionstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null;
28
+ ondatachannel: ((this: RTCPeerConnection, ev: RTCDataChannelEvent) => any) | null;
29
+ onicecandidate: ((this: RTCPeerConnection, ev: RTCPeerConnectionIceEvent) => any) | null;
30
+ onicecandidateerror: ((this: RTCPeerConnection, ev: RTCPeerConnectionIceErrorEvent) => any) | null;
31
+ oniceconnectionstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null;
32
+ onicegatheringstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null;
33
+ onnegotiationneeded: ((this: RTCPeerConnection, ev: Event) => any) | null;
34
+ onsignalingstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null;
35
+ ontrack: ((this: RTCPeerConnection, ev: RTCTrackEvent) => any) | null;
36
+ pendingLocalDescription: RTCSessionDescription | null;
37
+ pendingRemoteDescription: RTCSessionDescription | null;
38
+ remoteDescription: RTCSessionDescription | null;
39
+ sctp: RTCSctpTransport | null;
40
+ signalingState: RTCSignalingState;
41
+ addIceCandidate(_candidate?: unknown, _successCallback?: unknown, _failureCallback?: unknown): Promise<void>;
42
+ addTrack(_track: unknown, ..._streams: unknown[]): RTCRtpSender;
43
+ addTransceiver(_trackOrKind: unknown, _init?: unknown): RTCRtpTransceiver;
44
+ close(): void;
45
+ createAnswer(_successCallback?: unknown, _failureCallback?: unknown): Promise<void> | Promise<RTCSessionDescriptionInit>;
46
+ createDataChannel(_label: unknown, _dataChannelDict?: unknown): RTCDataChannel;
47
+ createOffer(options?: RTCOfferOptions): Promise<any>;
48
+ getConfiguration(): RTCConfiguration;
49
+ getReceivers(): RTCRtpReceiver[];
50
+ getSenders(): RTCRtpSender[];
51
+ getStats(_selector?: unknown, _successCallback?: unknown, _failureCallback?: unknown): Promise<void>;
52
+ getTransceivers(): RTCRtpTransceiver[];
53
+ removeTrack(): void;
54
+ restartIce(): void;
55
+ setConfiguration(_configuration?: unknown): void;
56
+ setLocalDescription(description?: RTCLocalSessionDescriptionInit): Promise<void>;
57
+ setRemoteDescription(description: {
58
+ type: 'answer';
59
+ sdp: string;
60
+ }): Promise<void>;
61
+ addEventListener(type: unknown, listener: unknown, _options?: unknown): void;
62
+ removeEventListener(_type: unknown, _listener: unknown, _options?: unknown): void;
63
+ dispatchEvent(_event: Event): boolean;
64
+ }
@@ -0,0 +1,136 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { assert, generateId } from '@sprucelabs/test-utils';
11
+ export default class MocRtcPeerConnection {
12
+ constructor(options) {
13
+ this.offer = {
14
+ [generateId()]: generateId(),
15
+ };
16
+ this.canTrickleIceCandidates = null;
17
+ this.connectionState = {};
18
+ this.currentLocalDescription = null;
19
+ this.currentRemoteDescription = null;
20
+ this.iceConnectionState = {};
21
+ this.iceGatheringState = {};
22
+ this.localDescription = null;
23
+ this.onconnectionstatechange = null;
24
+ this.ondatachannel = null;
25
+ this.onicecandidate = null;
26
+ this.onicecandidateerror = null;
27
+ this.oniceconnectionstatechange = null;
28
+ this.onicegatheringstatechange = null;
29
+ this.onnegotiationneeded = null;
30
+ this.onsignalingstatechange = null;
31
+ this.ontrack = null;
32
+ this.pendingLocalDescription = null;
33
+ this.pendingRemoteDescription = null;
34
+ this.remoteDescription = null;
35
+ this.sctp = null;
36
+ this.signalingState = {};
37
+ MocRtcPeerConnection.instance = this;
38
+ this.constructorOptions = options;
39
+ }
40
+ assertGeneratedOfferEquals(offer) {
41
+ assert.isEqualDeep(offer, this.offer, 'Did not return the generated offer');
42
+ }
43
+ assertCreatedWithOptions(expected) {
44
+ assert.isEqualDeep(this.constructorOptions, expected, 'Did not pass default options to peer connection');
45
+ }
46
+ assertCalledCreateOfferWith(expected) {
47
+ assert.isEqualDeep(this.offerOptions, expected, 'Did not pass expected options to createOffer');
48
+ }
49
+ assertSetsResponseToConnectionLocalDescription() {
50
+ assert.isEqualDeep(this.offer, this.localDescription, 'Did not set offer to local description');
51
+ }
52
+ assertSetAnswerEquals(options) {
53
+ assert.isEqualDeep(this.remoteDescription, options, 'Did not set answer to remote description of the peer connection');
54
+ }
55
+ assertTrackListenerSet(expected) {
56
+ assert.isEqualDeep(this.lastAddedEventListener, {
57
+ eventName: 'track',
58
+ listener: expected,
59
+ }, 'did not call connection.addEventListener with track listener');
60
+ }
61
+ addIceCandidate(_candidate, _successCallback, _failureCallback) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ throw new Error('Method not implemented.');
64
+ });
65
+ }
66
+ addTrack(_track, ..._streams) {
67
+ return {};
68
+ }
69
+ addTransceiver(_trackOrKind, _init) {
70
+ return {};
71
+ }
72
+ close() {
73
+ throw new Error('Method not implemented.');
74
+ }
75
+ //@ts-ignore
76
+ createAnswer(_successCallback, _failureCallback) {
77
+ return {};
78
+ }
79
+ createDataChannel(_label, _dataChannelDict) {
80
+ return {};
81
+ }
82
+ //@ts-ignore
83
+ createOffer(options) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ this.offerOptions = options;
86
+ return this.offer;
87
+ });
88
+ }
89
+ getConfiguration() {
90
+ return {};
91
+ }
92
+ getReceivers() {
93
+ return [];
94
+ }
95
+ getSenders() {
96
+ return [];
97
+ }
98
+ //@ts-ignore
99
+ getStats(_selector, _successCallback, _failureCallback) {
100
+ return __awaiter(this, void 0, void 0, function* () {
101
+ throw new Error('Method not implemented.');
102
+ });
103
+ }
104
+ getTransceivers() {
105
+ return [];
106
+ }
107
+ removeTrack() { }
108
+ restartIce() { }
109
+ setConfiguration(_configuration) { }
110
+ setLocalDescription(description) {
111
+ return __awaiter(this, void 0, void 0, function* () {
112
+ this.localDescription = description;
113
+ });
114
+ }
115
+ setRemoteDescription(description) {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ this.remoteDescription = description;
118
+ });
119
+ }
120
+ addEventListener(type, listener, _options) {
121
+ this.lastAddedEventListener = {
122
+ eventName: type,
123
+ listener,
124
+ };
125
+ }
126
+ removeEventListener(_type, _listener, _options) {
127
+ throw new Error('Method not implemented.');
128
+ }
129
+ dispatchEvent(_event) {
130
+ return true;
131
+ }
132
+ }
133
+ global.window = {
134
+ //@ts-ignore
135
+ RTCPeerConnection: MocRtcPeerConnection,
136
+ };
@@ -42,6 +42,7 @@ import ToolBeltViewController, { ToolBeltViewControllerOptions } from '../viewCo
42
42
  import ViewControllerFactory from '../viewControllers/ViewControllerFactory';
43
43
  export * from './calendar.types';
44
44
  import '@sprucelabs/mercury-core-events';
45
+ import WebRtcStreamingCardViewController, { WebRtcStreamingCardViewControllerOptions } from '../viewControllers/webRtcStreaming/WebRtcStreamingCard.vc';
45
46
  export { default as MapViewController } from '../viewControllers/Map.vc';
46
47
  export type ErrorHandler = (message: string) => void;
47
48
  type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
@@ -254,6 +255,7 @@ export type LayoutStyle = NonNullable<SpruceSchemas.HeartwoodViewControllers.v20
254
255
  export type ListColumnWidth = NonNullable<List['columnWidths']>[number];
255
256
  export type TriggerRender = () => void;
256
257
  export type TriggerRenderHandler = () => void;
258
+ export { WebRtcStreamer } from '../webRtcStreaming/WebRtcStreamer';
257
259
  export interface ViewController<ViewModel extends Record<string, any>> {
258
260
  render(): ViewModel;
259
261
  setTriggerRenderHandler: (handler: TriggerRenderHandler) => void;
@@ -383,6 +385,7 @@ export interface ViewControllerMap {
383
385
  'bar-chart': BarChartViewController;
384
386
  'line-graph': LineGraphViewController;
385
387
  'lock-screen': LockScreenSkillViewController;
388
+ 'web-rtc-streaming-card': WebRtcStreamingCardViewController;
386
389
  }
387
390
  export interface ViewControllerOptionsMap {
388
391
  form: FormViewControllerOptions<any>;
@@ -427,6 +430,7 @@ export interface ViewControllerOptionsMap {
427
430
  'bar-chart': BarChartViewControllerOptions;
428
431
  'line-graph': LineGraphViewControllerOptions;
429
432
  'lock-screen': LockScreenSkillViewControllerOptions;
433
+ 'web-rtc-streaming-card': WebRtcStreamingCardViewControllerOptions;
430
434
  }
431
435
  export interface SkillViewControllerMap {
432
436
  }
@@ -0,0 +1,10 @@
1
+ import { CardViewControllerImpl } from '../..';
2
+ import { Card, ViewControllerOptions } from '../../types/heartwood.types';
3
+ import { WebRtcStreamer } from '../../webRtcStreaming/WebRtcStreamer';
4
+ export default class WebRtcStreamingCardViewController extends CardViewControllerImpl {
5
+ static id: string;
6
+ constructor(options: ViewControllerOptions & WebRtcStreamingCardViewControllerOptions);
7
+ setStreamer(streamer: WebRtcStreamer, sectionIdx?: number): void;
8
+ }
9
+ export interface WebRtcStreamingCardViewControllerOptions extends Card {
10
+ }
@@ -0,0 +1,22 @@
1
+ import { assertOptions } from '@sprucelabs/schema';
2
+ import { CardViewControllerImpl } from '../../index.js';
3
+ class WebRtcStreamingCardViewController extends CardViewControllerImpl {
4
+ constructor(options) {
5
+ super(options);
6
+ }
7
+ setStreamer(streamer, sectionIdx = 0) {
8
+ assertOptions({ streamer }, ['streamer']);
9
+ if (this.getTotalSections() === 0) {
10
+ this.addSection({
11
+ webRtcStreamer: streamer,
12
+ });
13
+ }
14
+ else {
15
+ this.updateSection(sectionIdx, {
16
+ webRtcStreamer: streamer,
17
+ });
18
+ }
19
+ }
20
+ }
21
+ WebRtcStreamingCardViewController.id = 'web-rtc-streaming-card';
22
+ export default WebRtcStreamingCardViewController;
@@ -0,0 +1,23 @@
1
+ import WebRtcStreamerImpl from './WebRtcStreamer';
2
+ export default class WebRtcConnection {
3
+ static get RTCPeerConnection(): {
4
+ new (configuration?: RTCConfiguration): RTCPeerConnection;
5
+ prototype: RTCPeerConnection;
6
+ generateCertificate(keygenAlgorithm: AlgorithmIdentifier): Promise<RTCCertificate>;
7
+ };
8
+ static set RTCPeerConnection(value: {
9
+ new (configuration?: RTCConfiguration): RTCPeerConnection;
10
+ prototype: RTCPeerConnection;
11
+ generateCertificate(keygenAlgorithm: AlgorithmIdentifier): Promise<RTCCertificate>;
12
+ });
13
+ static createOffer(options: WebRtcVcPluginCreateOfferOptions): Promise<{
14
+ offerSdp: RTCSessionDescriptionInit;
15
+ streamer: WebRtcStreamerImpl;
16
+ }>;
17
+ }
18
+ export interface WebRtcVcPluginCreateOfferOptions {
19
+ offerOptions: {
20
+ offerToReceiveAudio?: boolean;
21
+ offerToReceiveVideo?: boolean;
22
+ };
23
+ }
@@ -0,0 +1,35 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { assertOptions } from '@sprucelabs/schema';
11
+ import WebRtcStreamerImpl from './WebRtcStreamer.js';
12
+ export default class WebRtcConnection {
13
+ static get RTCPeerConnection() {
14
+ return window.RTCPeerConnection;
15
+ }
16
+ static set RTCPeerConnection(value) {
17
+ window.RTCPeerConnection = value;
18
+ }
19
+ static createOffer(options) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const { offerOptions } = assertOptions(options, ['offerOptions']);
22
+ const connection = new WebRtcConnection.RTCPeerConnection({
23
+ //@ts-ignore
24
+ sdpSemantics: 'unified-plan',
25
+ iceServers: [],
26
+ });
27
+ const offer = yield connection.createOffer(offerOptions);
28
+ yield connection.setLocalDescription(offer);
29
+ return {
30
+ offerSdp: offer,
31
+ streamer: WebRtcStreamerImpl.Streamer(connection),
32
+ };
33
+ });
34
+ }
35
+ }
@@ -0,0 +1,11 @@
1
+ export default class WebRtcStreamerImpl {
2
+ private connection;
3
+ protected constructor(connection: RTCPeerConnection);
4
+ static Streamer(connection: RTCPeerConnection): WebRtcStreamerImpl;
5
+ setAnswer(answerSdp: string): Promise<void>;
6
+ onTrack(cb: (event: RTCTrackEvent) => void): void;
7
+ }
8
+ export interface WebRtcStreamer {
9
+ setAnswer(answerSdp: string): Promise<void>;
10
+ onTrack(cb: (event: RTCTrackEvent) => void): void;
11
+ }
@@ -0,0 +1,30 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { assertOptions } from '@sprucelabs/schema';
11
+ export default class WebRtcStreamerImpl {
12
+ constructor(connection) {
13
+ this.connection = connection;
14
+ }
15
+ static Streamer(connection) {
16
+ return new WebRtcStreamerImpl(connection);
17
+ }
18
+ setAnswer(answerSdp) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ assertOptions({ answerSdp }, ['answerSdp']);
21
+ yield this.connection.setRemoteDescription({
22
+ type: 'answer',
23
+ sdp: answerSdp,
24
+ });
25
+ });
26
+ }
27
+ onTrack(cb) {
28
+ this.connection.addEventListener('track', cb);
29
+ }
30
+ }
package/build/index.d.ts CHANGED
@@ -66,6 +66,9 @@ export * from './auth/Authenticator';
66
66
  export { default as buildBigForm } from './builders/buildBigForm';
67
67
  export { default as buildForm } from './builders/buildForm';
68
68
  export { default as buildSkillView } from './builders/buildSkillView';
69
+ export { WebRtcStreamer, default as WebRtcStreamerImpl, } from './webRtcStreaming/WebRtcStreamer';
70
+ export { default as WebRtcConnection } from './webRtcStreaming/WebRtcConnection';
71
+ export { default as MocRtcPeerConnection } from './tests/MockRtcPeerConnection';
69
72
  export { default as calendarEventColorsSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/calendarEventColors.schema';
70
73
  export { default as bigFormSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/bigForm.schema';
71
74
  export { default as skillViewSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/skillView.schema';
package/build/index.js CHANGED
@@ -17,10 +17,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.selectInputSchema = exports.skillViewSchema = exports.bigFormSchema = exports.calendarEventColorsSchema = exports.buildSkillView = exports.buildForm = exports.buildBigForm = exports.AuthenticatorImpl = exports.PolarAreaViewController = exports.SpyViewControllerExporter = exports.lockScreenAssert = exports.MockActiveRecordCard = exports.activeRecordCardAssert = exports.buildActiveRecordList = exports.buildActiveRecordCard = exports.AbstractInputViewController = exports.AutocompleteInputViewController = exports.AbstractCalendarEventViewController = exports.RatingsViewController = exports.ProgressViewController = exports.StatsViewController = exports.FeedViewController = exports.ActiveRecordListViewController = exports.ActiveRecordCardViewController = exports.TalkingSprucebotViewController = exports.ButtonBarViewController = exports.CalendarViewController = exports.SwipeCardViewControllerImpl = exports.SwipeViewControllerImpl = exports.PagerViewController = exports.ProgressNavigatorViewController = exports.CountdownTimerViewController = exports.FormBuilderCardViewControllerImpl = exports.LoginViewController = exports.LineGraphViewController = exports.BarChartViewController = exports.ToolBeltViewController = exports.FormViewControllerImpl = exports.ListCellViewController = exports.ListRowViewController = exports.ListViewController = exports.NavigationViewController = exports.LockScreenSkillViewController = exports.DialogViewController = exports.ConfirmViewController = exports.CardViewControllerImpl = exports.ButtonGroupViewController = exports.AbstractAppController = exports.AbstractViewController = exports.AbstractSkillViewController = void 0;
21
- exports.statsSchema = exports.toggleInputSchema = exports.listToggleInputSchema = exports.addressInputSchema = exports.buttonBarButtonSchema = exports.buttonBarSchema = exports.toolBeltToolSchema = exports.toolBeltSchema = exports.calendarTimeSchema = exports.calendarPersonSchema = exports.calendarSchema = exports.themePropsSchema = exports.themeSchema = exports.cardFooterButtonSchema = exports.criticalErrorSchema = exports.sprucebotTypedMessageSentenceSchema = exports.sprucebotTypedMessageAvatarSchema = exports.selectInputChoiceSchema = exports.calendarEventColorOverrideSchema = exports.portalSchema = exports.listTextInputSchema = exports.listSelectInputSchema = exports.listCellButtonSchema = exports.dropdownButtonSchema = exports.bigFormSectionSchema = exports.textInputSchema = exports.phoneInputSchema = exports.inputSchema = exports.dropdownSchema = exports.sprucebotTypedMessageSchema = exports.talkingSprucebotSchema = exports.sprucebotAvatarSchema = exports.formBuilderImportExportObjectSchema = exports.listCellSchema = exports.listRowSchema = exports.listSchema = exports.layoutSchema = exports.cardSectionSchema = exports.cardHeaderSchema = exports.cardFooterSchema = exports.cardBodySchema = exports.cardSchema = exports.formSectionSchema = exports.formSchema = exports.textSchema = exports.lockScreenSchema = exports.dialogSchema = exports.buttonSchema = exports.lineIconSchema = exports.fancyIconSchema = void 0;
22
- exports.interactor = exports.normalizeScopeFromVc = exports.autocompleteInteractor = exports.formAssert = exports.autocompleteAssert = exports.listAssert = exports.buttonAssert = exports.deviceAssert = exports.navigationAssert = exports.toolBeltAssert = exports.toastAssert = exports.vcPluginAssert = exports.vcDurationAssert = exports.pagerAssert = exports.vcAssert = exports.vcAssertUtil = exports.feedAssert = exports.feedInteractor = exports.normalizeFormSectionFieldNamesUtil = exports.ViewControllerError = exports.SpyDevice = exports.StubStorage = exports.ViewControllerFactory = exports.ViewControllerImporter = exports.ViewControllerExporter = exports.pagerSchema = exports.polarAreaDataItemSchema = exports.polarAreaSchema = exports.inputButtonSchema = exports.mapPinSchema = exports.mapSchema = exports.latLngSchema = exports.formBuilderImportExportPageSchema = exports.autocompleteSuggestionSchema = exports.autocompleteInputSchema = exports.feedSchema = exports.calendarShiftSchema = exports.receiptTotalSchema = exports.receiptSectionSchema = exports.receiptLineItemSchema = exports.receiptHeaderSchema = exports.receiptSchema = exports.listDateInputSchema = exports.calendarSelectedDateSchema = exports.calendarEventSchema = exports.ratingsInputSchema = exports.listRatingsInputSchema = exports.ratingsSchema = exports.progressSchema = exports.statsStatSchema = void 0;
23
- exports.navigationRouteSchema = exports.routerDestinationSchema = exports.navigationDropdownButtonSchema = exports.navigationButtonDropdownSchema = exports.chartDataSetSchema = exports.chartDataPointSchema = exports.lineGraphSchema = exports.barChartSchema = exports.progressDetailsSchema = exports.progressNavigatorStepSchema = exports.progressNavigatorSchema = exports.countdownTimerSchema = exports.permissionContractReferenceSchema = exports.navigationButtonSchema = exports.navigationSchema = exports.ToolBeltStateMachine = exports.removeUniversalViewOptions = exports.buildSkillViewLayout = exports.splitCardsIntoLayouts = exports.listUtil = exports.mapInteractor = exports.mapAssert = exports.renderUtil = exports.routerTestPatcher = exports.dialogTestPatcher = exports.confirmTestPatcher = exports.calendarSeeder = exports.interactionUtil = exports.chartAssert = exports.progressNavigatorAssert = exports.countdownTimerInteractor = exports.countdownTimerAssert = exports.calendarInteractor = void 0;
20
+ exports.calendarEventColorsSchema = exports.MocRtcPeerConnection = exports.WebRtcConnection = exports.WebRtcStreamerImpl = exports.buildSkillView = exports.buildForm = exports.buildBigForm = exports.AuthenticatorImpl = exports.PolarAreaViewController = exports.SpyViewControllerExporter = exports.lockScreenAssert = exports.MockActiveRecordCard = exports.activeRecordCardAssert = exports.buildActiveRecordList = exports.buildActiveRecordCard = exports.AbstractInputViewController = exports.AutocompleteInputViewController = exports.AbstractCalendarEventViewController = exports.RatingsViewController = exports.ProgressViewController = exports.StatsViewController = exports.FeedViewController = exports.ActiveRecordListViewController = exports.ActiveRecordCardViewController = exports.TalkingSprucebotViewController = exports.ButtonBarViewController = exports.CalendarViewController = exports.SwipeCardViewControllerImpl = exports.SwipeViewControllerImpl = exports.PagerViewController = exports.ProgressNavigatorViewController = exports.CountdownTimerViewController = exports.FormBuilderCardViewControllerImpl = exports.LoginViewController = exports.LineGraphViewController = exports.BarChartViewController = exports.ToolBeltViewController = exports.FormViewControllerImpl = exports.ListCellViewController = exports.ListRowViewController = exports.ListViewController = exports.NavigationViewController = exports.LockScreenSkillViewController = exports.DialogViewController = exports.ConfirmViewController = exports.CardViewControllerImpl = exports.ButtonGroupViewController = exports.AbstractAppController = exports.AbstractViewController = exports.AbstractSkillViewController = void 0;
21
+ exports.addressInputSchema = exports.buttonBarButtonSchema = exports.buttonBarSchema = exports.toolBeltToolSchema = exports.toolBeltSchema = exports.calendarTimeSchema = exports.calendarPersonSchema = exports.calendarSchema = exports.themePropsSchema = exports.themeSchema = exports.cardFooterButtonSchema = exports.criticalErrorSchema = exports.sprucebotTypedMessageSentenceSchema = exports.sprucebotTypedMessageAvatarSchema = exports.selectInputChoiceSchema = exports.calendarEventColorOverrideSchema = exports.portalSchema = exports.listTextInputSchema = exports.listSelectInputSchema = exports.listCellButtonSchema = exports.dropdownButtonSchema = exports.bigFormSectionSchema = exports.textInputSchema = exports.phoneInputSchema = exports.inputSchema = exports.dropdownSchema = exports.sprucebotTypedMessageSchema = exports.talkingSprucebotSchema = exports.sprucebotAvatarSchema = exports.formBuilderImportExportObjectSchema = exports.listCellSchema = exports.listRowSchema = exports.listSchema = exports.layoutSchema = exports.cardSectionSchema = exports.cardHeaderSchema = exports.cardFooterSchema = exports.cardBodySchema = exports.cardSchema = exports.formSectionSchema = exports.formSchema = exports.textSchema = exports.lockScreenSchema = exports.dialogSchema = exports.buttonSchema = exports.lineIconSchema = exports.fancyIconSchema = exports.selectInputSchema = exports.skillViewSchema = exports.bigFormSchema = void 0;
22
+ exports.formAssert = exports.autocompleteAssert = exports.listAssert = exports.buttonAssert = exports.deviceAssert = exports.navigationAssert = exports.toolBeltAssert = exports.toastAssert = exports.vcPluginAssert = exports.vcDurationAssert = exports.pagerAssert = exports.vcAssert = exports.vcAssertUtil = exports.feedAssert = exports.feedInteractor = exports.normalizeFormSectionFieldNamesUtil = exports.ViewControllerError = exports.SpyDevice = exports.StubStorage = exports.ViewControllerFactory = exports.ViewControllerImporter = exports.ViewControllerExporter = exports.pagerSchema = exports.polarAreaDataItemSchema = exports.polarAreaSchema = exports.inputButtonSchema = exports.mapPinSchema = exports.mapSchema = exports.latLngSchema = exports.formBuilderImportExportPageSchema = exports.autocompleteSuggestionSchema = exports.autocompleteInputSchema = exports.feedSchema = exports.calendarShiftSchema = exports.receiptTotalSchema = exports.receiptSectionSchema = exports.receiptLineItemSchema = exports.receiptHeaderSchema = exports.receiptSchema = exports.listDateInputSchema = exports.calendarSelectedDateSchema = exports.calendarEventSchema = exports.ratingsInputSchema = exports.listRatingsInputSchema = exports.ratingsSchema = exports.progressSchema = exports.statsStatSchema = exports.statsSchema = exports.toggleInputSchema = exports.listToggleInputSchema = void 0;
23
+ exports.navigationRouteSchema = exports.routerDestinationSchema = exports.navigationDropdownButtonSchema = exports.navigationButtonDropdownSchema = exports.chartDataSetSchema = exports.chartDataPointSchema = exports.lineGraphSchema = exports.barChartSchema = exports.progressDetailsSchema = exports.progressNavigatorStepSchema = exports.progressNavigatorSchema = exports.countdownTimerSchema = exports.permissionContractReferenceSchema = exports.navigationButtonSchema = exports.navigationSchema = exports.ToolBeltStateMachine = exports.removeUniversalViewOptions = exports.buildSkillViewLayout = exports.splitCardsIntoLayouts = exports.listUtil = exports.mapInteractor = exports.mapAssert = exports.renderUtil = exports.routerTestPatcher = exports.dialogTestPatcher = exports.confirmTestPatcher = exports.calendarSeeder = exports.interactionUtil = exports.chartAssert = exports.progressNavigatorAssert = exports.countdownTimerInteractor = exports.countdownTimerAssert = exports.calendarInteractor = exports.interactor = exports.normalizeScopeFromVc = exports.autocompleteInteractor = void 0;
24
24
  __exportStar(require("./constants"), exports);
25
25
  __exportStar(require("./types/heartwood.types"), exports);
26
26
  __exportStar(require("./utilities/removeUniversalViewOptions"), exports);
@@ -134,6 +134,12 @@ var buildForm_1 = require("./builders/buildForm");
134
134
  Object.defineProperty(exports, "buildForm", { enumerable: true, get: function () { return __importDefault(buildForm_1).default; } });
135
135
  var buildSkillView_1 = require("./builders/buildSkillView");
136
136
  Object.defineProperty(exports, "buildSkillView", { enumerable: true, get: function () { return __importDefault(buildSkillView_1).default; } });
137
+ var WebRtcStreamer_1 = require("./webRtcStreaming/WebRtcStreamer");
138
+ Object.defineProperty(exports, "WebRtcStreamerImpl", { enumerable: true, get: function () { return __importDefault(WebRtcStreamer_1).default; } });
139
+ var WebRtcConnection_1 = require("./webRtcStreaming/WebRtcConnection");
140
+ Object.defineProperty(exports, "WebRtcConnection", { enumerable: true, get: function () { return __importDefault(WebRtcConnection_1).default; } });
141
+ var MockRtcPeerConnection_1 = require("./tests/MockRtcPeerConnection");
142
+ Object.defineProperty(exports, "MocRtcPeerConnection", { enumerable: true, get: function () { return __importDefault(MockRtcPeerConnection_1).default; } });
137
143
  var calendarEventColors_schema_1 = require("./.spruce/schemas/heartwoodViewControllers/v2021_02_11/calendarEventColors.schema");
138
144
  Object.defineProperty(exports, "calendarEventColorsSchema", { enumerable: true, get: function () { return __importDefault(calendarEventColors_schema_1).default; } });
139
145
  var bigForm_schema_1 = require("./.spruce/schemas/heartwoodViewControllers/v2021_02_11/bigForm.schema");
@@ -29531,6 +29531,12 @@ declare const _default: {
29531
29531
  };
29532
29532
  };
29533
29533
  };
29534
+ webRtcStreamer: {
29535
+ type: "raw";
29536
+ options: {
29537
+ valueType: string;
29538
+ };
29539
+ };
29534
29540
  alignment: {
29535
29541
  type: "select";
29536
29542
  label: string;
@@ -22495,6 +22495,12 @@ declare const _default: {
22495
22495
  };
22496
22496
  };
22497
22497
  };
22498
+ webRtcStreamer: {
22499
+ type: "raw";
22500
+ options: {
22501
+ valueType: string;
22502
+ };
22503
+ };
22498
22504
  alignment: {
22499
22505
  type: "select";
22500
22506
  label: string;
@@ -22445,6 +22445,12 @@ declare const _default: {
22445
22445
  };
22446
22446
  };
22447
22447
  };
22448
+ webRtcStreamer: {
22449
+ type: "raw";
22450
+ options: {
22451
+ valueType: string;
22452
+ };
22453
+ };
22448
22454
  alignment: {
22449
22455
  type: "select";
22450
22456
  label: string;
@@ -244,6 +244,12 @@ exports.default = (0, schema_1.buildSchema)({
244
244
  }),
245
245
  },
246
246
  },
247
+ webRtcStreamer: {
248
+ type: 'raw',
249
+ options: {
250
+ valueType: 'HeartwoodTypes.WebRtcStreamer',
251
+ },
252
+ },
247
253
  alignment: {
248
254
  type: 'select',
249
255
  label: 'Alignment',
@@ -29562,6 +29562,12 @@ declare const _default: {
29562
29562
  };
29563
29563
  };
29564
29564
  };
29565
+ webRtcStreamer: {
29566
+ type: "raw";
29567
+ options: {
29568
+ valueType: string;
29569
+ };
29570
+ };
29565
29571
  alignment: {
29566
29572
  type: "select";
29567
29573
  label: string;
@@ -29542,6 +29542,12 @@ declare const _default: {
29542
29542
  };
29543
29543
  };
29544
29544
  };
29545
+ webRtcStreamer: {
29546
+ type: "raw";
29547
+ options: {
29548
+ valueType: string;
29549
+ };
29550
+ };
29545
29551
  alignment: {
29546
29552
  type: "select";
29547
29553
  label: string;
@@ -29587,6 +29587,12 @@ declare const _default: {
29587
29587
  };
29588
29588
  };
29589
29589
  };
29590
+ webRtcStreamer: {
29591
+ type: "raw";
29592
+ options: {
29593
+ valueType: string;
29594
+ };
29595
+ };
29590
29596
  alignment: {
29591
29597
  type: "select";
29592
29598
  label: string;
@@ -29581,6 +29581,12 @@ declare const _default: {
29581
29581
  };
29582
29582
  };
29583
29583
  };
29584
+ webRtcStreamer: {
29585
+ type: "raw";
29586
+ options: {
29587
+ valueType: string;
29588
+ };
29589
+ };
29584
29590
  alignment: {
29585
29591
  type: "select";
29586
29592
  label: string;
@@ -29603,6 +29603,12 @@ declare const _default: {
29603
29603
  };
29604
29604
  };
29605
29605
  };
29606
+ webRtcStreamer: {
29607
+ type: "raw";
29608
+ options: {
29609
+ valueType: string;
29610
+ };
29611
+ };
29606
29612
  alignment: {
29607
29613
  type: "select";
29608
29614
  label: string;
@@ -0,0 +1,64 @@
1
+ export default class MocRtcPeerConnection implements RTCPeerConnection {
2
+ static instance: MocRtcPeerConnection;
3
+ private constructorOptions?;
4
+ private offerOptions?;
5
+ offer: RTCSessionDescription;
6
+ private lastAddedEventListener?;
7
+ constructor(options?: RTCConfiguration);
8
+ assertGeneratedOfferEquals(offer: RTCSessionDescriptionInit): void;
9
+ assertCreatedWithOptions(expected: {
10
+ sdpSemantics: string;
11
+ iceServers: never[];
12
+ }): void;
13
+ assertCalledCreateOfferWith(expected: RTCOfferOptions): void;
14
+ assertSetsResponseToConnectionLocalDescription(): void;
15
+ assertSetAnswerEquals(options: {
16
+ type: string;
17
+ sdp: string;
18
+ }): void;
19
+ assertTrackListenerSet(expected: () => void): void;
20
+ canTrickleIceCandidates: boolean | null;
21
+ connectionState: RTCPeerConnectionState;
22
+ currentLocalDescription: RTCSessionDescription | null;
23
+ currentRemoteDescription: RTCSessionDescription | null;
24
+ iceConnectionState: RTCIceConnectionState;
25
+ iceGatheringState: RTCIceGatheringState;
26
+ localDescription: RTCSessionDescription | null;
27
+ onconnectionstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null;
28
+ ondatachannel: ((this: RTCPeerConnection, ev: RTCDataChannelEvent) => any) | null;
29
+ onicecandidate: ((this: RTCPeerConnection, ev: RTCPeerConnectionIceEvent) => any) | null;
30
+ onicecandidateerror: ((this: RTCPeerConnection, ev: RTCPeerConnectionIceErrorEvent) => any) | null;
31
+ oniceconnectionstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null;
32
+ onicegatheringstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null;
33
+ onnegotiationneeded: ((this: RTCPeerConnection, ev: Event) => any) | null;
34
+ onsignalingstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null;
35
+ ontrack: ((this: RTCPeerConnection, ev: RTCTrackEvent) => any) | null;
36
+ pendingLocalDescription: RTCSessionDescription | null;
37
+ pendingRemoteDescription: RTCSessionDescription | null;
38
+ remoteDescription: RTCSessionDescription | null;
39
+ sctp: RTCSctpTransport | null;
40
+ signalingState: RTCSignalingState;
41
+ addIceCandidate(_candidate?: unknown, _successCallback?: unknown, _failureCallback?: unknown): Promise<void>;
42
+ addTrack(_track: unknown, ..._streams: unknown[]): RTCRtpSender;
43
+ addTransceiver(_trackOrKind: unknown, _init?: unknown): RTCRtpTransceiver;
44
+ close(): void;
45
+ createAnswer(_successCallback?: unknown, _failureCallback?: unknown): Promise<void> | Promise<RTCSessionDescriptionInit>;
46
+ createDataChannel(_label: unknown, _dataChannelDict?: unknown): RTCDataChannel;
47
+ createOffer(options?: RTCOfferOptions): Promise<any>;
48
+ getConfiguration(): RTCConfiguration;
49
+ getReceivers(): RTCRtpReceiver[];
50
+ getSenders(): RTCRtpSender[];
51
+ getStats(_selector?: unknown, _successCallback?: unknown, _failureCallback?: unknown): Promise<void>;
52
+ getTransceivers(): RTCRtpTransceiver[];
53
+ removeTrack(): void;
54
+ restartIce(): void;
55
+ setConfiguration(_configuration?: unknown): void;
56
+ setLocalDescription(description?: RTCLocalSessionDescriptionInit): Promise<void>;
57
+ setRemoteDescription(description: {
58
+ type: 'answer';
59
+ sdp: string;
60
+ }): Promise<void>;
61
+ addEventListener(type: unknown, listener: unknown, _options?: unknown): void;
62
+ removeEventListener(_type: unknown, _listener: unknown, _options?: unknown): void;
63
+ dispatchEvent(_event: Event): boolean;
64
+ }
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const test_utils_1 = require("@sprucelabs/test-utils");
4
+ class MocRtcPeerConnection {
5
+ constructor(options) {
6
+ this.offer = {
7
+ [(0, test_utils_1.generateId)()]: (0, test_utils_1.generateId)(),
8
+ };
9
+ this.canTrickleIceCandidates = null;
10
+ this.connectionState = {};
11
+ this.currentLocalDescription = null;
12
+ this.currentRemoteDescription = null;
13
+ this.iceConnectionState = {};
14
+ this.iceGatheringState = {};
15
+ this.localDescription = null;
16
+ this.onconnectionstatechange = null;
17
+ this.ondatachannel = null;
18
+ this.onicecandidate = null;
19
+ this.onicecandidateerror = null;
20
+ this.oniceconnectionstatechange = null;
21
+ this.onicegatheringstatechange = null;
22
+ this.onnegotiationneeded = null;
23
+ this.onsignalingstatechange = null;
24
+ this.ontrack = null;
25
+ this.pendingLocalDescription = null;
26
+ this.pendingRemoteDescription = null;
27
+ this.remoteDescription = null;
28
+ this.sctp = null;
29
+ this.signalingState = {};
30
+ MocRtcPeerConnection.instance = this;
31
+ this.constructorOptions = options;
32
+ }
33
+ assertGeneratedOfferEquals(offer) {
34
+ test_utils_1.assert.isEqualDeep(offer, this.offer, 'Did not return the generated offer');
35
+ }
36
+ assertCreatedWithOptions(expected) {
37
+ test_utils_1.assert.isEqualDeep(this.constructorOptions, expected, 'Did not pass default options to peer connection');
38
+ }
39
+ assertCalledCreateOfferWith(expected) {
40
+ test_utils_1.assert.isEqualDeep(this.offerOptions, expected, 'Did not pass expected options to createOffer');
41
+ }
42
+ assertSetsResponseToConnectionLocalDescription() {
43
+ test_utils_1.assert.isEqualDeep(this.offer, this.localDescription, 'Did not set offer to local description');
44
+ }
45
+ assertSetAnswerEquals(options) {
46
+ test_utils_1.assert.isEqualDeep(this.remoteDescription, options, 'Did not set answer to remote description of the peer connection');
47
+ }
48
+ assertTrackListenerSet(expected) {
49
+ test_utils_1.assert.isEqualDeep(this.lastAddedEventListener, {
50
+ eventName: 'track',
51
+ listener: expected,
52
+ }, 'did not call connection.addEventListener with track listener');
53
+ }
54
+ async addIceCandidate(_candidate, _successCallback, _failureCallback) {
55
+ throw new Error('Method not implemented.');
56
+ }
57
+ addTrack(_track, ..._streams) {
58
+ return {};
59
+ }
60
+ addTransceiver(_trackOrKind, _init) {
61
+ return {};
62
+ }
63
+ close() {
64
+ throw new Error('Method not implemented.');
65
+ }
66
+ //@ts-ignore
67
+ createAnswer(_successCallback, _failureCallback) {
68
+ return {};
69
+ }
70
+ createDataChannel(_label, _dataChannelDict) {
71
+ return {};
72
+ }
73
+ //@ts-ignore
74
+ async createOffer(options) {
75
+ this.offerOptions = options;
76
+ return this.offer;
77
+ }
78
+ getConfiguration() {
79
+ return {};
80
+ }
81
+ getReceivers() {
82
+ return [];
83
+ }
84
+ getSenders() {
85
+ return [];
86
+ }
87
+ //@ts-ignore
88
+ async getStats(_selector, _successCallback, _failureCallback) {
89
+ throw new Error('Method not implemented.');
90
+ }
91
+ getTransceivers() {
92
+ return [];
93
+ }
94
+ removeTrack() { }
95
+ restartIce() { }
96
+ setConfiguration(_configuration) { }
97
+ async setLocalDescription(description) {
98
+ this.localDescription = description;
99
+ }
100
+ async setRemoteDescription(description) {
101
+ this.remoteDescription = description;
102
+ }
103
+ addEventListener(type, listener, _options) {
104
+ this.lastAddedEventListener = {
105
+ eventName: type,
106
+ listener,
107
+ };
108
+ }
109
+ removeEventListener(_type, _listener, _options) {
110
+ throw new Error('Method not implemented.');
111
+ }
112
+ dispatchEvent(_event) {
113
+ return true;
114
+ }
115
+ }
116
+ exports.default = MocRtcPeerConnection;
117
+ global.window = {
118
+ //@ts-ignore
119
+ RTCPeerConnection: MocRtcPeerConnection,
120
+ };
@@ -42,6 +42,7 @@ import ToolBeltViewController, { ToolBeltViewControllerOptions } from '../viewCo
42
42
  import ViewControllerFactory from '../viewControllers/ViewControllerFactory';
43
43
  export * from './calendar.types';
44
44
  import '@sprucelabs/mercury-core-events';
45
+ import WebRtcStreamingCardViewController, { WebRtcStreamingCardViewControllerOptions } from '../viewControllers/webRtcStreaming/WebRtcStreamingCard.vc';
45
46
  export { default as MapViewController } from '../viewControllers/Map.vc';
46
47
  export type ErrorHandler = (message: string) => void;
47
48
  type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
@@ -254,6 +255,7 @@ export type LayoutStyle = NonNullable<SpruceSchemas.HeartwoodViewControllers.v20
254
255
  export type ListColumnWidth = NonNullable<List['columnWidths']>[number];
255
256
  export type TriggerRender = () => void;
256
257
  export type TriggerRenderHandler = () => void;
258
+ export { WebRtcStreamer } from '../webRtcStreaming/WebRtcStreamer';
257
259
  export interface ViewController<ViewModel extends Record<string, any>> {
258
260
  render(): ViewModel;
259
261
  setTriggerRenderHandler: (handler: TriggerRenderHandler) => void;
@@ -383,6 +385,7 @@ export interface ViewControllerMap {
383
385
  'bar-chart': BarChartViewController;
384
386
  'line-graph': LineGraphViewController;
385
387
  'lock-screen': LockScreenSkillViewController;
388
+ 'web-rtc-streaming-card': WebRtcStreamingCardViewController;
386
389
  }
387
390
  export interface ViewControllerOptionsMap {
388
391
  form: FormViewControllerOptions<any>;
@@ -427,6 +430,7 @@ export interface ViewControllerOptionsMap {
427
430
  'bar-chart': BarChartViewControllerOptions;
428
431
  'line-graph': LineGraphViewControllerOptions;
429
432
  'lock-screen': LockScreenSkillViewControllerOptions;
433
+ 'web-rtc-streaming-card': WebRtcStreamingCardViewControllerOptions;
430
434
  }
431
435
  export interface SkillViewControllerMap {
432
436
  }
@@ -0,0 +1,10 @@
1
+ import { CardViewControllerImpl } from '../..';
2
+ import { Card, ViewControllerOptions } from '../../types/heartwood.types';
3
+ import { WebRtcStreamer } from '../../webRtcStreaming/WebRtcStreamer';
4
+ export default class WebRtcStreamingCardViewController extends CardViewControllerImpl {
5
+ static id: string;
6
+ constructor(options: ViewControllerOptions & WebRtcStreamingCardViewControllerOptions);
7
+ setStreamer(streamer: WebRtcStreamer, sectionIdx?: number): void;
8
+ }
9
+ export interface WebRtcStreamingCardViewControllerOptions extends Card {
10
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schema_1 = require("@sprucelabs/schema");
4
+ const __1 = require("../..");
5
+ class WebRtcStreamingCardViewController extends __1.CardViewControllerImpl {
6
+ constructor(options) {
7
+ super(options);
8
+ }
9
+ setStreamer(streamer, sectionIdx = 0) {
10
+ (0, schema_1.assertOptions)({ streamer }, ['streamer']);
11
+ if (this.getTotalSections() === 0) {
12
+ this.addSection({
13
+ webRtcStreamer: streamer,
14
+ });
15
+ }
16
+ else {
17
+ this.updateSection(sectionIdx, {
18
+ webRtcStreamer: streamer,
19
+ });
20
+ }
21
+ }
22
+ }
23
+ WebRtcStreamingCardViewController.id = 'web-rtc-streaming-card';
24
+ exports.default = WebRtcStreamingCardViewController;
@@ -0,0 +1,23 @@
1
+ import WebRtcStreamerImpl from './WebRtcStreamer';
2
+ export default class WebRtcConnection {
3
+ static get RTCPeerConnection(): {
4
+ new (configuration?: RTCConfiguration): RTCPeerConnection;
5
+ prototype: RTCPeerConnection;
6
+ generateCertificate(keygenAlgorithm: AlgorithmIdentifier): Promise<RTCCertificate>;
7
+ };
8
+ static set RTCPeerConnection(value: {
9
+ new (configuration?: RTCConfiguration): RTCPeerConnection;
10
+ prototype: RTCPeerConnection;
11
+ generateCertificate(keygenAlgorithm: AlgorithmIdentifier): Promise<RTCCertificate>;
12
+ });
13
+ static createOffer(options: WebRtcVcPluginCreateOfferOptions): Promise<{
14
+ offerSdp: RTCSessionDescriptionInit;
15
+ streamer: WebRtcStreamerImpl;
16
+ }>;
17
+ }
18
+ export interface WebRtcVcPluginCreateOfferOptions {
19
+ offerOptions: {
20
+ offerToReceiveAudio?: boolean;
21
+ offerToReceiveVideo?: boolean;
22
+ };
23
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const schema_1 = require("@sprucelabs/schema");
7
+ const WebRtcStreamer_1 = __importDefault(require("./WebRtcStreamer"));
8
+ class WebRtcConnection {
9
+ static get RTCPeerConnection() {
10
+ return window.RTCPeerConnection;
11
+ }
12
+ static set RTCPeerConnection(value) {
13
+ window.RTCPeerConnection = value;
14
+ }
15
+ static async createOffer(options) {
16
+ const { offerOptions } = (0, schema_1.assertOptions)(options, ['offerOptions']);
17
+ const connection = new WebRtcConnection.RTCPeerConnection({
18
+ //@ts-ignore
19
+ sdpSemantics: 'unified-plan',
20
+ iceServers: [],
21
+ });
22
+ const offer = await connection.createOffer(offerOptions);
23
+ await connection.setLocalDescription(offer);
24
+ return {
25
+ offerSdp: offer,
26
+ streamer: WebRtcStreamer_1.default.Streamer(connection),
27
+ };
28
+ }
29
+ }
30
+ exports.default = WebRtcConnection;
@@ -0,0 +1,11 @@
1
+ export default class WebRtcStreamerImpl {
2
+ private connection;
3
+ protected constructor(connection: RTCPeerConnection);
4
+ static Streamer(connection: RTCPeerConnection): WebRtcStreamerImpl;
5
+ setAnswer(answerSdp: string): Promise<void>;
6
+ onTrack(cb: (event: RTCTrackEvent) => void): void;
7
+ }
8
+ export interface WebRtcStreamer {
9
+ setAnswer(answerSdp: string): Promise<void>;
10
+ onTrack(cb: (event: RTCTrackEvent) => void): void;
11
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schema_1 = require("@sprucelabs/schema");
4
+ class WebRtcStreamerImpl {
5
+ constructor(connection) {
6
+ this.connection = connection;
7
+ }
8
+ static Streamer(connection) {
9
+ return new WebRtcStreamerImpl(connection);
10
+ }
11
+ async setAnswer(answerSdp) {
12
+ (0, schema_1.assertOptions)({ answerSdp }, ['answerSdp']);
13
+ await this.connection.setRemoteDescription({
14
+ type: 'answer',
15
+ sdp: answerSdp,
16
+ });
17
+ }
18
+ onTrack(cb) {
19
+ this.connection.addEventListener('track', cb);
20
+ }
21
+ }
22
+ exports.default = WebRtcStreamerImpl;
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "sideEffects": false,
14
14
  "license": "MIT",
15
15
  "description": "All the power of Heartwood in one, convenient package.",
16
- "version": "118.0.11",
16
+ "version": "118.0.12",
17
17
  "skill": {
18
18
  "namespace": "HeartwoodViewControllers",
19
19
  "commandOverrides": {