@norskvideo/norsk-studio-alpha 1.27.0-2025-12-23-0e829bed → 1.27.0-2026-01-10-23683704

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 (63) hide show
  1. package/client/info.js +19316 -42369
  2. package/client/style.css +402 -241
  3. package/lib/info.js +13 -9
  4. package/lib/info.js.map +1 -1
  5. package/lib/output.fileMp4/_gen/schema.d.ts +13 -0
  6. package/lib/output.fileMp4/_gen/schema.js +17 -0
  7. package/lib/output.fileMp4/_gen/schema.js.map +1 -0
  8. package/lib/output.fileMp4/_gen/types.d.ts +76 -0
  9. package/lib/output.fileMp4/_gen/types.js +3 -0
  10. package/lib/output.fileMp4/_gen/types.js.map +1 -0
  11. package/lib/output.fileMp4/_gen/zod.d.ts +2 -0
  12. package/lib/output.fileMp4/_gen/zod.js +37 -0
  13. package/lib/output.fileMp4/_gen/zod.js.map +1 -0
  14. package/lib/output.fileMp4/info.d.ts +28 -0
  15. package/lib/output.fileMp4/info.js +84 -0
  16. package/lib/output.fileMp4/info.js.map +1 -0
  17. package/lib/output.fileMp4/inline-view.d.ts +7 -0
  18. package/lib/output.fileMp4/inline-view.js +8 -0
  19. package/lib/output.fileMp4/inline-view.js.map +1 -0
  20. package/lib/output.fileMp4/runtime.d.ts +42 -0
  21. package/lib/output.fileMp4/runtime.js +127 -0
  22. package/lib/output.fileMp4/runtime.js.map +1 -0
  23. package/lib/output.fileMp4/summary-view.d.ts +4 -0
  24. package/lib/output.fileMp4/summary-view.js +16 -0
  25. package/lib/output.fileMp4/summary-view.js.map +1 -0
  26. package/lib/output.fileMp4/types.yaml +81 -0
  27. package/lib/output.tams/info.js +2 -0
  28. package/lib/output.tams/info.js.map +1 -1
  29. package/lib/output.tams/inline-view.js +5 -5
  30. package/lib/output.tams/inline-view.js.map +1 -1
  31. package/lib/output.tams/runtime.d.ts +2 -0
  32. package/lib/output.tams/runtime.js +9 -3
  33. package/lib/output.tams/runtime.js.map +1 -1
  34. package/lib/processor.hardSourceSwitch/_gen/schema.d.ts +16 -0
  35. package/lib/processor.hardSourceSwitch/_gen/schema.js +20 -0
  36. package/lib/processor.hardSourceSwitch/_gen/schema.js.map +1 -0
  37. package/lib/processor.hardSourceSwitch/_gen/types.d.ts +233 -0
  38. package/lib/processor.hardSourceSwitch/_gen/types.js +3 -0
  39. package/lib/processor.hardSourceSwitch/_gen/types.js.map +1 -0
  40. package/lib/processor.hardSourceSwitch/_gen/zod.d.ts +2 -0
  41. package/lib/processor.hardSourceSwitch/_gen/zod.js +156 -0
  42. package/lib/processor.hardSourceSwitch/_gen/zod.js.map +1 -0
  43. package/lib/processor.hardSourceSwitch/fullscreen.d.ts +3 -0
  44. package/lib/processor.hardSourceSwitch/fullscreen.js +40 -0
  45. package/lib/processor.hardSourceSwitch/fullscreen.js.map +1 -0
  46. package/lib/processor.hardSourceSwitch/info.d.ts +78 -0
  47. package/lib/processor.hardSourceSwitch/info.js +191 -0
  48. package/lib/processor.hardSourceSwitch/info.js.map +1 -0
  49. package/lib/processor.hardSourceSwitch/inline-view.d.ts +3 -0
  50. package/lib/processor.hardSourceSwitch/inline-view.js +18 -0
  51. package/lib/processor.hardSourceSwitch/inline-view.js.map +1 -0
  52. package/lib/processor.hardSourceSwitch/runtime.d.ts +81 -0
  53. package/lib/processor.hardSourceSwitch/runtime.js +548 -0
  54. package/lib/processor.hardSourceSwitch/runtime.js.map +1 -0
  55. package/lib/processor.hardSourceSwitch/types.yaml +296 -0
  56. package/lib/test/output.fileMp4.d.ts +1 -0
  57. package/lib/test/output.fileMp4.js +104 -0
  58. package/lib/test/output.fileMp4.js.map +1 -0
  59. package/lib/test/output.tams.js +17 -7
  60. package/lib/test/output.tams.js.map +1 -1
  61. package/lib/util.agent/fullscreen-view.js +17 -7
  62. package/lib/util.agent/fullscreen-view.js.map +1 -1
  63. package/package.json +13 -13
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = FullscreenView;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ function FullscreenView({ state, config: _config, sendCommand, }) {
7
+ const handleSwitch = (0, react_1.useCallback)((sourceName) => {
8
+ sendCommand({ type: "switch-to-source", source: sourceName });
9
+ }, [sendCommand]);
10
+ const handlePriorityChange = (0, react_1.useCallback)((newOrder) => {
11
+ sendCommand({ type: "set-priority-order", sources: newOrder });
12
+ }, [sendCommand]);
13
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "h-full w-full flex flex-col p-4 bg-gray-900 text-white", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex-1 flex gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex-1", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold mb-3", children: "Sources" }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4", children: state.availableSources.map((source) => {
14
+ if (!source.sourceName) {
15
+ return null;
16
+ }
17
+ const sourceName = source.sourceName;
18
+ const isActive = state.activeSource === sourceName;
19
+ const previewUrl = state.sourcePreviews?.[sourceName];
20
+ return ((0, jsx_runtime_1.jsxs)("div", { className: `
21
+ relative border-2 rounded-lg overflow-hidden
22
+ ${isActive ? "border-green-500" : "border-gray-600"}
23
+ `, children: [(0, jsx_runtime_1.jsxs)("div", { className: "aspect-video bg-gray-800 relative", children: [previewUrl ? ((0, jsx_runtime_1.jsx)("img", { src: previewUrl, alt: `${sourceName} preview`, className: "w-full h-full object-cover" })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center h-full text-gray-500", children: "Loading..." })), isActive && ((0, jsx_runtime_1.jsx)("div", { className: "absolute top-2 right-2 bg-green-500 text-white px-2 py-1 rounded text-xs font-bold", children: "ACTIVE" }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "p-3", children: [(0, jsx_runtime_1.jsx)("h4", { className: "font-medium mb-2", children: sourceName }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-end", children: !isActive && ((0, jsx_runtime_1.jsx)("button", { onClick: () => handleSwitch(sourceName), className: "px-3 py-1 bg-blue-600 hover:bg-blue-700 rounded text-sm transition", children: "Make Active" })) })] })] }, sourceName));
24
+ }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "w-96 flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold mb-3", children: "Output" }), (0, jsx_runtime_1.jsxs)("div", { className: "border-2 border-blue-500 rounded-lg overflow-hidden", children: [(0, jsx_runtime_1.jsx)("div", { className: "aspect-video bg-gray-800", children: state.outputPreview ? ((0, jsx_runtime_1.jsx)("img", { src: state.outputPreview, alt: "Output preview", className: "w-full h-full object-cover" })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center h-full text-gray-500", children: "No output" })) }), (0, jsx_runtime_1.jsx)("div", { className: "p-3 bg-gray-800", children: (0, jsx_runtime_1.jsxs)("p", { className: "text-sm text-gray-400", children: ["Active Source:", " ", (0, jsx_runtime_1.jsx)("span", { className: "font-semibold text-white", children: state.activeSource || "None" })] }) })] })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold mb-3", children: "Priority Order" }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-2", children: (state.sourcePriority || []).map((source, index) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between bg-gray-800 p-2 rounded", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-sm", children: [index + 1, ": ", source] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1", children: [index > 0 && ((0, jsx_runtime_1.jsx)("button", { onClick: () => {
25
+ const newOrder = [...(state.sourcePriority || [])];
26
+ [newOrder[index], newOrder[index - 1]] = [
27
+ newOrder[index - 1],
28
+ newOrder[index],
29
+ ];
30
+ handlePriorityChange(newOrder);
31
+ }, className: "px-2 py-1 bg-gray-700 hover:bg-gray-600 rounded text-xs", title: "Move up", children: "\u2191" })), index < (state.sourcePriority?.length || 0) - 1 && ((0, jsx_runtime_1.jsx)("button", { onClick: () => {
32
+ const newOrder = [...(state.sourcePriority || [])];
33
+ [newOrder[index], newOrder[index + 1]] = [
34
+ newOrder[index + 1],
35
+ newOrder[index],
36
+ ];
37
+ handlePriorityChange(newOrder);
38
+ }, className: "px-2 py-1 bg-gray-700 hover:bg-gray-600 rounded text-xs", title: "Move down", children: "\u2193" }))] })] }, source))) })] })] })] }), state.formatWarnings && state.formatWarnings.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "mt-4 bg-yellow-900/50 border border-yellow-600 rounded-lg p-3", children: [(0, jsx_runtime_1.jsxs)("h4", { className: "text-yellow-400 font-semibold mb-2 flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { children: "\u26A0\uFE0F" }), "Format Warnings"] }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-1 max-h-32 overflow-y-auto", children: state.formatWarnings.map((warning, idx) => ((0, jsx_runtime_1.jsxs)("div", { className: "text-sm text-yellow-200", children: ["\u2022 ", warning] }, idx))) })] }))] }));
39
+ }
40
+ //# sourceMappingURL=fullscreen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fullscreen.js","sourceRoot":"","sources":["../../../src/processor.hardSourceSwitch/fullscreen.tsx"],"names":[],"mappings":";;AAoBA,iCA8LC;;AA5MD,iCAAoC;AAcpC,SAAwB,cAAc,CAAC,EACrC,KAAK,EACL,MAAM,EAAE,OAAO,EACf,WAAW,GAKZ;IACC,MAAM,YAAY,GAAG,IAAA,mBAAW,EAC9B,CAAC,UAAkB,EAAE,EAAE;QAErB,WAAW,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAChE,CAAC,EACD,CAAC,WAAW,CAAC,CACd,CAAC;IAEF,MAAM,oBAAoB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P,CAAC,GACE,IACF,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,78 @@
1
+ import type Registration from "@norskvideo/norsk-studio/lib/extension/registration";
2
+ export default function ({ defineComponent, Av, validation: { Z, SourceName }, }: Registration): import("@norskvideo/norsk-studio/lib/extension/client-types").NodeInfo<{
3
+ id: string;
4
+ displayName: string;
5
+ activeSource?: string;
6
+ outputSource: string;
7
+ maxQueueMs: number;
8
+ failoverTimeoutMs: number;
9
+ fallbackFilePath?: string;
10
+ sourcePriority?: string[];
11
+ notes?: string;
12
+ }, {
13
+ activeSource: string;
14
+ availableSources: {
15
+ sourceName?: string;
16
+ format?: {
17
+ resolution?: string;
18
+ frameRate?: string;
19
+ codec?: string;
20
+ };
21
+ }[];
22
+ outputPreview?: string;
23
+ sourcePreviews?: {
24
+ [key: string]: string;
25
+ };
26
+ formatWarnings?: string[];
27
+ sourcePriority?: string[];
28
+ }, {
29
+ type: "switch-to-source";
30
+ source: string;
31
+ } | {
32
+ type: "set-priority-order";
33
+ sources: string[];
34
+ }, {
35
+ type: "source-switched";
36
+ source: string;
37
+ previousSource?: string;
38
+ } | {
39
+ type: "format-warning";
40
+ message: string;
41
+ newFormat?: {
42
+ resolution?: string;
43
+ frameRate?: string;
44
+ codec?: string;
45
+ };
46
+ previousFormat?: {
47
+ resolution?: string;
48
+ frameRate?: string;
49
+ codec?: string;
50
+ };
51
+ } | {
52
+ type: "source-available";
53
+ source: string;
54
+ format: {
55
+ resolution?: string;
56
+ frameRate?: string;
57
+ codec?: string;
58
+ };
59
+ } | {
60
+ type: "source-unavailable";
61
+ source: string;
62
+ } | {
63
+ type: "preview-url-updated";
64
+ source: string;
65
+ url: string;
66
+ } | {
67
+ type: "error";
68
+ classification: "operational" | "configuration";
69
+ error: string;
70
+ } | {
71
+ type: "automatic-failover";
72
+ failedSource: string;
73
+ newSource: string;
74
+ message?: string;
75
+ } | {
76
+ type: "priority-order-changed";
77
+ sourcePriority: string[];
78
+ }>;
@@ -0,0 +1,191 @@
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
+ exports.default = default_1;
7
+ const FaSlidersH_1 = require("@react-icons/all-files/fa/FaSlidersH");
8
+ const inline_view_1 = __importDefault(require("./inline-view"));
9
+ const fullscreen_1 = __importDefault(require("./fullscreen"));
10
+ function default_1({ defineComponent, Av, validation: { Z, SourceName }, }) {
11
+ return defineComponent({
12
+ identifier: 'processor.hardSourceSwitch',
13
+ category: 'processor',
14
+ name: "Hard Source Switch",
15
+ description: "Instantly switches between multiple audio and video sources without transcoding",
16
+ searchTags: ["switch", "hard", "source", "program", "cut"],
17
+ llmHints: [
18
+ "Switches between multiple AV sources instantly without transcoding or normalization",
19
+ "Uses hard cuts (no fade) - sources are passed through as-is",
20
+ "Sources can have different formats (resolution/framerate) but downstream may need to handle changes",
21
+ "Each source must have both audio and video streams grouped by sourceName",
22
+ "The activeSource config must match a connected source's sourceName (or omit for auto-selection)",
23
+ "Use processor.smartSourceSwitch if you need format normalization and smooth transitions",
24
+ "Supports automatic failover when active source stops sending frames (configurable via failoverTimeoutMs)",
25
+ "Manual switching available via UI, commands, or API endpoints",
26
+ "Format warnings are raised when switching between different resolutions/framerates",
27
+ "Ideal for switching between cameras or feeds with identical formats",
28
+ "Health monitoring checks frame arrival every second and triggers failover after timeout"
29
+ ],
30
+ icon: FaSlidersH_1.FaSlidersH,
31
+ subscription: {
32
+ accepts: {
33
+ type: 'dynamic-streams',
34
+ mode: { type: 'multiple', groupBy: 'sourceName' },
35
+ streams: () => Av.map((media) => ({ media }))
36
+ },
37
+ produces: {
38
+ type: 'simple-stream',
39
+ audio: true,
40
+ video: true
41
+ }
42
+ },
43
+ display: (desc) => {
44
+ return {
45
+ activeSource: desc.config.activeSource || '(auto)',
46
+ outputSource: desc.config.outputSource,
47
+ fallback: desc.config.fallbackFilePath ? 'MP4 File' : 'None'
48
+ };
49
+ },
50
+ runtime: {
51
+ initialState: () => ({
52
+ activeSource: '',
53
+ availableSources: [],
54
+ sourcePreviews: {},
55
+ formatWarnings: [],
56
+ sourcePriority: []
57
+ }),
58
+ handleEvent: (ev, state) => {
59
+ const evType = ev.type;
60
+ switch (evType) {
61
+ case 'source-switched':
62
+ return { ...state, activeSource: ev.source };
63
+ case 'source-available': {
64
+ const existing = state.availableSources.find(s => s.sourceName === ev.source);
65
+ if (!existing) {
66
+ return {
67
+ ...state,
68
+ availableSources: [...state.availableSources, {
69
+ sourceName: ev.source,
70
+ format: ev.format
71
+ }]
72
+ };
73
+ }
74
+ return state;
75
+ }
76
+ case 'source-unavailable':
77
+ return {
78
+ ...state,
79
+ availableSources: state.availableSources.filter(s => s.sourceName !== ev.source)
80
+ };
81
+ case 'preview-url-updated':
82
+ if (ev.source === 'output') {
83
+ return { ...state, outputPreview: ev.url };
84
+ }
85
+ else {
86
+ return {
87
+ ...state,
88
+ sourcePreviews: { ...state.sourcePreviews, [ev.source]: ev.url }
89
+ };
90
+ }
91
+ case 'format-warning': {
92
+ const currentWarnings = state.formatWarnings || [];
93
+ const newWarnings = [ev.message, ...currentWarnings].slice(0, 10);
94
+ return { ...state, formatWarnings: newWarnings };
95
+ }
96
+ case 'priority-order-changed':
97
+ return { ...state, sourcePriority: ev.sourcePriority };
98
+ case 'error':
99
+ case 'automatic-failover':
100
+ return state;
101
+ default:
102
+ assertUnreachable(evType);
103
+ }
104
+ },
105
+ inline: inline_view_1.default,
106
+ summary: inline_view_1.default,
107
+ fullscreen: fullscreen_1.default
108
+ },
109
+ extraValidation: function (ctx) {
110
+ const config = ctx.config;
111
+ const streams = ctx.subscriptions.flatMap(s => s.expectedStreams);
112
+ const sourceNames = streams
113
+ .map(s => s.sourceName)
114
+ .filter((s) => !!s)
115
+ .filter((s, i, a) => a.indexOf(s) === i);
116
+ if (config.activeSource && !sourceNames.includes(config.activeSource)) {
117
+ ctx.addError(`activeSource '${config.activeSource}' is not in subscriptions. Available sources: ${sourceNames.join(', ')}`);
118
+ }
119
+ if (!config.activeSource && sourceNames.length === 0) {
120
+ ctx.addWarning('No activeSource configured and no sources connected. Component will auto-select first available source when connected.');
121
+ }
122
+ sourceNames.forEach(source => {
123
+ const hasVideo = streams.some(s => s.sourceName === source && s.media === 'video');
124
+ const hasAudio = streams.some(s => s.sourceName === source && s.media === 'audio');
125
+ if (!hasVideo || !hasAudio) {
126
+ ctx.addError(`Source '${source}' must have both audio and video streams`);
127
+ }
128
+ });
129
+ },
130
+ configForm: {
131
+ form: {
132
+ outputSource: {
133
+ help: "Source name for the switched output",
134
+ hint: {
135
+ type: 'text',
136
+ validation: SourceName,
137
+ defaultValue: 'output'
138
+ }
139
+ },
140
+ failoverTimeoutMs: {
141
+ help: "Automatic failover timeout (ms) when active source stops sending frames",
142
+ advanced: true,
143
+ hint: {
144
+ type: 'numeric',
145
+ validation: Z.number().gte(500).lte(30000),
146
+ defaultValue: 2000,
147
+ optional: true
148
+ }
149
+ },
150
+ maxQueueMs: {
151
+ help: "Maximum queue time (ms) for streams running behind",
152
+ advanced: true,
153
+ hint: {
154
+ type: 'numeric',
155
+ validation: Z.number().gte(0).lte(10000),
156
+ defaultValue: 1000,
157
+ optional: true
158
+ }
159
+ },
160
+ fallbackFilePath: {
161
+ help: "Optional MP4 file to use as fallback",
162
+ advanced: true,
163
+ hint: {
164
+ type: 'text',
165
+ optional: true,
166
+ envOverride: true
167
+ }
168
+ },
169
+ sourcePriority: {
170
+ help: "Initial priority order for sources (first = highest priority)",
171
+ advanced: true,
172
+ hint: {
173
+ type: 'list',
174
+ defaultValue: []
175
+ }
176
+ },
177
+ notes: {
178
+ help: "Optional notes",
179
+ hint: {
180
+ type: 'text',
181
+ optional: true
182
+ }
183
+ }
184
+ }
185
+ }
186
+ });
187
+ }
188
+ function assertUnreachable(_) {
189
+ throw new Error("Didn't expect to get here");
190
+ }
191
+ //# sourceMappingURL=info.js.map
@@ -0,0 +1 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2B,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { HardSourceSwitchState, HardSourceSwitchConfig, HardSourceSwitchCommand } from "./runtime";
2
+ import type { ViewProps } from "@norskvideo/norsk-studio/lib/extension/client-types";
3
+ export default function InlineView({ state, config }: ViewProps<HardSourceSwitchConfig, HardSourceSwitchState, HardSourceSwitchCommand>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = InlineView;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const FaTimes_1 = require("@react-icons/all-files/fa/FaTimes");
6
+ const FaPlay_1 = require("@react-icons/all-files/fa/FaPlay");
7
+ const FaCircle_1 = require("@react-icons/all-files/fa/FaCircle");
8
+ function InlineView({ state, config }) {
9
+ const sourcePriority = state.sourcePriority || [];
10
+ const availableSourceNames = state.availableSources.map(s => s.sourceName);
11
+ return ((0, jsx_runtime_1.jsx)("div", { className: "flex flex-col h-full justify-between p-2 text-gray-900 dark:text-white", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("p", { className: "text-sm font-medium", children: ["Active: ", (0, jsx_runtime_1.jsx)("span", { className: "font-normal", children: state.activeSource || 'None' })] }), (0, jsx_runtime_1.jsxs)("p", { className: "text-sm font-medium", children: ["Available: ", (0, jsx_runtime_1.jsx)("span", { className: "font-normal", children: state.availableSources.length })] }), sourcePriority.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "mt-2 space-y-2", children: [sourcePriority.map((sourceName, index) => {
12
+ const isActive = state.activeSource === sourceName;
13
+ const isAvailable = availableSourceNames.includes(sourceName);
14
+ const priorityRank = index + 1;
15
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "relative w-4 h-4 flex items-center justify-center flex-shrink-0", children: !isAvailable ? ((0, jsx_runtime_1.jsx)(FaTimes_1.FaTimes, { className: "w-4 h-4 text-red-500" })) : isActive ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(FaPlay_1.FaPlay, { className: "w-3 h-3 text-green-500" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 flex items-center justify-center opacity-30", children: (0, jsx_runtime_1.jsx)("div", { className: "w-4 h-4 bg-green-500 animate-ping duration-150" }) })] })) : ((0, jsx_runtime_1.jsx)(FaCircle_1.FaCircle, { className: "w-2 h-2 text-green-500" })) }), (0, jsx_runtime_1.jsx)("span", { className: "text-gray-900 dark:text-white flex-1 text-xs", children: sourceName }), (0, jsx_runtime_1.jsx)("span", { className: "text-gray-500 dark:text-gray-400 text-sm", children: priorityRank })] }, sourceName));
16
+ }), config.fallbackFilePath && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "relative w-4 h-4 flex items-center justify-center flex-shrink-0", children: state.activeSource === 'fallback' ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(FaPlay_1.FaPlay, { className: "w-3 h-3 text-green-500" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 flex items-center justify-center opacity-30", children: (0, jsx_runtime_1.jsx)("div", { className: "w-4 h-4 bg-green-500 animate-ping duration-150" }) })] })) : ((0, jsx_runtime_1.jsx)(FaCircle_1.FaCircle, { className: "w-2 h-2 text-green-500" })) }), (0, jsx_runtime_1.jsx)("span", { className: "text-gray-900 dark:text-white flex-1 text-xs", children: "fallback" }), (0, jsx_runtime_1.jsx)("span", { className: "text-gray-500 dark:text-gray-400 text-sm", children: "-" })] }))] }))] }) }));
17
+ }
18
+ //# sourceMappingURL=inline-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-view.js","sourceRoot":"","sources":["../../../src/processor.hardSourceSwitch/inline-view.tsx"],"names":[],"mappings":";;AA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gCAAK,SAAS,EAAC,gDAAgD,GAAO,GAClE,IACL,CACJ,CAAC,CAAC,CAAC,CACF,uBAAC,mBAAQ,IAAC,SAAS,EAAC,wBAAwB,GAAG,CAChD,GACG,EACN,iCAAM,SAAS,EAAC,8CAA8C,YAC3D,UAAU,GACN,EACP,iCAAM,SAAS,EAAC,0CAA0C,YACvD,YAAY,GACR,KApBC,UAAU,CAqBd,CACP,CAAC;wBACJ,CAAC,CAAC,EAED,MAAM,CAAC,gBAAgB,IAAI,CAC1B,iCAAK,SAAS,EAAC,yBAAyB,aACtC,gCAAK,SAAS,EAAC,iEAAiE,YAC7E,KAAK,CAAC,YAAY,KAAK,UAAU,CAAC,CAAC,CAAC,CACnC,6DACE,uBAAC,eAAM,IAAC,SAAS,EAAC,wBAAwB,GAAG,EAC7C,gCAAK,SAAS,EAAC,8DAA8D,YAC3E,gCAAK,SAAS,EAAC,gDAAgD,GAAO,GAClE,IACL,CACJ,CAAC,CAAC,CAAC,CACF,uBAAC,mBAAQ,IAAC,SAAS,EAAC,wBAAwB,GAAG,CAChD,GACG,EACN,iCAAM,SAAS,EAAC,8CAA8C,yBAEvD,EACP,iCAAM,SAAS,EAAC,0CAA0C,kBAEnD,IACH,CACP,IACG,CACP,IACG,GACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { Norsk, StreamSwitchHardNode, ImagePreviewOutputNode } from '@norskvideo/norsk-sdk';
2
+ import type { FileMp4InputNode } from '@norskvideo/norsk-sdk';
3
+ import { OnCreated, ServerComponentDefinition, StudioRuntime, ServerComponentSchemas, RuntimeUpdates, CreatedMediaNode, RelatedMediaNodes, StudioComponentInputStream, InstanceRouteInfo } from '@norskvideo/norsk-studio/lib/extension/runtime-types';
4
+ import { components } from './_gen/types';
5
+ export type HardSourceSwitchConfig = components['schemas']['Config'];
6
+ export type HardSourceSwitchState = components['schemas']['State'];
7
+ export type HardSourceSwitchEvent = components['schemas']['Events'];
8
+ export type HardSourceSwitchCommand = components['schemas']['Commands'];
9
+ export default class HardSourceSwitchDefinition implements ServerComponentDefinition<HardSourceSwitchConfig, HardSourceSwitchNode, HardSourceSwitchState, HardSourceSwitchCommand, HardSourceSwitchEvent> {
10
+ create(norsk: Norsk, cfg: HardSourceSwitchConfig, cb: OnCreated<HardSourceSwitchNode>, { updates }: StudioRuntime<HardSourceSwitchState, HardSourceSwitchCommand, HardSourceSwitchEvent>): Promise<void>;
11
+ handleCommand(node: HardSourceSwitchNode, command: HardSourceSwitchCommand): Promise<void>;
12
+ schemas(): Promise<ServerComponentSchemas>;
13
+ instanceRoutes(): Promise<InstanceRouteInfo<HardSourceSwitchConfig, HardSourceSwitchNode, HardSourceSwitchState, HardSourceSwitchCommand, HardSourceSwitchEvent>[]>;
14
+ }
15
+ export declare class HardSourceSwitchNode implements CreatedMediaNode {
16
+ id: string;
17
+ relatedMediaNodes: RelatedMediaNodes;
18
+ norsk: Norsk;
19
+ cfg: HardSourceSwitchConfig;
20
+ updates: RuntimeUpdates<HardSourceSwitchState, HardSourceSwitchCommand, HardSourceSwitchEvent>;
21
+ initialised: Promise<void>;
22
+ switchNode?: StreamSwitchHardNode<string>;
23
+ activeSource: string;
24
+ subscriptions: StudioComponentInputStream[];
25
+ availableSourceNames: string[];
26
+ sourcePreviews: Map<string, ImagePreviewOutputNode>;
27
+ outputPreview?: ImagePreviewOutputNode;
28
+ sourceFormats: Map<string, {
29
+ resolution: string;
30
+ frameRate: string;
31
+ codec: string;
32
+ }>;
33
+ sourceStreams: Map<string, StudioComponentInputStream>;
34
+ isInitialized: boolean;
35
+ previewCreationTimeout: NodeJS.Timeout | null;
36
+ workingPreviews: Set<string>;
37
+ lastFrameTime: Map<string, number>;
38
+ healthCheckInterval: NodeJS.Timeout | null;
39
+ isFailingOver: boolean;
40
+ switchTime: Map<string, number>;
41
+ sourcePriority: string[];
42
+ mp4?: FileMp4InputNode;
43
+ mp4Playing: boolean;
44
+ static create(norsk: Norsk, cfg: HardSourceSwitchConfig, updates: RuntimeUpdates<HardSourceSwitchState, HardSourceSwitchCommand, HardSourceSwitchEvent>): Promise<HardSourceSwitchNode>;
45
+ constructor(norsk: Norsk, cfg: HardSourceSwitchConfig, updates: RuntimeUpdates<HardSourceSwitchState, HardSourceSwitchCommand, HardSourceSwitchEvent>);
46
+ initialise(): Promise<void>;
47
+ subscribe(sources: StudioComponentInputStream[]): Promise<void>;
48
+ switchToSource(sourceName: string): Promise<{
49
+ status: 'success' | 'error';
50
+ error?: string;
51
+ }>;
52
+ setPriorityOrder(sources: string[]): void;
53
+ extractFormatFromDefinition(videoStream?: StudioComponentInputStream): {
54
+ resolution: string;
55
+ frameRate: string;
56
+ codec: string;
57
+ };
58
+ createSourcePreview(sourceName: string): Promise<void>;
59
+ hasFormatChange(prev: {
60
+ resolution: string;
61
+ frameRate: string;
62
+ codec: string;
63
+ }, next: {
64
+ resolution: string;
65
+ frameRate: string;
66
+ codec: string;
67
+ }): boolean;
68
+ formatToString(format: {
69
+ resolution: string;
70
+ frameRate: string;
71
+ codec: string;
72
+ }): string;
73
+ checkFormatMismatches(newSource: string, newFormat: {
74
+ resolution: string;
75
+ frameRate: string;
76
+ codec: string;
77
+ }): void;
78
+ startHealthMonitoring(): void;
79
+ checkSourceHealth(): Promise<void>;
80
+ close(): Promise<void>;
81
+ }