@norskvideo/norsk-studio-built-ins 1.11.6 → 1.12.0-2025-01-28-397642d6

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 (238) hide show
  1. package/README.md +16 -0
  2. package/client/info.js +1402 -782
  3. package/client/output.whep/styles.css +9 -0
  4. package/client/style.css +520 -858
  5. package/lib/info.js +4 -8
  6. package/lib/info.js.map +1 -1
  7. package/lib/input.rtmp/info.js +2 -1
  8. package/lib/input.rtmp/info.js.map +1 -1
  9. package/lib/input.rtmp/runtime.d.ts +24 -5
  10. package/lib/input.rtmp/runtime.js +166 -60
  11. package/lib/input.rtmp/runtime.js.map +1 -1
  12. package/lib/input.rtmp/summary-view.d.ts +3 -5
  13. package/lib/input.rtmp/summary-view.js +26 -6
  14. package/lib/input.rtmp/summary-view.js.map +1 -1
  15. package/lib/input.rtmp/types.d.ts +133 -0
  16. package/lib/input.rtmp/types.js +3 -0
  17. package/lib/input.rtmp/types.js.map +1 -0
  18. package/lib/input.rtmp/types.yaml +99 -0
  19. package/lib/input.silence/info.js +3 -2
  20. package/lib/input.silence/info.js.map +1 -1
  21. package/lib/input.srt-caller/info.js +6 -5
  22. package/lib/input.srt-caller/info.js.map +1 -1
  23. package/lib/input.srt-caller/runtime.d.ts +1 -1
  24. package/lib/input.srt-listener/info.js +14 -6
  25. package/lib/input.srt-listener/info.js.map +1 -1
  26. package/lib/input.srt-listener/runtime.d.ts +42 -6
  27. package/lib/input.srt-listener/runtime.js +237 -57
  28. package/lib/input.srt-listener/runtime.js.map +1 -1
  29. package/lib/input.srt-listener/summary-view.d.ts +3 -5
  30. package/lib/input.srt-listener/summary-view.js +81 -5
  31. package/lib/input.srt-listener/summary-view.js.map +1 -1
  32. package/lib/input.srt-listener/types.d.ts +193 -0
  33. package/lib/input.srt-listener/types.js +3 -0
  34. package/lib/input.srt-listener/types.js.map +1 -0
  35. package/lib/input.srt-listener/types.yaml +145 -0
  36. package/lib/input.udp-ts/info.d.ts +1 -1
  37. package/lib/input.udp-ts/info.js +5 -4
  38. package/lib/input.udp-ts/info.js.map +1 -1
  39. package/lib/input.udp-ts/runtime.d.ts +1 -1
  40. package/lib/input.videoTestCard/info.d.ts +1 -1
  41. package/lib/input.videoTestCard/info.js +14 -4
  42. package/lib/input.videoTestCard/info.js.map +1 -1
  43. package/lib/output.autoCmaf/info.d.ts +2 -2
  44. package/lib/output.autoCmaf/info.js +65 -7
  45. package/lib/output.autoCmaf/info.js.map +1 -1
  46. package/lib/output.autoCmaf/runtime.d.ts +29 -9
  47. package/lib/output.autoCmaf/runtime.js +198 -60
  48. package/lib/output.autoCmaf/runtime.js.map +1 -1
  49. package/lib/output.autoCmaf/summary.js +26 -1
  50. package/lib/output.autoCmaf/summary.js.map +1 -1
  51. package/lib/output.autoCmaf/types.d.ts +101 -0
  52. package/lib/output.autoCmaf/types.js +3 -0
  53. package/lib/output.autoCmaf/types.js.map +1 -0
  54. package/lib/output.autoCmaf/types.yaml +28 -0
  55. package/lib/output.preview/info.js +5 -2
  56. package/lib/output.preview/info.js.map +1 -1
  57. package/lib/output.preview/inline-view.d.ts +2 -4
  58. package/lib/output.preview/inline-view.js +41 -7
  59. package/lib/output.preview/inline-view.js.map +1 -1
  60. package/lib/output.preview/runtime.d.ts +5 -3
  61. package/lib/output.preview/runtime.js +29 -18
  62. package/lib/output.preview/runtime.js.map +1 -1
  63. package/lib/output.rtmp/info.js +1 -0
  64. package/lib/output.rtmp/info.js.map +1 -1
  65. package/lib/output.rtmp/inline-view.js +2 -2
  66. package/lib/output.rtmp/runtime.d.ts +2 -2
  67. package/lib/output.rtmp/runtime.js.map +1 -1
  68. package/lib/output.srt/info.d.ts +2 -2
  69. package/lib/output.srt/info.js +26 -5
  70. package/lib/output.srt/info.js.map +1 -1
  71. package/lib/output.srt/runtime.d.ts +30 -5
  72. package/lib/output.srt/runtime.js +139 -5
  73. package/lib/output.srt/runtime.js.map +1 -1
  74. package/lib/output.srt/types.d.ts +101 -0
  75. package/lib/output.srt/types.js +3 -0
  76. package/lib/output.srt/types.js.map +1 -0
  77. package/lib/output.srt/types.yaml +31 -0
  78. package/lib/output.statistics/info.js +1 -0
  79. package/lib/output.statistics/info.js.map +1 -1
  80. package/lib/output.statistics/inline-view.js +3 -2
  81. package/lib/output.statistics/inline-view.js.map +1 -1
  82. package/lib/output.statistics/runtime.d.ts +1 -1
  83. package/lib/output.statistics/runtime.js.map +1 -1
  84. package/lib/output.udpTs/info.d.ts +1 -1
  85. package/lib/output.udpTs/info.js +4 -3
  86. package/lib/output.udpTs/info.js.map +1 -1
  87. package/lib/output.udpTs/runtime.d.ts +1 -1
  88. package/lib/output.whep/info.d.ts +2 -2
  89. package/lib/output.whep/info.js +50 -1
  90. package/lib/output.whep/info.js.map +1 -1
  91. package/lib/output.whep/inline-view.d.ts +4 -0
  92. package/lib/output.whep/inline-view.js +57 -0
  93. package/lib/output.whep/inline-view.js.map +1 -0
  94. package/lib/output.whep/runtime.d.ts +27 -5
  95. package/lib/output.whep/runtime.js +64 -13
  96. package/lib/output.whep/runtime.js.map +1 -1
  97. package/lib/output.whep/types.d.ts +101 -0
  98. package/lib/output.whep/types.js +3 -0
  99. package/lib/output.whep/types.js.map +1 -0
  100. package/lib/output.whep/types.yaml +30 -0
  101. package/lib/processor.browserOverlay/info.d.ts +2 -2
  102. package/lib/processor.browserOverlay/info.js +56 -2
  103. package/lib/processor.browserOverlay/info.js.map +1 -1
  104. package/lib/processor.browserOverlay/inline-view.d.ts +6 -0
  105. package/lib/processor.browserOverlay/inline-view.js +8 -0
  106. package/lib/processor.browserOverlay/inline-view.js.map +1 -0
  107. package/lib/processor.browserOverlay/runtime.d.ts +40 -6
  108. package/lib/processor.browserOverlay/runtime.js +151 -23
  109. package/lib/processor.browserOverlay/runtime.js.map +1 -1
  110. package/lib/processor.browserOverlay/summary-view.d.ts +4 -0
  111. package/lib/processor.browserOverlay/summary-view.js +27 -0
  112. package/lib/processor.browserOverlay/summary-view.js.map +1 -0
  113. package/lib/processor.browserOverlay/types.d.ts +174 -0
  114. package/lib/processor.browserOverlay/types.js +3 -0
  115. package/lib/processor.browserOverlay/types.js.map +1 -0
  116. package/lib/processor.browserOverlay/types.yaml +65 -0
  117. package/lib/processor.cascadingSwitch/info.js +4 -3
  118. package/lib/processor.cascadingSwitch/info.js.map +1 -1
  119. package/lib/processor.cascadingSwitch/inline-view.js +3 -3
  120. package/lib/processor.cascadingSwitch/runtime.d.ts +1 -1
  121. package/lib/processor.cascadingSwitch/runtime.js +2 -2
  122. package/lib/processor.cascadingSwitch/runtime.js.map +1 -1
  123. package/lib/processor.fixedLadder/codec-editor.js +1 -1
  124. package/lib/processor.fixedLadder/codec-editor.js.map +1 -1
  125. package/lib/processor.fixedLadder/codec-view.js +1 -1
  126. package/lib/processor.fixedLadder/codec-view.js.map +1 -1
  127. package/lib/processor.fixedLadder/info.js +4 -2
  128. package/lib/processor.fixedLadder/info.js.map +1 -1
  129. package/lib/processor.fixedLadder/rung-view.js +1 -1
  130. package/lib/processor.fixedLadder/rung-view.js.map +1 -1
  131. package/lib/processor.onscreenGraphic/image-selection.d.ts +9 -0
  132. package/lib/{processor.dynamicBug/bug-selection.js → processor.onscreenGraphic/image-selection.js} +10 -10
  133. package/lib/processor.onscreenGraphic/image-selection.js.map +1 -0
  134. package/lib/processor.onscreenGraphic/info.d.ts +3 -0
  135. package/lib/{processor.dynamicBug → processor.onscreenGraphic}/info.js +23 -16
  136. package/lib/processor.onscreenGraphic/info.js.map +1 -0
  137. package/lib/processor.onscreenGraphic/runtime.d.ts +91 -0
  138. package/lib/processor.onscreenGraphic/runtime.js +503 -0
  139. package/lib/processor.onscreenGraphic/runtime.js.map +1 -0
  140. package/lib/processor.onscreenGraphic/summary-view.d.ts +4 -0
  141. package/lib/processor.onscreenGraphic/summary-view.js +343 -0
  142. package/lib/processor.onscreenGraphic/summary-view.js.map +1 -0
  143. package/lib/processor.onscreenGraphic/types.d.ts +271 -0
  144. package/lib/processor.onscreenGraphic/types.js +3 -0
  145. package/lib/processor.onscreenGraphic/types.js.map +1 -0
  146. package/lib/processor.onscreenGraphic/types.yaml +211 -0
  147. package/lib/processor.streamKeyOverride/info.d.ts +3 -0
  148. package/lib/processor.streamKeyOverride/info.js +150 -0
  149. package/lib/processor.streamKeyOverride/info.js.map +1 -0
  150. package/lib/processor.streamKeyOverride/runtime.d.ts +54 -0
  151. package/lib/processor.streamKeyOverride/runtime.js +226 -0
  152. package/lib/processor.streamKeyOverride/runtime.js.map +1 -0
  153. package/lib/shared/drm/axinom.d.ts +2 -0
  154. package/lib/shared/drm/axinom.js +120 -0
  155. package/lib/shared/drm/axinom.js.map +1 -0
  156. package/lib/shared/drm/cpix.d.ts +24 -0
  157. package/lib/shared/drm/cpix.js +97 -0
  158. package/lib/shared/drm/cpix.js.map +1 -0
  159. package/lib/shared/drm/ezdrm.d.ts +2 -0
  160. package/lib/shared/drm/ezdrm.js +26 -0
  161. package/lib/shared/drm/ezdrm.js.map +1 -0
  162. package/lib/shared/srt-socket-options.js +6 -6
  163. package/lib/shared/srt-socket-options.js.map +1 -1
  164. package/lib/test/auto-cmaf.js +25 -17
  165. package/lib/test/auto-cmaf.js.map +1 -1
  166. package/lib/test/browser-overlay.js +1 -0
  167. package/lib/test/browser-overlay.js.map +1 -1
  168. package/lib/test/{dynamic-bug.js → onscreen-graphic.js} +139 -106
  169. package/lib/test/onscreen-graphic.js.map +1 -0
  170. package/lib/test/preview.js +3 -3
  171. package/lib/test/preview.js.map +1 -1
  172. package/lib/test/rtmp-input.js +6 -3
  173. package/lib/test/rtmp-input.js.map +1 -1
  174. package/lib/test/srt-input-caller.js +5 -5
  175. package/lib/test/srt-input-caller.js.map +1 -1
  176. package/lib/test/srt-input-listener.js +99 -18
  177. package/lib/test/srt-input-listener.js.map +1 -1
  178. package/lib/test/srt-output.js +2 -2
  179. package/lib/test/srt-output.js.map +1 -1
  180. package/lib/test/udp-output.js +2 -2
  181. package/lib/test/udp-output.js.map +1 -1
  182. package/lib/test/udp-ts-input.js +2 -2
  183. package/lib/test/udp-ts-input.js.map +1 -1
  184. package/lib/test/whep-output.js +8 -2
  185. package/lib/test/whep-output.js.map +1 -1
  186. package/lib/{util.latency → util.stats.latency}/info.js +2 -1
  187. package/lib/util.stats.latency/info.js.map +1 -0
  188. package/lib/util.stats.latency/inline-view.js.map +1 -0
  189. package/lib/{util.latency → util.stats.latency}/runtime.d.ts +1 -1
  190. package/lib/{util.latency → util.stats.latency}/runtime.js +2 -2
  191. package/lib/util.stats.latency/runtime.js.map +1 -0
  192. package/lib/util.stats.latency/source-node-selection.js.map +1 -0
  193. package/package.json +12 -5
  194. package/lib/processor.dynamicBug/bug-selection.d.ts +0 -9
  195. package/lib/processor.dynamicBug/bug-selection.js.map +0 -1
  196. package/lib/processor.dynamicBug/info.d.ts +0 -3
  197. package/lib/processor.dynamicBug/info.js.map +0 -1
  198. package/lib/processor.dynamicBug/runtime.d.ts +0 -64
  199. package/lib/processor.dynamicBug/runtime.js +0 -297
  200. package/lib/processor.dynamicBug/runtime.js.map +0 -1
  201. package/lib/processor.dynamicBug/summary-view.d.ts +0 -4
  202. package/lib/processor.dynamicBug/summary-view.js +0 -60
  203. package/lib/processor.dynamicBug/summary-view.js.map +0 -1
  204. package/lib/processor.whisper-transcribe/info.d.ts +0 -3
  205. package/lib/processor.whisper-transcribe/info.js +0 -43
  206. package/lib/processor.whisper-transcribe/info.js.map +0 -1
  207. package/lib/processor.whisper-transcribe/runtime.d.ts +0 -29
  208. package/lib/processor.whisper-transcribe/runtime.js +0 -83
  209. package/lib/processor.whisper-transcribe/runtime.js.map +0 -1
  210. package/lib/test/dynamic-bug.js.map +0 -1
  211. package/lib/util.latency/info.js.map +0 -1
  212. package/lib/util.latency/inline-view.js.map +0 -1
  213. package/lib/util.latency/runtime.js.map +0 -1
  214. package/lib/util.latency/source-node-selection.js.map +0 -1
  215. package/lib/util.ma35d/info.d.ts +0 -3
  216. package/lib/util.ma35d/info.js +0 -78
  217. package/lib/util.ma35d/info.js.map +0 -1
  218. package/lib/util.ma35d/inline-view.d.ts +0 -6
  219. package/lib/util.ma35d/inline-view.js +0 -76
  220. package/lib/util.ma35d/inline-view.js.map +0 -1
  221. package/lib/util.ma35d/runtime.d.ts +0 -21
  222. package/lib/util.ma35d/runtime.js +0 -49
  223. package/lib/util.ma35d/runtime.js.map +0 -1
  224. package/lib/util.timestamps/info.d.ts +0 -5
  225. package/lib/util.timestamps/info.js +0 -86
  226. package/lib/util.timestamps/info.js.map +0 -1
  227. package/lib/util.timestamps/inline-view.d.ts +0 -6
  228. package/lib/util.timestamps/inline-view.js +0 -94
  229. package/lib/util.timestamps/inline-view.js.map +0 -1
  230. package/lib/util.timestamps/runtime.d.ts +0 -29
  231. package/lib/util.timestamps/runtime.js +0 -40
  232. package/lib/util.timestamps/runtime.js.map +0 -1
  233. /package/lib/test/{dynamic-bug.d.ts → onscreen-graphic.d.ts} +0 -0
  234. /package/lib/{util.latency → util.stats.latency}/info.d.ts +0 -0
  235. /package/lib/{util.latency → util.stats.latency}/inline-view.d.ts +0 -0
  236. /package/lib/{util.latency → util.stats.latency}/inline-view.js +0 -0
  237. /package/lib/{util.latency → util.stats.latency}/source-node-selection.d.ts +0 -0
  238. /package/lib/{util.latency → util.stats.latency}/source-node-selection.js +0 -0
