@sprucelabs/heartwood-view-controllers 118.0.26 → 118.0.28
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/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/cardSection.schema.js +2 -2
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/webRtcPlayer.schema.js +5 -0
- package/build/.spruce/schemas/schemas.types.d.ts +11 -3
- package/build/esm/.spruce/schemas/heartwoodViewControllers/v2021_02_11/cardSection.schema.js +2 -2
- package/build/esm/.spruce/schemas/heartwoodViewControllers/v2021_02_11/webRtcPlayer.schema.js +5 -0
- package/build/esm/.spruce/schemas/schemas.types.d.ts +11 -3
- package/build/esm/index.d.ts +4 -2
- package/build/esm/index.js +4 -2
- package/build/esm/schemas/v2021_02_11/cards/card.builder.d.ts +1 -1
- package/build/esm/schemas/v2021_02_11/cards/cardBody.builder.d.ts +1 -1
- package/build/esm/schemas/v2021_02_11/cards/cardSection.builder.d.ts +1 -1
- package/build/esm/schemas/v2021_02_11/cards/cardSection.builder.js +2 -2
- package/build/esm/schemas/v2021_02_11/dialog.builder.d.ts +1 -1
- package/build/esm/schemas/v2021_02_11/layout.builder.d.ts +1 -1
- package/build/esm/schemas/v2021_02_11/lockScreen.builder.d.ts +1 -1
- package/build/esm/schemas/v2021_02_11/skillView.builder.d.ts +1 -1
- package/build/esm/schemas/v2021_02_11/toolBelt.builder.d.ts +1 -1
- package/build/esm/schemas/v2021_02_11/webRtcPlayer.builder.d.ts +6 -0
- package/build/esm/schemas/v2021_02_11/webRtcPlayer.builder.js +6 -0
- package/build/esm/tests/MockRtcPeerConnection.d.ts +7 -4
- package/build/esm/tests/MockRtcPeerConnection.js +18 -4
- package/build/esm/tests/utilities/webRtcAssert.d.ts +6 -0
- package/build/esm/tests/utilities/webRtcAssert.js +22 -0
- package/build/esm/types/heartwood.types.d.ts +1 -0
- package/build/esm/types/heartwood.types.js +1 -0
- package/build/esm/viewControllers/webRtcStreaming/WebRtcPlayer.vc.d.ts +3 -2
- package/build/esm/viewControllers/webRtcStreaming/WebRtcPlayer.vc.js +10 -11
- package/build/esm/webRtcStreaming/WebRtcConnection.d.ts +17 -5
- package/build/esm/webRtcStreaming/WebRtcConnection.js +24 -4
- package/build/esm/webRtcStreaming/WebRtcStreamer.d.ts +5 -3
- package/build/esm/webRtcStreaming/WebRtcStreamer.js +8 -3
- package/build/index.d.ts +4 -2
- package/build/index.js +8 -5
- package/build/schemas/v2021_02_11/cards/card.builder.d.ts +1 -1
- package/build/schemas/v2021_02_11/cards/cardBody.builder.d.ts +1 -1
- package/build/schemas/v2021_02_11/cards/cardSection.builder.d.ts +1 -1
- package/build/schemas/v2021_02_11/cards/cardSection.builder.js +2 -2
- package/build/schemas/v2021_02_11/dialog.builder.d.ts +1 -1
- package/build/schemas/v2021_02_11/layout.builder.d.ts +1 -1
- package/build/schemas/v2021_02_11/lockScreen.builder.d.ts +1 -1
- package/build/schemas/v2021_02_11/skillView.builder.d.ts +1 -1
- package/build/schemas/v2021_02_11/toolBelt.builder.d.ts +1 -1
- package/build/schemas/v2021_02_11/webRtcPlayer.builder.d.ts +6 -0
- package/build/schemas/v2021_02_11/webRtcPlayer.builder.js +6 -0
- package/build/tests/MockRtcPeerConnection.d.ts +7 -4
- package/build/tests/MockRtcPeerConnection.js +18 -5
- package/build/tests/utilities/webRtcAssert.d.ts +6 -0
- package/build/tests/utilities/webRtcAssert.js +27 -0
- package/build/types/heartwood.types.d.ts +1 -0
- package/build/types/heartwood.types.js +1 -0
- package/build/viewControllers/webRtcStreaming/WebRtcPlayer.vc.d.ts +3 -2
- package/build/viewControllers/webRtcStreaming/WebRtcPlayer.vc.js +15 -12
- package/build/webRtcStreaming/WebRtcConnection.d.ts +17 -5
- package/build/webRtcStreaming/WebRtcConnection.js +22 -5
- package/build/webRtcStreaming/WebRtcStreamer.d.ts +5 -3
- package/build/webRtcStreaming/WebRtcStreamer.js +6 -3
- package/package.json +1 -1
|
@@ -217,9 +217,9 @@ const cardSectionSchema = {
|
|
|
217
217
|
options: { schema: portal_schema_1.default, }
|
|
218
218
|
},
|
|
219
219
|
/** . */
|
|
220
|
-
'
|
|
220
|
+
'webRtcPlayer': {
|
|
221
221
|
type: 'raw',
|
|
222
|
-
options: { valueType: `HeartwoodTypes.
|
|
222
|
+
options: { valueType: `HeartwoodTypes.WebRtcPlayer`, }
|
|
223
223
|
},
|
|
224
224
|
/** Alignment. */
|
|
225
225
|
'alignment': {
|
|
@@ -19,6 +19,11 @@ const webRtcPlayerSchema = {
|
|
|
19
19
|
options: { valueType: `HeartwoodTypes.ViewController<HeartwoodTypes.WebRtcPlayer>`, }
|
|
20
20
|
},
|
|
21
21
|
/** . */
|
|
22
|
+
'connection': {
|
|
23
|
+
type: 'raw',
|
|
24
|
+
options: { valueType: `HeartwoodTypes.WebRtcConnection`, }
|
|
25
|
+
},
|
|
26
|
+
/** . */
|
|
22
27
|
'streamer': {
|
|
23
28
|
type: 'raw',
|
|
24
29
|
options: { valueType: `HeartwoodTypes.WebRtcStreamer`, }
|
|
@@ -708,6 +708,7 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
708
708
|
interface WebRtcPlayer {
|
|
709
709
|
'id'?: string | undefined | null;
|
|
710
710
|
'controller'?: (HeartwoodTypes.ViewController<HeartwoodTypes.WebRtcPlayer>) | undefined | null;
|
|
711
|
+
'connection'?: (HeartwoodTypes.WebRtcConnection) | undefined | null;
|
|
711
712
|
'streamer'?: (HeartwoodTypes.WebRtcStreamer) | undefined | null;
|
|
712
713
|
}
|
|
713
714
|
interface WebRtcPlayerSchema extends SpruceSchema.Schema {
|
|
@@ -730,6 +731,13 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
730
731
|
};
|
|
731
732
|
};
|
|
732
733
|
/** . */
|
|
734
|
+
'connection': {
|
|
735
|
+
type: 'raw';
|
|
736
|
+
options: {
|
|
737
|
+
valueType: `HeartwoodTypes.WebRtcConnection`;
|
|
738
|
+
};
|
|
739
|
+
};
|
|
740
|
+
/** . */
|
|
733
741
|
'streamer': {
|
|
734
742
|
type: 'raw';
|
|
735
743
|
options: {
|
|
@@ -7147,7 +7155,7 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
7147
7155
|
'gridSize'?: ("small" | "medium" | "large") | undefined | null;
|
|
7148
7156
|
/** . Will render content in an iframe in the body of the card. */
|
|
7149
7157
|
'portal'?: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Portal | undefined | null;
|
|
7150
|
-
'
|
|
7158
|
+
'webRtcPlayer'?: (HeartwoodTypes.WebRtcPlayer) | undefined | null;
|
|
7151
7159
|
/** Alignment. */
|
|
7152
7160
|
'alignment'?: ("left" | "center" | "right") | undefined | null;
|
|
7153
7161
|
}
|
|
@@ -7399,10 +7407,10 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
7399
7407
|
};
|
|
7400
7408
|
};
|
|
7401
7409
|
/** . */
|
|
7402
|
-
'
|
|
7410
|
+
'webRtcPlayer': {
|
|
7403
7411
|
type: 'raw';
|
|
7404
7412
|
options: {
|
|
7405
|
-
valueType: `HeartwoodTypes.
|
|
7413
|
+
valueType: `HeartwoodTypes.WebRtcPlayer`;
|
|
7406
7414
|
};
|
|
7407
7415
|
};
|
|
7408
7416
|
/** Alignment. */
|
package/build/esm/.spruce/schemas/heartwoodViewControllers/v2021_02_11/cardSection.schema.js
CHANGED
|
@@ -212,9 +212,9 @@ const cardSectionSchema = {
|
|
|
212
212
|
options: { schema: portalSchema_v2021_02_11, }
|
|
213
213
|
},
|
|
214
214
|
/** . */
|
|
215
|
-
'
|
|
215
|
+
'webRtcPlayer': {
|
|
216
216
|
type: 'raw',
|
|
217
|
-
options: { valueType: `HeartwoodTypes.
|
|
217
|
+
options: { valueType: `HeartwoodTypes.WebRtcPlayer`, }
|
|
218
218
|
},
|
|
219
219
|
/** Alignment. */
|
|
220
220
|
'alignment': {
|
package/build/esm/.spruce/schemas/heartwoodViewControllers/v2021_02_11/webRtcPlayer.schema.js
CHANGED
|
@@ -17,6 +17,11 @@ const webRtcPlayerSchema = {
|
|
|
17
17
|
options: { valueType: `HeartwoodTypes.ViewController<HeartwoodTypes.WebRtcPlayer>`, }
|
|
18
18
|
},
|
|
19
19
|
/** . */
|
|
20
|
+
'connection': {
|
|
21
|
+
type: 'raw',
|
|
22
|
+
options: { valueType: `HeartwoodTypes.WebRtcConnection`, }
|
|
23
|
+
},
|
|
24
|
+
/** . */
|
|
20
25
|
'streamer': {
|
|
21
26
|
type: 'raw',
|
|
22
27
|
options: { valueType: `HeartwoodTypes.WebRtcStreamer`, }
|
|
@@ -708,6 +708,7 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
708
708
|
interface WebRtcPlayer {
|
|
709
709
|
'id'?: string | undefined | null;
|
|
710
710
|
'controller'?: (HeartwoodTypes.ViewController<HeartwoodTypes.WebRtcPlayer>) | undefined | null;
|
|
711
|
+
'connection'?: (HeartwoodTypes.WebRtcConnection) | undefined | null;
|
|
711
712
|
'streamer'?: (HeartwoodTypes.WebRtcStreamer) | undefined | null;
|
|
712
713
|
}
|
|
713
714
|
interface WebRtcPlayerSchema extends SpruceSchema.Schema {
|
|
@@ -730,6 +731,13 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
730
731
|
};
|
|
731
732
|
};
|
|
732
733
|
/** . */
|
|
734
|
+
'connection': {
|
|
735
|
+
type: 'raw';
|
|
736
|
+
options: {
|
|
737
|
+
valueType: `HeartwoodTypes.WebRtcConnection`;
|
|
738
|
+
};
|
|
739
|
+
};
|
|
740
|
+
/** . */
|
|
733
741
|
'streamer': {
|
|
734
742
|
type: 'raw';
|
|
735
743
|
options: {
|
|
@@ -7147,7 +7155,7 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
7147
7155
|
'gridSize'?: ("small" | "medium" | "large") | undefined | null;
|
|
7148
7156
|
/** . Will render content in an iframe in the body of the card. */
|
|
7149
7157
|
'portal'?: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Portal | undefined | null;
|
|
7150
|
-
'
|
|
7158
|
+
'webRtcPlayer'?: (HeartwoodTypes.WebRtcPlayer) | undefined | null;
|
|
7151
7159
|
/** Alignment. */
|
|
7152
7160
|
'alignment'?: ("left" | "center" | "right") | undefined | null;
|
|
7153
7161
|
}
|
|
@@ -7399,10 +7407,10 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
|
7399
7407
|
};
|
|
7400
7408
|
};
|
|
7401
7409
|
/** . */
|
|
7402
|
-
'
|
|
7410
|
+
'webRtcPlayer': {
|
|
7403
7411
|
type: 'raw';
|
|
7404
7412
|
options: {
|
|
7405
|
-
valueType: `HeartwoodTypes.
|
|
7413
|
+
valueType: `HeartwoodTypes.WebRtcPlayer`;
|
|
7406
7414
|
};
|
|
7407
7415
|
};
|
|
7408
7416
|
/** Alignment. */
|
package/build/esm/index.d.ts
CHANGED
|
@@ -69,8 +69,9 @@ export { default as buildBigForm } from './builders/buildBigForm';
|
|
|
69
69
|
export { default as buildForm } from './builders/buildForm';
|
|
70
70
|
export { default as buildSkillView } from './builders/buildSkillView';
|
|
71
71
|
export { WebRtcStreamer, default as WebRtcStreamerImpl, } from './webRtcStreaming/WebRtcStreamer';
|
|
72
|
-
export { default as
|
|
73
|
-
export { default as
|
|
72
|
+
export { default as MockRtcPeerConnection } from './tests/MockRtcPeerConnection';
|
|
73
|
+
export { default as WebRtcConnectionImpl } from './webRtcStreaming/WebRtcConnection';
|
|
74
|
+
export * from './webRtcStreaming/WebRtcConnection';
|
|
74
75
|
export { default as calendarEventColorsSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/calendarEventColors.schema';
|
|
75
76
|
export { default as bigFormSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/bigForm.schema';
|
|
76
77
|
export { default as skillViewSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/skillView.schema';
|
|
@@ -173,6 +174,7 @@ export { default as buttonAssert } from './tests/utilities/buttonAssert';
|
|
|
173
174
|
export { default as listAssert } from './tests/utilities/listAssert';
|
|
174
175
|
export { default as autocompleteAssert } from './tests/utilities/autocompleteAssert';
|
|
175
176
|
export { default as formAssert } from './tests/utilities/formAssert';
|
|
177
|
+
export { default as webRtcAssert } from './tests/utilities/webRtcAssert';
|
|
176
178
|
export { default as autocompleteInteractor } from './tests/utilities/autocompleteInteractor';
|
|
177
179
|
export { normalizeScopeFromVc } from './tests/utilities/vcAssert';
|
|
178
180
|
export { default as interactor } from './tests/utilities/interactor';
|
package/build/esm/index.js
CHANGED
|
@@ -68,8 +68,9 @@ export { default as buildBigForm } from './builders/buildBigForm.js';
|
|
|
68
68
|
export { default as buildForm } from './builders/buildForm.js';
|
|
69
69
|
export { default as buildSkillView } from './builders/buildSkillView.js';
|
|
70
70
|
export { default as WebRtcStreamerImpl, } from './webRtcStreaming/WebRtcStreamer.js';
|
|
71
|
-
export { default as
|
|
72
|
-
export { default as
|
|
71
|
+
export { default as MockRtcPeerConnection } from './tests/MockRtcPeerConnection.js';
|
|
72
|
+
export { default as WebRtcConnectionImpl } from './webRtcStreaming/WebRtcConnection.js';
|
|
73
|
+
export * from './webRtcStreaming/WebRtcConnection.js';
|
|
73
74
|
export { default as calendarEventColorsSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/calendarEventColors.schema.js';
|
|
74
75
|
export { default as bigFormSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/bigForm.schema.js';
|
|
75
76
|
export { default as skillViewSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/skillView.schema.js';
|
|
@@ -172,6 +173,7 @@ export { default as buttonAssert } from './tests/utilities/buttonAssert.js';
|
|
|
172
173
|
export { default as listAssert } from './tests/utilities/listAssert.js';
|
|
173
174
|
export { default as autocompleteAssert } from './tests/utilities/autocompleteAssert.js';
|
|
174
175
|
export { default as formAssert } from './tests/utilities/formAssert.js';
|
|
176
|
+
export { default as webRtcAssert } from './tests/utilities/webRtcAssert.js';
|
|
175
177
|
export { default as autocompleteInteractor } from './tests/utilities/autocompleteInteractor.js';
|
|
176
178
|
export { normalizeScopeFromVc } from './tests/utilities/vcAssert.js';
|
|
177
179
|
export { default as interactor } from './tests/utilities/interactor.js';
|
|
@@ -29531,7 +29531,7 @@ declare const _default: {
|
|
|
29531
29531
|
};
|
|
29532
29532
|
};
|
|
29533
29533
|
};
|
|
29534
|
-
|
|
29534
|
+
webRtcPlayer: {
|
|
29535
29535
|
type: "raw";
|
|
29536
29536
|
options: {
|
|
29537
29537
|
valueType: string;
|
|
@@ -22495,7 +22495,7 @@ declare const _default: {
|
|
|
22495
22495
|
};
|
|
22496
22496
|
};
|
|
22497
22497
|
};
|
|
22498
|
-
|
|
22498
|
+
webRtcPlayer: {
|
|
22499
22499
|
type: "raw";
|
|
22500
22500
|
options: {
|
|
22501
22501
|
valueType: string;
|
|
@@ -22445,7 +22445,7 @@ declare const _default: {
|
|
|
22445
22445
|
};
|
|
22446
22446
|
};
|
|
22447
22447
|
};
|
|
22448
|
-
|
|
22448
|
+
webRtcPlayer: {
|
|
22449
22449
|
type: "raw";
|
|
22450
22450
|
options: {
|
|
22451
22451
|
valueType: string;
|
|
@@ -239,10 +239,10 @@ export default buildSchema({
|
|
|
239
239
|
}),
|
|
240
240
|
},
|
|
241
241
|
},
|
|
242
|
-
|
|
242
|
+
webRtcPlayer: {
|
|
243
243
|
type: 'raw',
|
|
244
244
|
options: {
|
|
245
|
-
valueType: 'HeartwoodTypes.
|
|
245
|
+
valueType: 'HeartwoodTypes.WebRtcPlayer',
|
|
246
246
|
},
|
|
247
247
|
},
|
|
248
248
|
alignment: {
|
|
@@ -29562,7 +29562,7 @@ declare const _default: {
|
|
|
29562
29562
|
};
|
|
29563
29563
|
};
|
|
29564
29564
|
};
|
|
29565
|
-
|
|
29565
|
+
webRtcPlayer: {
|
|
29566
29566
|
type: "raw";
|
|
29567
29567
|
options: {
|
|
29568
29568
|
valueType: string;
|
|
@@ -29542,7 +29542,7 @@ declare const _default: {
|
|
|
29542
29542
|
};
|
|
29543
29543
|
};
|
|
29544
29544
|
};
|
|
29545
|
-
|
|
29545
|
+
webRtcPlayer: {
|
|
29546
29546
|
type: "raw";
|
|
29547
29547
|
options: {
|
|
29548
29548
|
valueType: string;
|
|
@@ -29587,7 +29587,7 @@ declare const _default: {
|
|
|
29587
29587
|
};
|
|
29588
29588
|
};
|
|
29589
29589
|
};
|
|
29590
|
-
|
|
29590
|
+
webRtcPlayer: {
|
|
29591
29591
|
type: "raw";
|
|
29592
29592
|
options: {
|
|
29593
29593
|
valueType: string;
|
|
@@ -29581,7 +29581,7 @@ declare const _default: {
|
|
|
29581
29581
|
};
|
|
29582
29582
|
};
|
|
29583
29583
|
};
|
|
29584
|
-
|
|
29584
|
+
webRtcPlayer: {
|
|
29585
29585
|
type: "raw";
|
|
29586
29586
|
options: {
|
|
29587
29587
|
valueType: string;
|
|
@@ -29603,7 +29603,7 @@ declare const _default: {
|
|
|
29603
29603
|
};
|
|
29604
29604
|
};
|
|
29605
29605
|
};
|
|
29606
|
-
|
|
29606
|
+
webRtcPlayer: {
|
|
29607
29607
|
type: "raw";
|
|
29608
29608
|
options: {
|
|
29609
29609
|
valueType: string;
|
|
@@ -11,6 +11,12 @@ export default buildSchema({
|
|
|
11
11
|
valueType: 'HeartwoodTypes.ViewController<HeartwoodTypes.WebRtcPlayer>',
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
|
+
connection: {
|
|
15
|
+
type: 'raw',
|
|
16
|
+
options: {
|
|
17
|
+
valueType: 'HeartwoodTypes.WebRtcConnection',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
14
20
|
streamer: {
|
|
15
21
|
type: 'raw',
|
|
16
22
|
options: {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export default class
|
|
2
|
-
static instance:
|
|
1
|
+
export default class MockRtcPeerConnection implements RTCPeerConnection {
|
|
2
|
+
static instance: MockRtcPeerConnection;
|
|
3
|
+
private static onCreateOfferHandler?;
|
|
3
4
|
private constructorOptions?;
|
|
4
5
|
private offerOptions?;
|
|
5
6
|
offer: RTCSessionDescription;
|
|
6
7
|
private lastAddedEventListener?;
|
|
7
8
|
constructor(options?: RTCConfiguration);
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
assertCreatedOfferEquals(offer: RTCSessionDescriptionInit): void;
|
|
10
|
+
assertCreatedOfferSdpEquals(sdp: string): void;
|
|
10
11
|
assertCreatedWithOptions(expected: {
|
|
11
12
|
sdpSemantics: string;
|
|
12
13
|
iceServers: never[];
|
|
@@ -18,6 +19,8 @@ export default class MocRtcPeerConnection implements RTCPeerConnection {
|
|
|
18
19
|
sdp: string;
|
|
19
20
|
}): void;
|
|
20
21
|
assertTrackListenerSet(expected: () => void): void;
|
|
22
|
+
static onCreateOffer(cb?: () => void): void;
|
|
23
|
+
emitTrackAdded(): void;
|
|
21
24
|
canTrickleIceCandidates: boolean | null;
|
|
22
25
|
connectionState: RTCPeerConnectionState;
|
|
23
26
|
currentLocalDescription: RTCSessionDescription | null;
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { assert, generateId } from '@sprucelabs/test-utils';
|
|
11
|
-
export default class
|
|
11
|
+
export default class MockRtcPeerConnection {
|
|
12
12
|
constructor(options) {
|
|
13
13
|
this.offer = {
|
|
14
14
|
[generateId()]: generateId(),
|
|
@@ -34,13 +34,13 @@ export default class MocRtcPeerConnection {
|
|
|
34
34
|
this.remoteDescription = null;
|
|
35
35
|
this.sctp = null;
|
|
36
36
|
this.signalingState = {};
|
|
37
|
-
|
|
37
|
+
MockRtcPeerConnection.instance = this;
|
|
38
38
|
this.constructorOptions = options;
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
assertCreatedOfferEquals(offer) {
|
|
41
41
|
assert.isEqualDeep(offer, this.offer, 'Did not return the generated offer');
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
assertCreatedOfferSdpEquals(sdp) {
|
|
44
44
|
assert.isEqualDeep(this.offer.sdp, sdp, 'Did not return the generated offer sdp');
|
|
45
45
|
}
|
|
46
46
|
assertCreatedWithOptions(expected) {
|
|
@@ -61,6 +61,18 @@ export default class MocRtcPeerConnection {
|
|
|
61
61
|
listener: expected,
|
|
62
62
|
}, 'did not call connection.addEventListener with track listener');
|
|
63
63
|
}
|
|
64
|
+
static onCreateOffer(cb) {
|
|
65
|
+
this.onCreateOfferHandler = cb;
|
|
66
|
+
}
|
|
67
|
+
emitTrackAdded() {
|
|
68
|
+
const lastListener = this.lastAddedEventListener;
|
|
69
|
+
if ((lastListener === null || lastListener === void 0 ? void 0 : lastListener.eventName) === 'track') {
|
|
70
|
+
lastListener.listener({});
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
assert.fail('Did not call connection.addEventListener with track listener');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
64
76
|
addIceCandidate(_candidate, _successCallback, _failureCallback) {
|
|
65
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
78
|
throw new Error('Method not implemented.');
|
|
@@ -86,7 +98,9 @@ export default class MocRtcPeerConnection {
|
|
|
86
98
|
//@ts-ignore
|
|
87
99
|
createOffer(options) {
|
|
88
100
|
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
var _a;
|
|
89
102
|
this.offerOptions = options;
|
|
103
|
+
(_a = MockRtcPeerConnection.onCreateOfferHandler) === null || _a === void 0 ? void 0 : _a.call(MockRtcPeerConnection);
|
|
90
104
|
return this.offer;
|
|
91
105
|
});
|
|
92
106
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ViewController, Card } from '../../types/heartwood.types';
|
|
2
|
+
import WebRtcPlayerViewController from '../../viewControllers/webRtcStreaming/WebRtcPlayer.vc';
|
|
3
|
+
declare const webRtcAssert: {
|
|
4
|
+
cardRendersPlayer: (vc: ViewController<Card>, id?: string) => WebRtcPlayerViewController;
|
|
5
|
+
};
|
|
6
|
+
export default webRtcAssert;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { assertOptions } from '@sprucelabs/schema';
|
|
2
|
+
import { assert } from '@sprucelabs/test-utils';
|
|
3
|
+
import renderUtil from '../../utilities/render.utility.js';
|
|
4
|
+
import { pluckAllFromView } from './assertSupport.js';
|
|
5
|
+
const webRtcAssert = {
|
|
6
|
+
cardRendersPlayer: (vc, id) => {
|
|
7
|
+
assertOptions({ vc }, ['vc']);
|
|
8
|
+
const model = renderUtil.render(vc);
|
|
9
|
+
const players = pluckAllFromView(model, 'webRtcPlayer');
|
|
10
|
+
assert.isAbove(players.length, 0, `Your card is not rendering a webrtc player!. Try:\n\nthis.player = this.Controller('web-rtc-player', {})\nthis.cardVc = this.Controller('card', { webRtcPlayer: this.player.render() })`);
|
|
11
|
+
if (id) {
|
|
12
|
+
for (const player of players) {
|
|
13
|
+
if ((player === null || player === void 0 ? void 0 : player.id) === id) {
|
|
14
|
+
return player.controller;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
assert.fail(`I could not find a webRtcPlayerViewController with the id: "${id}"`);
|
|
18
|
+
}
|
|
19
|
+
return players[0].controller;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export default webRtcAssert;
|
|
@@ -257,6 +257,7 @@ export type ListColumnWidth = NonNullable<List['columnWidths']>[number];
|
|
|
257
257
|
export type TriggerRender = () => void;
|
|
258
258
|
export type TriggerRenderHandler = () => void;
|
|
259
259
|
export { WebRtcStreamer } from '../webRtcStreaming/WebRtcStreamer';
|
|
260
|
+
export * from '../webRtcStreaming/WebRtcConnection';
|
|
260
261
|
export interface ViewController<ViewModel extends Record<string, any>> {
|
|
261
262
|
render(): ViewModel;
|
|
262
263
|
setTriggerRenderHandler: (handler: TriggerRenderHandler) => void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { AbstractViewController } from '../..';
|
|
2
1
|
import { ViewControllerOptions, WebRtcPlayer } from '../../types/heartwood.types';
|
|
3
2
|
import { WebRtcStreamer } from '../../webRtcStreaming/WebRtcStreamer';
|
|
3
|
+
import AbstractViewController from '../Abstract.vc';
|
|
4
4
|
export default class WebRtcPlayerViewController extends AbstractViewController<WebRtcPlayer> {
|
|
5
5
|
static id: string;
|
|
6
|
-
private
|
|
6
|
+
private model;
|
|
7
|
+
private connection;
|
|
7
8
|
constructor(options: ViewControllerOptions & WebRtcPlayerOptions);
|
|
8
9
|
setStreamer(streamer: WebRtcStreamer): void;
|
|
9
10
|
createOffer(offerOptions: RTCOfferOptions): Promise<string>;
|
|
@@ -8,22 +8,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { assertOptions } from '@sprucelabs/schema';
|
|
11
|
-
import { AbstractViewController, WebRtcConnection } from '../../index.js';
|
|
12
11
|
import SpruceError from '../../errors/SpruceError.js';
|
|
12
|
+
import removeUniversalViewOptions from '../../utilities/removeUniversalViewOptions.js';
|
|
13
|
+
import WebRtcConnectionImpl from '../../webRtcStreaming/WebRtcConnection.js';
|
|
14
|
+
import AbstractViewController from '../Abstract.vc.js';
|
|
13
15
|
class WebRtcPlayerViewController extends AbstractViewController {
|
|
14
16
|
constructor(options) {
|
|
15
17
|
super(options);
|
|
16
|
-
|
|
17
|
-
this.
|
|
18
|
+
this.connection = WebRtcConnectionImpl.Connection();
|
|
19
|
+
this.model = Object.assign(Object.assign({ connection: this.connection }, removeUniversalViewOptions(options)), { controller: this });
|
|
18
20
|
}
|
|
19
21
|
setStreamer(streamer) {
|
|
20
22
|
assertOptions({ streamer }, ['streamer']);
|
|
21
|
-
this.streamer = streamer;
|
|
23
|
+
this.model.streamer = streamer;
|
|
22
24
|
this.triggerRender();
|
|
23
25
|
}
|
|
24
26
|
createOffer(offerOptions) {
|
|
25
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const { offerSdp, streamer } = yield
|
|
28
|
+
const { offerSdp, streamer } = yield this.connection.createOffer({
|
|
27
29
|
offerOptions,
|
|
28
30
|
});
|
|
29
31
|
this.setStreamer(streamer);
|
|
@@ -32,19 +34,16 @@ class WebRtcPlayerViewController extends AbstractViewController {
|
|
|
32
34
|
}
|
|
33
35
|
setAnswer(answerSdp) {
|
|
34
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
if (!this.streamer) {
|
|
37
|
+
if (!this.model.streamer) {
|
|
36
38
|
throw new SpruceError({
|
|
37
39
|
code: 'DID_NOT_GENERATE_OFFER',
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
|
-
yield this.streamer.setAnswer(answerSdp);
|
|
42
|
+
yield this.model.streamer.setAnswer(answerSdp);
|
|
41
43
|
});
|
|
42
44
|
}
|
|
43
45
|
render() {
|
|
44
|
-
return
|
|
45
|
-
streamer: this.streamer,
|
|
46
|
-
controller: this,
|
|
47
|
-
};
|
|
46
|
+
return this.model;
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
WebRtcPlayerViewController.id = 'web-rtc-player-card';
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import MockRtcPeerConnection from '../tests/MockRtcPeerConnection';
|
|
2
2
|
import { WebRtcStreamer } from './WebRtcStreamer';
|
|
3
|
-
export default class WebRtcConnection {
|
|
3
|
+
export default class WebRtcConnectionImpl implements WebRtcConnection {
|
|
4
|
+
static Class: new () => WebRtcConnection;
|
|
4
5
|
static get RTCPeerConnection(): new (config: RTCConfiguration) => RTCPeerConnection | MockRtcPeerConnection;
|
|
5
6
|
static set RTCPeerConnection(value: new (config: RTCConfiguration) => RTCPeerConnection | MockRtcPeerConnection);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
private stateChangeHandlers;
|
|
8
|
+
static Connection(): WebRtcConnection;
|
|
9
|
+
createOffer(options: WebRtcVcPluginCreateOfferOptions): Promise<WebRtcCreateOfferResponse>;
|
|
10
|
+
private emitStateChange;
|
|
11
|
+
onStateChange(cb: WebRtcStateChangeHandler): void;
|
|
10
12
|
}
|
|
11
13
|
export interface WebRtcVcPluginCreateOfferOptions {
|
|
12
14
|
offerOptions: {
|
|
@@ -14,3 +16,13 @@ export interface WebRtcVcPluginCreateOfferOptions {
|
|
|
14
16
|
offerToReceiveVideo?: boolean;
|
|
15
17
|
};
|
|
16
18
|
}
|
|
19
|
+
export type WebRtcConnectionState = 'createdOffer' | 'suppliedAnswer' | 'trackAdded';
|
|
20
|
+
export type WebRtcStateChangeHandler = (state: WebRtcConnectionState) => void | Promise<void>;
|
|
21
|
+
export interface WebRtcConnection {
|
|
22
|
+
createOffer(options: WebRtcVcPluginCreateOfferOptions): Promise<WebRtcCreateOfferResponse>;
|
|
23
|
+
onStateChange(cb: WebRtcStateChangeHandler): void;
|
|
24
|
+
}
|
|
25
|
+
export interface WebRtcCreateOfferResponse {
|
|
26
|
+
offerSdp: RTCSessionDescriptionInit;
|
|
27
|
+
streamer: WebRtcStreamer;
|
|
28
|
+
}
|
|
@@ -9,27 +9,47 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { assertOptions } from '@sprucelabs/schema';
|
|
11
11
|
import WebRtcStreamerImpl from './WebRtcStreamer.js';
|
|
12
|
-
export default class
|
|
12
|
+
export default class WebRtcConnectionImpl {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.stateChangeHandlers = [];
|
|
15
|
+
}
|
|
13
16
|
static get RTCPeerConnection() {
|
|
14
17
|
return window.RTCPeerConnection;
|
|
15
18
|
}
|
|
16
19
|
static set RTCPeerConnection(value) {
|
|
17
20
|
global.window.RTCPeerConnection = value;
|
|
18
21
|
}
|
|
19
|
-
static
|
|
22
|
+
static Connection() {
|
|
23
|
+
var _a;
|
|
24
|
+
return new ((_a = this.Class) !== null && _a !== void 0 ? _a : this)();
|
|
25
|
+
}
|
|
26
|
+
createOffer(options) {
|
|
20
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
28
|
const { offerOptions } = assertOptions(options, ['offerOptions']);
|
|
22
|
-
const connection = new
|
|
29
|
+
const connection = new WebRtcConnectionImpl.RTCPeerConnection({
|
|
23
30
|
//@ts-ignore
|
|
24
31
|
sdpSemantics: 'unified-plan',
|
|
25
32
|
iceServers: [],
|
|
26
33
|
});
|
|
27
34
|
const offer = yield connection.createOffer(offerOptions);
|
|
28
35
|
yield connection.setLocalDescription(offer);
|
|
36
|
+
void this.emitStateChange('createdOffer');
|
|
29
37
|
return {
|
|
30
38
|
offerSdp: offer,
|
|
31
|
-
streamer: WebRtcStreamerImpl.Streamer(connection),
|
|
39
|
+
streamer: WebRtcStreamerImpl.Streamer(connection, (status) => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
yield this.emitStateChange(status);
|
|
41
|
+
})),
|
|
32
42
|
};
|
|
33
43
|
});
|
|
34
44
|
}
|
|
45
|
+
emitStateChange(state) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
for (const handler of this.stateChangeHandlers) {
|
|
48
|
+
yield handler(state);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
onStateChange(cb) {
|
|
53
|
+
this.stateChangeHandlers.push(cb);
|
|
54
|
+
}
|
|
35
55
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { WebRtcStateChangeHandler } from './WebRtcConnection';
|
|
1
2
|
export default class WebRtcStreamerImpl implements WebRtcStreamer {
|
|
2
3
|
private connection;
|
|
3
|
-
static Class?: new (connection: RTCPeerConnection) => WebRtcStreamer;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
static Class?: new (connection: RTCPeerConnection, stateChangeHandlers?: WebRtcStateChangeHandler) => WebRtcStreamer;
|
|
5
|
+
private stateChangeHandler?;
|
|
6
|
+
protected constructor(connection: RTCPeerConnection, stateChangeHandler?: WebRtcStateChangeHandler);
|
|
7
|
+
static Streamer(connection: RTCPeerConnection, stateChangeHandler?: WebRtcStateChangeHandler): WebRtcStreamer;
|
|
6
8
|
setAnswer(answerSdp: string): Promise<void>;
|
|
7
9
|
onTrack(cb: (event: RTCTrackEvent) => void): void;
|
|
8
10
|
}
|
|
@@ -9,23 +9,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { assertOptions } from '@sprucelabs/schema';
|
|
11
11
|
export default class WebRtcStreamerImpl {
|
|
12
|
-
constructor(connection) {
|
|
12
|
+
constructor(connection, stateChangeHandler) {
|
|
13
13
|
this.connection = connection;
|
|
14
|
+
this.stateChangeHandler = stateChangeHandler;
|
|
14
15
|
}
|
|
15
|
-
static Streamer(connection) {
|
|
16
|
+
static Streamer(connection, stateChangeHandler) {
|
|
16
17
|
var _a;
|
|
17
|
-
return new ((_a = this.Class) !== null && _a !== void 0 ? _a : this)(connection);
|
|
18
|
+
return new ((_a = this.Class) !== null && _a !== void 0 ? _a : this)(connection, stateChangeHandler);
|
|
18
19
|
}
|
|
19
20
|
setAnswer(answerSdp) {
|
|
20
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
var _a;
|
|
21
23
|
assertOptions({ answerSdp }, ['answerSdp']);
|
|
22
24
|
yield this.connection.setRemoteDescription({
|
|
23
25
|
type: 'answer',
|
|
24
26
|
sdp: answerSdp,
|
|
25
27
|
});
|
|
28
|
+
yield ((_a = this.stateChangeHandler) === null || _a === void 0 ? void 0 : _a.call(this, 'suppliedAnswer'));
|
|
26
29
|
});
|
|
27
30
|
}
|
|
28
31
|
onTrack(cb) {
|
|
32
|
+
var _a;
|
|
29
33
|
this.connection.addEventListener('track', cb);
|
|
34
|
+
void ((_a = this.stateChangeHandler) === null || _a === void 0 ? void 0 : _a.call(this, 'trackAdded'));
|
|
30
35
|
}
|
|
31
36
|
}
|