@@ -1,13 +1,42 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
2
28
  Object.defineProperty(exports, "__esModule", { value: true });
3
29
  exports.default = default_1;
4
30
  const config_1 = require("@norskvideo/norsk-studio/lib/shared/config");
31
+ const react_1 = __importDefault(require("react"));
5
32
  function default_1(R) {
6
33
  const { defineComponent, Av, validation: { JitterBuffer }, } = R;
34
+ const InlineView = react_1.default.lazy(async () => Promise.resolve().then(() => __importStar(require('./inline-view'))));
7
35
  return defineComponent({
8
36
  identifier: 'output.whep',
9
37
  category: 'output',
10
38
  name: "WHEP Egest",
39
+ description: "This component allows us to use WebRTC egress for outputs.",
11
40
  subscription: {
12
41
  accepts: {
13
42
  type: 'single-stream',
@@ -15,14 +44,34 @@ function default_1(R) {
15
44
  },
16
45
  },
17
46
  display: (_desc) => { return {}; },
47
+ css: ["styles.css"],
48
+ runtime: {
49
+ initialState: () => ({}),
50
+ handleEvent(ev, state) {
51
+ const evType = ev.type;
52
+ switch (evType) {
53
+ case 'url-published':
54
+ state.url = ev.url;
55
+ break;
56
+ default:
57
+ assertUnreachable(evType);
58
+ }
59
+ return { ...state };
60
+ },
61
+ inline: InlineView
62
+ },
18
63
  configForm: {
19
64
  global: {
20
65
  iceServers: (0, config_1.GlobalIceServers)(R)
21
66
  },
22
67
  form: {
23
68
  bufferDelayMs: { help: "How many milliseconds in the jitter buffer", hint: { type: 'numeric', validation: JitterBuffer, defaultValue: 500.0 } },
24
- }
69
+ showPreview: { help: "Show video preview", hint: { type: 'boolean', defaultValue: true } }
70
+ },
25
71
  }
26
72
  });
27
73
  }
74
+ function assertUnreachable(_) {
75
+ throw new Error("Didn't expect to get here");
76
+ }
28
77
  //# sourceMappingURL=info.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/output.whep/info.ts"],"names":[],"mappings":";;AAKA,4BA+BC;AAjCD,uEAA6E;AAE7E,mBAAwB,CAAe;IACrC,MAAM,EACJ,eAAe,EACf,EAAE,EACF,UAAU,EAAE,EAAE,YAAY,EAAE,GAC7B,GAAG,CAAC,CAAC;IACN,OAAO,eAAe,CAAqB;QACzC,UAAU,EAAE,aAAa;QACzB,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,YAAY;QAClB,YAAY,EAAE;YAMZ,OAAO,EAAE;gBACP,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,EAAE;aACV;SACF;QACD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC;QAClC,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,UAAU,EAAE,IAAA,yBAAgB,EAAC,CAAC,CAAC;aAChC;YACD,IAAI,EAAE;gBACJ,aAAa,EAAE,EAAE,IAAI,EAAE,4CAA4C,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE;aAChJ;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/output.whep/info.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,4BAmDC;AAtDD,uEAA6E;AAC7E,kDAA0B;AAE1B,mBAAwB,CAAe;IACrC,MAAM,EACJ,eAAe,EACf,EAAE,EACF,UAAU,EAAE,EAAE,YAAY,EAAE,GAC7B,GAAG,CAAC,CAAC;IACN,MAAM,UAAU,GAAG,eAAK,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE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,CAAQ;IACjC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { WhepOutputState, WhepOutputSettings } from "./runtime";
2
+ import type { ViewProps } from "@norskvideo/norsk-studio/lib/extension/client-types";
3
+ declare function InlineView({ state, config, raise }: ViewProps<WhepOutputSettings, WhepOutputState>): import("react/jsx-runtime").JSX.Element;
4
+ export default InlineView;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const react_1 = require("react");
5
+ const webrtc_client_1 = require("@norskvideo/webrtc-client");
6
+ function InlineView({ state, config, raise }) {
7
+ const url = state.url;
8
+ const id = config.id;
9
+ const [showPreview, setShowPreview] = (0, react_1.useState)(config.showPreview ?? true);
10
+ const [client, setClient] = (0, react_1.useState)(null);
11
+ const createClient = (url) => {
12
+ const newClient = new webrtc_client_1.WhepClient({
13
+ url,
14
+ container: document.getElementById(`whep-${id}`) ?? undefined,
15
+ });
16
+ newClient.start().catch(console.error);
17
+ return newClient;
18
+ };
19
+ const cleanupClient = (client) => {
20
+ client.outputVideoTracks.forEach(track => track.stop());
21
+ if (client.outputAudioTrack) {
22
+ client.outputAudioTrack.stop();
23
+ }
24
+ client.videoElements.forEach(video => {
25
+ video.srcObject = null;
26
+ video.remove();
27
+ });
28
+ };
29
+ (0, react_1.useEffect)(() => {
30
+ if (!url || !showPreview) {
31
+ if (client) {
32
+ cleanupClient(client);
33
+ setClient(null);
34
+ }
35
+ return;
36
+ }
37
+ const newClient = createClient(url);
38
+ setClient(newClient);
39
+ return () => {
40
+ cleanupClient(newClient);
41
+ };
42
+ }, [state.url, showPreview]);
43
+ (0, react_1.useEffect)(() => {
44
+ setShowPreview(config.showPreview ?? true);
45
+ }, [config.showPreview]);
46
+ raise && (0, react_1.useEffect)(raise, []);
47
+ if (!url)
48
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "..." });
49
+ const videoStyles = `
50
+ #whep-${id} video::-webkit-media-controls-play-button {
51
+ display: none;
52
+ }
53
+ `;
54
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "whep-container", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-2", children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", id: `video-toggle-${id}`, checked: showPreview, onChange: (e) => setShowPreview(e.target.checked), className: "h-4 w-4" }), (0, jsx_runtime_1.jsx)("label", { htmlFor: `video-toggle-${id}`, className: "text-sm", children: "Show Preview" })] }), showPreview ? ((0, jsx_runtime_1.jsx)("div", { className: "whep-video", id: `whep-${id}`, children: (0, jsx_runtime_1.jsx)("style", { children: videoStyles }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "whep-video bg-black flex items-center justify-center text-white h-full", children: "Preview turned off" }))] }));
55
+ }
56
+ exports.default = InlineView;
57
+ //# sourceMappingURL=inline-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-view.js","sourceRoot":"","sources":["../../src/output.whep/inline-view.tsx"],"names":[],"mappings":";;;AAAA,iCAA4C;AAE5C,6DAAuD;AAGvD,SAAS,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAkD;IAC1F,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;IACtB,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;IACrB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC,CAAC;IAC3E,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAoB,IAAI,CAAC,CAAC;IAE9D,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,EAAE;QACnC,MAAM,SAAS,GAAG,IAAI,0BAAU,CAAC;YAC/B,GAAG;YACH,SAAS,EAAE,QAAQ,C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AC,WAAW,CAAC,CAAC,CAAC;IAEzB,KAAK,IAAI,IAAA,iBAAS,EAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAE9B,IAAI,CAAC,GAAG;QAAE,OAAO,mEAAQ,CAAC;IAE1B,MAAM,WAAW,GAAG;YACV,EAAE;;;GAGX,CAAC;IAEF,OAAO,CACL,iCAAK,SAAS,EAAC,gBAAgB,aAC7B,iCAAK,SAAS,EAAC,8BAA8B,aAC3C,kCACE,IAAI,EAAC,UAAU,EACf,EAAE,EAAE,gBAAgB,EAAE,EAAE,EACxB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EACjD,SAAS,EAAC,SAAS,GACnB,EACF,kCAAO,OAAO,EAAE,gBAAgB,EAAE,EAAE,EAAE,SAAS,EAAC,SAAS,6BAEjD,IACJ,EACL,WAAW,CAAC,CAAC,CAAC,CACb,gCAAK,SAAS,EAAC,YAAY,EAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,YAC1C,4CAAQ,WAAW,GAAS,GACxB,CACP,CAAC,CAAC,CAAC,CACF,gCAAK,SAAS,EAAC,wEAAwE,mCAEjF,CACP,IACG,CACP,CAAC;AACJ,CAAC;AAED,kBAAe,UAAU,CAAC"}
@@ -1,15 +1,37 @@
1
- import { Norsk, WhepOutputSettings as SdkSettings } from '@norskvideo/norsk-sdk';
2
- import { OnCreated, ServerComponentDefinition, StudioRuntime } from '@norskvideo/norsk-studio/lib/extension/runtime-types';
3
- import { SimpleSinkWrapper } from '@norskvideo/norsk-studio/lib/extension/base-nodes';
1
+ import { Norsk, WhepOutputSettings as SdkSettings, WhepOutputNode } from '@norskvideo/norsk-sdk';
2
+ import { OnCreated, RuntimeUpdates, ServerComponentDefinition, StudioNodeSubscriptionSource, StudioRuntime, StudioShared } from '@norskvideo/norsk-studio/lib/extension/runtime-types';
3
+ import { CustomSinkNode, SimpleSinkWrapper, SubscriptionOpts } from '@norskvideo/norsk-studio/lib/extension/base-nodes';
4
4
  import { IceServer } from '@norskvideo/norsk-studio/lib/shared/config';
5
+ import { ContextPromiseControl } from '@norskvideo/norsk-studio/lib/runtime/util';
5
6
  export type WhepOutputSettings = {
6
7
  id: string;
7
8
  displayName: string;
8
9
  bufferDelayMs?: SdkSettings['bufferDelayMs'];
10
+ showPreview?: boolean;
9
11
  __global: {
10
12
  iceServers: IceServer[];
11
13
  };
12
14
  };
13
- export default class WhepOutputDefinition implements ServerComponentDefinition<WhepOutputSettings, SimpleSinkWrapper> {
14
- create(norsk: Norsk, cfg: WhepOutputSettings, cb: OnCreated<SimpleSinkWrapper>, { report }: StudioRuntime): Promise<void>;
15
+ export type WhepOutputState = {
16
+ url?: string;
17
+ };
18
+ export type WhepOutputEvent = {
19
+ type: 'url-published';
20
+ url: string;
21
+ };
22
+ export type WhepOutputCommand = object;
23
+ export declare class WhepOutput extends CustomSinkNode {
24
+ initialised: Promise<void>;
25
+ norsk: Norsk;
26
+ updates: RuntimeUpdates<WhepOutputState, WhepOutputCommand, WhepOutputEvent>;
27
+ shared: StudioShared;
28
+ cfg: WhepOutputSettings;
29
+ whep?: WhepOutputNode;
30
+ context: ContextPromiseControl;
31
+ constructor(norsk: Norsk, { updates, shared }: StudioRuntime<WhepOutputState, WhepOutputCommand, WhepOutputEvent>, cfg: WhepOutputSettings);
32
+ subscribe(sources: StudioNodeSubscriptionSource[], _opts?: SubscriptionOpts): void;
33
+ subscribeImpl(sources: StudioNodeSubscriptionSource[]): Promise<void>;
34
+ }
35
+ export default class WhepOutputDefinition implements ServerComponentDefinition<WhepOutputSettings, SimpleSinkWrapper, WhepOutputState, WhepOutputCommand, WhepOutputEvent> {
36
+ create(norsk: Norsk, cfg: WhepOutputSettings, cb: OnCreated<SimpleSinkWrapper>, runtime: StudioRuntime<WhepOutputState, WhepOutputCommand, WhepOutputEvent>): Promise<void>;
15
37
  }
@@ -1,21 +1,72 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WhepOutput = void 0;
3
4
  const base_nodes_1 = require("@norskvideo/norsk-studio/lib/extension/base-nodes");
4
5
  const webrtcSettings_1 = require("../shared/webrtcSettings");
6
+ const util_1 = require("@norskvideo/norsk-studio/lib/runtime/util");
7
+ class WhepOutput extends base_nodes_1.CustomSinkNode {
8
+ initialised;
9
+ norsk;
10
+ updates;
11
+ shared;
12
+ cfg;
13
+ whep;
14
+ context = new util_1.ContextPromiseControl(this.subscribeImpl.bind(this));
15
+ constructor(norsk, { updates, shared }, cfg) {
16
+ super(cfg.id);
17
+ this.cfg = cfg;
18
+ this.norsk = norsk;
19
+ this.updates = updates;
20
+ this.shared = shared;
21
+ this.initialised = Promise.resolve();
22
+ }
23
+ subscribe(sources, _opts) {
24
+ this.context.setSources(sources);
25
+ }
26
+ async subscribeImpl(sources) {
27
+ const videoSource = sources.filter((s) => s.streams.select.includes("video")).at(0)?.selectVideo();
28
+ const audioSource = sources.filter((s) => s.streams.select.includes("audio")).at(0)?.selectAudio();
29
+ const subscriptions = [];
30
+ if (videoSource && videoSource.length > 0) {
31
+ subscriptions.push(videoSource[0]);
32
+ }
33
+ if (audioSource && audioSource.length > 0) {
34
+ subscriptions.push(audioSource[0]);
35
+ }
36
+ if (subscriptions.length > 0) {
37
+ if (!this.whep) {
38
+ const whepCfg = {
39
+ id: `${this.cfg.id}-whep`,
40
+ bufferDelayMs: this.cfg.bufferDelayMs,
41
+ onPublishStart: () => {
42
+ const url = this.whep?.endpointUrl;
43
+ if (url) {
44
+ this.updates.raiseEvent({ type: 'url-published', url });
45
+ this.updates.update({ url });
46
+ }
47
+ },
48
+ ...(0, webrtcSettings_1.webRtcSettings)(this.cfg.__global.iceServers)
49
+ };
50
+ this.whep = await this.norsk.output.whep(whepCfg);
51
+ }
52
+ this.whep?.subscribe(subscriptions, (ctx) => {
53
+ return ctx.streams.length === subscriptions.length;
54
+ });
55
+ }
56
+ else {
57
+ await this.whep?.close();
58
+ this.whep = undefined;
59
+ this.updates.update({});
60
+ }
61
+ }
62
+ }
63
+ exports.WhepOutput = WhepOutput;
5
64
  class WhepOutputDefinition {
6
- async create(norsk, cfg, cb, { report }) {
7
- const wrapper = new base_nodes_1.SimpleSinkWrapper(cfg.id, async () => {
8
- const mappedCfg = {
9
- id: cfg.id,
10
- bufferDelayMs: cfg.bufferDelayMs,
11
- ...(0, webrtcSettings_1.webRtcSettings)(cfg.__global.iceServers),
12
- };
13
- const node = await norsk.output.whep(mappedCfg);
14
- report.registerOutput(cfg.id, node.playerUrl);
15
- return node;
16
- });
17
- await wrapper.initialised;
18
- void cb(wrapper);
65
+ async create(norsk, cfg, cb, runtime) {
66
+ const node = new WhepOutput(norsk, runtime, cfg);
67
+ runtime.report.registerOutput(cfg.id, node.whep?.endpointUrl);
68
+ await node.initialised;
69
+ cb(node);
19
70
  }
20
71
  }
21
72
  exports.default = WhepOutputDefinition;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/output.whep/runtime.ts"],"names":[],"mappings":";;AAGA,kFAAsF;AAEtF,6DAAwD;AAWxD,MAAqB,oBAAoB;IACvC,KAAK,CAAC,MAAM,CAAC,KAAY,EAAE,GAAuB,EAAE,EAAgC,EAAE,EAAE,MAAM,EAAiB;QAC7G,MAAM,OAAO,GAAG,IAAI,8BAAiB,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,IAAI,EAAE;YACvD,MAAM,SAAS,GAAgB;gBAC7B,EAAE,EAAE,GAAG,CAAC,EAAE;gBACV,aAAa,EAAE,GAAG,CAAC,aAAa;gBAChC,GAAI,IAAA,+BAAc,EAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC;aAC5C,CAAC;YACF,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAChD,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE,IAA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AAI,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACpD,CAAC;YAGD,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,aAAa,EAAE,CAAC,GAAG,EAAE,EAAE;gBAC1C,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,aAAa,CAAC,MAAM,CAAC;YACrD,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YAEN,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;YACtB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;CAEJ;AApED,gCAoEC;AAED,MAAqB,oBAAoB;IACvC,KAAK,CAAC,MAAM,CAAC,KAAY,EAAE,GAAuB,EAAE,EAAgC,EAAE,OAA2E;QAC/J,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QACjD,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC9D,MAAM,IAAI,CAAC,WAAW,CAAC;QACvB,EAAE,CAAC,IAAI,CAAC,CAAC;IACX,CAAC;CACF;AAPD,uCAOC"}
@@ -0,0 +1,101 @@
1
+ export interface paths {
2
+ "/enable": {
3
+ parameters: {
4
+ query?: never;
5
+ header?: never;
6
+ path?: never;
7
+ cookie?: never;
8
+ };
9
+ get?: never;
10
+ put?: never;
11
+ post: {
12
+ parameters: {
13
+ query?: never;
14
+ header?: never;
15
+ path?: never;
16
+ cookie?: never;
17
+ };
18
+ requestBody?: never;
19
+ responses: {
20
+ 204: {
21
+ headers: {
22
+ [name: string]: unknown;
23
+ };
24
+ content?: never;
25
+ };
26
+ 400: {
27
+ headers: {
28
+ [name: string]: unknown;
29
+ };
30
+ content?: never;
31
+ };
32
+ 500: {
33
+ headers: {
34
+ [name: string]: unknown;
35
+ };
36
+ content?: never;
37
+ };
38
+ };
39
+ };
40
+ delete?: never;
41
+ options?: never;
42
+ head?: never;
43
+ patch?: never;
44
+ trace?: never;
45
+ };
46
+ "/disable": {
47
+ parameters: {
48
+ query?: never;
49
+ header?: never;
50
+ path?: never;
51
+ cookie?: never;
52
+ };
53
+ get?: never;
54
+ put?: never;
55
+ post: {
56
+ parameters: {
57
+ query?: never;
58
+ header?: never;
59
+ path?: never;
60
+ cookie?: never;
61
+ };
62
+ requestBody?: never;
63
+ responses: {
64
+ 204: {
65
+ headers: {
66
+ [name: string]: unknown;
67
+ };
68
+ content?: never;
69
+ };
70
+ 400: {
71
+ headers: {
72
+ [name: string]: unknown;
73
+ };
74
+ content?: never;
75
+ };
76
+ 500: {
77
+ headers: {
78
+ [name: string]: unknown;
79
+ };
80
+ content?: never;
81
+ };
82
+ };
83
+ };
84
+ delete?: never;
85
+ options?: never;
86
+ head?: never;
87
+ patch?: never;
88
+ trace?: never;
89
+ };
90
+ }
91
+ export type webhooks = Record<string, never>;
92
+ export interface components {
93
+ schemas: never;
94
+ responses: never;
95
+ parameters: never;
96
+ requestBodies: never;
97
+ headers: never;
98
+ pathItems: never;
99
+ }
100
+ export type $defs = Record<string, never>;
101
+ export type operations = Record<string, never>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/output.whep/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ openapi: 3.0.0
2
+ info:
3
+ title: Whep Output Component
4
+ version: 1.0.0
5
+
6
+ paths:
7
+ /enable:
8
+ post:
9
+ summary: Enable WHEP output
10
+ description: Enables output if currently disabled
11
+ x-route-type: instance
12
+ responses:
13
+ 204:
14
+ description: Output successfully enabled
15
+ 400:
16
+ description: Output is already enabled
17
+ 500:
18
+ description: Server error while enabling output
19
+ /disable:
20
+ post:
21
+ summary: Disable WHEP output
22
+ description: Disables output if currently enabled
23
+ x-route-type: instance
24
+ responses:
25
+ 204:
26
+ description: Output successfully disabled
27
+ 400:
28
+ description: Output is already disabled
29
+ 500:
30
+ description: Server error while disabling output
@@ -1,3 +1,3 @@
1
1
  import type Registration from "@norskvideo/norsk-studio/lib/extension/registration";
2
- import type { BrowserOverlayConfig } from "./runtime";
3
- export default function ({ defineComponent, Video, validation: { Z }, }: Registration): import("@norskvideo/norsk-studio/lib/extension/client-types").NodeInfo<BrowserOverlayConfig, object, object, object>;
2
+ import type { BrowserOverlayCommand, BrowserOverlayConfig, BrowserOverlayEvent, BrowserOverlayState } from "./runtime";
3
+ export default function ({ defineComponent, Video, validation: { Z }, }: Registration): import("@norskvideo/norsk-studio/lib/extension/client-types").NodeInfo<BrowserOverlayConfig, BrowserOverlayState, BrowserOverlayCommand, BrowserOverlayEvent>;
@@ -1,12 +1,42 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
2
28
  Object.defineProperty(exports, "__esModule", { value: true });
3
29
  exports.default = default_1;
4
30
  const config_1 = require("@norskvideo/norsk-studio/lib/shared/config");
31
+ const react_1 = __importDefault(require("react"));
32
+ const SummaryView = react_1.default.lazy(async () => Promise.resolve().then(() => __importStar(require('./summary-view'))));
33
+ const InlineView = react_1.default.lazy(async () => Promise.resolve().then(() => __importStar(require('./inline-view'))));
5
34
  function default_1({ defineComponent, Video, validation: { Z }, }) {
6
35
  return defineComponent({
7
- identifier: 'processor.transform.browserOverlay',
36
+ identifier: 'processor.browserOverlay',
8
37
  category: 'processor',
9
38
  name: "Browser Overlay",
39
+ description: 'Capture a live URL and overlay onto a video',
10
40
  subscription: {
11
41
  accepts: {
12
42
  type: 'single-stream',
@@ -22,9 +52,30 @@ function default_1({ defineComponent, Video, validation: { Z }, }) {
22
52
  },
23
53
  display: (desc) => {
24
54
  return {
25
- url: desc.config?.url
55
+ url: desc.config.url
26
56
  };
27
57
  },
58
+ runtime: {
59
+ summary: SummaryView,
60
+ inline: InlineView,
61
+ initialState: () => ({
62
+ currentUrl: "",
63
+ enabled: true
64
+ }),
65
+ handleEvent: (ev, state) => {
66
+ const evType = ev.type;
67
+ switch (evType) {
68
+ case "url-changed":
69
+ return { ...state, currentUrl: ev.url };
70
+ case "enabled":
71
+ return { ...state, enabled: true };
72
+ case "disabled":
73
+ return { ...state, enabled: false };
74
+ default:
75
+ assertUnreachable(evType);
76
+ }
77
+ }
78
+ },
28
79
  configForm: {
29
80
  global: {
30
81
  hardware: (0, config_1.HardwareSelection)()
@@ -35,4 +86,7 @@ function default_1({ defineComponent, Video, validation: { Z }, }) {
35
86
  }
36
87
  });
37
88
  }
89
+ function assertUnreachable(_) {
90
+ throw new Error("Didn't expect to get here");
91
+ }
38
92
  //# sourceMappingURL=info.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/processor.browserOverlay/info.ts"],"names":[],"mappings":";;AAKA,4BAqCC;AAxCD,uEAA+E;AAG/E,mBAAwB,EACtB,eAAe,EACf,KAAK,EACL,UAAU,EAAE,EAAE,CAAC,EAAE,GACJ;IACb,OAAO,eAAe,CAAuB;QAC3C,UAAU,EAAE,oCAAoC;QAChD,QAAQ,EAAE,WAAW;QACrB,IAAI,EAAE,iBAAiB;QACvB,YAAY,EAAE;YAEZ,OAAO,EAAE;gBACP,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,KAAK;aACb;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,KAAK;aACb;SACF;QACD,eAAe,EAAE,UAAS,GAAG;YAC3B,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACtB,CAAC;QACD,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YAChB,OAAO;gBACL,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG;aACtB,CAAA;QACH,CAAC;QACD,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,QAAQ,EAAE,IAAA,0BAAiB,GAAE;aAC9B;YACD,IAAI,EAAE;gBACJ,GAAG,EAAE,EAAE,IAAI,EAAE,mCAAmC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,EAAE;aAC3H;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/processor.browserOverlay/info.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,4BA2DC;AAjED,uEAA+E;AAC/E,kDAA0B;AAE1B,MAAM,WAAW,GAAG,eAAK,C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AI,EAAE,CAAC;oBACrC,KAAK,UAAU;wBACb,OAAO,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,KAAK,EAAC,CAAC;oBACrC;wBACE,iBAAiB,CAAC,MAAM,CAAC,CAAA;gBAC7B,CAAC;YACH,CAAC;SACF;QACD,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,QAAQ,EAAE,IAAA,0BAAiB,GAAE;aAC9B;YACD,IAAI,EAAE;gBACJ,GAAG,EAAE,EAAE,IAAI,EAAE,mCAAmC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,EAAE;aAC3H;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAQ;IACjC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { BrowserOverlayState, BrowserOverlayConfig } from "./runtime";
2
+ declare function InlineView({ state, config }: {
3
+ state: BrowserOverlayState;
4
+ config: BrowserOverlayConfig;
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ export default InlineView;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ function InlineView({ state, config }) {
5
+ return (0, jsx_runtime_1.jsx)("div", { id: `browser-overlay-${config.id}`, children: (0, jsx_runtime_1.jsxs)("div", { className: "w-64 grid grid-cols-[min-content,1fr] gap-2", children: [(0, jsx_runtime_1.jsx)("div", { children: "URL:" }), (0, jsx_runtime_1.jsx)("div", { className: "truncate", children: state.currentUrl }), (0, jsx_runtime_1.jsx)("div", { children: "Enabled:" }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("label", { className: "inline-flex items-center cursor-pointer", children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", checked: state.enabled, disabled: true, className: "sr-only peer" }), (0, jsx_runtime_1.jsx)("div", { className: "relative w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600" })] }) })] }) });
6
+ }
7
+ exports.default = InlineView;
8
+ //# sourceMappingURL=inline-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-view.js","sourceRoot":"","sources":["../../src/processor.browserOverlay/inline-view.tsx"],"names":[],"mappings":";;;AAEA,SAAS,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAgE;IAClG,OAAO,gCAAK,EAAE,EAAE,mBAAmB,MAAM,CAAC,EAAE,EAAE,YAC7C,iCAAK,SAAS,EAAC,6CAA6C,aAC3D,mDAAe,EACf,gCAAK,SAAS,EAAC,UAAU,YAAE,KAAK,CAAC,UAAU,GAAO,EAElD,uDAAmB,EACnB,0CACC,mCAAO,SAAS,EAAC,yCAAyC,aACzD,kCAAO,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,QAAQ,QAAC,SAAS,EAAC,cAAc,GAAG,EACnF,gCAAK,SAAS,EAAC,gfAAgf,GAAO,IAC/f,GACH,IACD,GACD,CAAA;AACP,CAAC;AAED,kBAAe,UAAU,CAAC"}
@@ -1,5 +1,5 @@
1
- import { BrowserInputNode, Norsk, VideoComposeNode, VideoStreamMetadata } from '@norskvideo/norsk-sdk';
2
- import { CreatedMediaNode, OnCreated, RelatedMediaNodes, ServerComponentDefinition, StudioNodeSubscriptionSource } from '@norskvideo/norsk-studio/lib/extension/runtime-types';
1
+ import { BrowserInputNode, ComposePart, Norsk, VideoComposeNode, VideoStreamMetadata } from '@norskvideo/norsk-sdk';
2
+ import { CreatedMediaNode, InstanceRouteInfo, OnCreated, RelatedMediaNodes, RuntimeUpdates, ServerComponentDefinition, StudioNodeSubscriptionSource, StudioRuntime } from '@norskvideo/norsk-studio/lib/extension/runtime-types';
3
3
  import { HardwareAccelerationType } from '@norskvideo/norsk-studio/lib/shared/config';
4
4
  import { ContextPromiseControl } from '@norskvideo/norsk-studio/lib/runtime/util';
5
5
  export type BrowserOverlayConfig = {
@@ -10,24 +10,58 @@ export type BrowserOverlayConfig = {
10
10
  displayName: string;
11
11
  url: string;
12
12
  };
13
- export default class BrowserOverlayDefinition implements ServerComponentDefinition<BrowserOverlayConfig, BrowserOverlay> {
14
- create(norsk: Norsk, cfg: BrowserOverlayConfig, cb: OnCreated<BrowserOverlay>): Promise<void>;
13
+ export type BrowserOverlayState = {
14
+ currentUrl: string;
15
+ enabled: boolean;
16
+ };
17
+ export type BrowserOverlayCommand = BrowserOverlayChangeUrlCommand | BrowserOverlayEnableCommand | BrowserOverlayDisableCommand;
18
+ export type BrowserOverlayChangeUrlCommand = {
19
+ type: 'change-url';
20
+ url: string;
21
+ };
22
+ export type BrowserOverlayEnableCommand = {
23
+ type: 'enable';
24
+ };
25
+ export type BrowserOverlayDisableCommand = {
26
+ type: 'disable';
27
+ };
28
+ export type BrowserOverlayEvent = BrowserOverlayChangedUrlEvent | BrowserOverlayEnabledEvent | BrowserOverlayDisabledEvent;
29
+ export type BrowserOverlayChangedUrlEvent = {
30
+ type: 'url-changed';
31
+ url: string;
32
+ };
33
+ export type BrowserOverlayEnabledEvent = {
34
+ type: 'enabled';
35
+ };
36
+ export type BrowserOverlayDisabledEvent = {
37
+ type: 'disabled';
38
+ };
39
+ export default class BrowserOverlayDefinition implements ServerComponentDefinition<BrowserOverlayConfig, BrowserOverlay, BrowserOverlayState, BrowserOverlayCommand, BrowserOverlayEvent> {
40
+ create(norsk: Norsk, cfg: BrowserOverlayConfig, cb: OnCreated<BrowserOverlay>, runtime: StudioRuntime<BrowserOverlayState, BrowserOverlayCommand, BrowserOverlayEvent>): Promise<void>;
41
+ handleCommand(node: BrowserOverlay, command: BrowserOverlayCommand): Promise<void>;
42
+ instanceRoutes(): Promise<InstanceRouteInfo<BrowserOverlayConfig, BrowserOverlay, BrowserOverlayState, BrowserOverlayCommand, BrowserOverlayEvent>[]>;
15
43
  }
16
44
  export declare class BrowserOverlay implements CreatedMediaNode {
17
45
  compose?: VideoComposeNode<"video" | "overlay">;
18
46
  browser?: BrowserInputNode;
19
47
  currentVideo?: VideoStreamMetadata;
20
48
  norsk: Norsk;
49
+ updates: RuntimeUpdates<BrowserOverlayState, BrowserOverlayCommand, BrowserOverlayEvent>;
21
50
  control: ContextPromiseControl;
22
51
  videoSource?: StudioNodeSubscriptionSource;
23
52
  cfg: BrowserOverlayConfig;
24
53
  initialised: Promise<void>;
25
54
  id: string;
26
55
  relatedMediaNodes: RelatedMediaNodes;
27
- static create(norsk: Norsk, cfg: BrowserOverlayConfig): Promise<BrowserOverlay>;
28
- constructor(norsk: Norsk, cfg: BrowserOverlayConfig);
56
+ enabledParts: ComposePart<'video' | 'overlay'>[];
57
+ disabledParts: ComposePart<'video' | 'overlay'>[];
58
+ static create(norsk: Norsk, cfg: BrowserOverlayConfig, updates: RuntimeUpdates<BrowserOverlayState, BrowserOverlayCommand, BrowserOverlayEvent>): Promise<BrowserOverlay>;
59
+ constructor(norsk: Norsk, cfg: BrowserOverlayConfig, updates: RuntimeUpdates<BrowserOverlayState, BrowserOverlayCommand, BrowserOverlayEvent>);
29
60
  initialise(): Promise<void>;
30
61
  subscribe(sources: StudioNodeSubscriptionSource[]): void;
31
62
  handleContext(): Promise<void>;
32
63
  close(): Promise<void>;
64
+ changeUrl(newUrl: string): Promise<void>;
65
+ enable(): Promise<void>;
66
+ disable(): Promise<void>;
33
67
  }