@norskvideo/norsk-studio-alpha 1.27.0-2025-07-09-0fcad3ea
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/README.md +10 -0
- package/client/info.js +43461 -0
- package/client/processor.audioLevel/styles.css +165 -0
- package/client/shared/style.css +1627 -0
- package/client/shared/tailwind.css +31 -0
- package/client/style.css +1074 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +14 -0
- package/lib/index.js.map +1 -0
- package/lib/info.d.ts +3 -0
- package/lib/info.js +44 -0
- package/lib/info.js.map +1 -0
- package/lib/input.decklink/info.d.ts +3 -0
- package/lib/input.decklink/info.js +51 -0
- package/lib/input.decklink/info.js.map +1 -0
- package/lib/input.decklink/runtime.d.ts +12 -0
- package/lib/input.decklink/runtime.js +22 -0
- package/lib/input.decklink/runtime.js.map +1 -0
- package/lib/input.decklink/types.d.ts +23 -0
- package/lib/input.decklink/types.js +3 -0
- package/lib/input.decklink/types.js.map +1 -0
- package/lib/input.decklink/types.yaml +32 -0
- package/lib/input.mp4file/info.d.ts +3 -0
- package/lib/input.mp4file/info.js +34 -0
- package/lib/input.mp4file/info.js.map +1 -0
- package/lib/input.mp4file/runtime.d.ts +14 -0
- package/lib/input.mp4file/runtime.js +33 -0
- package/lib/input.mp4file/runtime.js.map +1 -0
- package/lib/input.mp4file/types.d.ts +23 -0
- package/lib/input.mp4file/types.js +3 -0
- package/lib/input.mp4file/types.js.map +1 -0
- package/lib/input.mp4file/types.yaml +30 -0
- package/lib/input.ndi/info.d.ts +3 -0
- package/lib/input.ndi/info.js +52 -0
- package/lib/input.ndi/info.js.map +1 -0
- package/lib/input.ndi/runtime.d.ts +24 -0
- package/lib/input.ndi/runtime.js +60 -0
- package/lib/input.ndi/runtime.js.map +1 -0
- package/lib/input.ndi/source-selection.d.ts +10 -0
- package/lib/input.ndi/source-selection.js +84 -0
- package/lib/input.ndi/source-selection.js.map +1 -0
- package/lib/input.ndi/types.d.ts +52 -0
- package/lib/input.ndi/types.js +3 -0
- package/lib/input.ndi/types.js.map +1 -0
- package/lib/input.ndi/types.yaml +37 -0
- package/lib/output.ndi/info.d.ts +8 -0
- package/lib/output.ndi/info.js +61 -0
- package/lib/output.ndi/info.js.map +1 -0
- package/lib/output.ndi/inline-view.d.ts +6 -0
- package/lib/output.ndi/inline-view.js +12 -0
- package/lib/output.ndi/inline-view.js.map +1 -0
- package/lib/output.ndi/runtime.d.ts +14 -0
- package/lib/output.ndi/runtime.js +35 -0
- package/lib/output.ndi/runtime.js.map +1 -0
- package/lib/output.ndi/types.d.ts +35 -0
- package/lib/output.ndi/types.js +3 -0
- package/lib/output.ndi/types.js.map +1 -0
- package/lib/output.ndi/types.yaml +72 -0
- package/lib/output.recorder/info.d.ts +10 -0
- package/lib/output.recorder/info.js +79 -0
- package/lib/output.recorder/info.js.map +1 -0
- package/lib/output.recorder/runtime.d.ts +66 -0
- package/lib/output.recorder/runtime.js +301 -0
- package/lib/output.recorder/runtime.js.map +1 -0
- package/lib/output.recorder/types.d.ts +225 -0
- package/lib/output.recorder/types.js +3 -0
- package/lib/output.recorder/types.js.map +1 -0
- package/lib/output.recorder/types.yaml +211 -0
- package/lib/processor.actionReplay/info.d.ts +25 -0
- package/lib/processor.actionReplay/info.js +77 -0
- package/lib/processor.actionReplay/info.js.map +1 -0
- package/lib/processor.actionReplay/runtime.d.ts +38 -0
- package/lib/processor.actionReplay/runtime.js +225 -0
- package/lib/processor.actionReplay/runtime.js.map +1 -0
- package/lib/processor.actionReplay/summary.d.ts +4 -0
- package/lib/processor.actionReplay/summary.js +76 -0
- package/lib/processor.actionReplay/summary.js.map +1 -0
- package/lib/processor.actionReplay/types.d.ts +38 -0
- package/lib/processor.actionReplay/types.js +3 -0
- package/lib/processor.actionReplay/types.js.map +1 -0
- package/lib/processor.actionReplay/types.yaml +74 -0
- package/lib/processor.audioLevel/info.d.ts +27 -0
- package/lib/processor.audioLevel/info.js +61 -0
- package/lib/processor.audioLevel/info.js.map +1 -0
- package/lib/processor.audioLevel/inline-view.d.ts +4 -0
- package/lib/processor.audioLevel/inline-view.js +26 -0
- package/lib/processor.audioLevel/inline-view.js.map +1 -0
- package/lib/processor.audioLevel/runtime.d.ts +26 -0
- package/lib/processor.audioLevel/runtime.js +86 -0
- package/lib/processor.audioLevel/runtime.js.map +1 -0
- package/lib/processor.audioLevel/summary-view.d.ts +7 -0
- package/lib/processor.audioLevel/summary-view.js +37 -0
- package/lib/processor.audioLevel/summary-view.js.map +1 -0
- package/lib/processor.audioLevel/types.d.ts +42 -0
- package/lib/processor.audioLevel/types.js +3 -0
- package/lib/processor.audioLevel/types.js.map +1 -0
- package/lib/processor.audioLevel/types.yaml +83 -0
- package/lib/processor.gemini-poc/info.d.ts +8 -0
- package/lib/processor.gemini-poc/info.js +59 -0
- package/lib/processor.gemini-poc/info.js.map +1 -0
- package/lib/processor.gemini-poc/runtime.d.ts +38 -0
- package/lib/processor.gemini-poc/runtime.js +132 -0
- package/lib/processor.gemini-poc/runtime.js.map +1 -0
- package/lib/processor.gemini-poc/types.d.ts +23 -0
- package/lib/processor.gemini-poc/types.js +3 -0
- package/lib/processor.gemini-poc/types.js.map +1 -0
- package/lib/processor.gemini-poc/types.yaml +43 -0
- package/lib/processor.mixMinus/info.d.ts +7 -0
- package/lib/processor.mixMinus/info.js +40 -0
- package/lib/processor.mixMinus/info.js.map +1 -0
- package/lib/processor.mixMinus/runtime.d.ts +23 -0
- package/lib/processor.mixMinus/runtime.js +85 -0
- package/lib/processor.mixMinus/runtime.js.map +1 -0
- package/lib/processor.mixMinus/types.d.ts +18 -0
- package/lib/processor.mixMinus/types.js +3 -0
- package/lib/processor.mixMinus/types.js.map +1 -0
- package/lib/processor.mixMinus/types.yaml +19 -0
- package/lib/processor.monetise/info.d.ts +3 -0
- package/lib/processor.monetise/info.js +72 -0
- package/lib/processor.monetise/info.js.map +1 -0
- package/lib/processor.monetise/runtime.d.ts +62 -0
- package/lib/processor.monetise/runtime.js +217 -0
- package/lib/processor.monetise/runtime.js.map +1 -0
- package/lib/processor.monetise/summary.d.ts +7 -0
- package/lib/processor.monetise/summary.js +40 -0
- package/lib/processor.monetise/summary.js.map +1 -0
- package/lib/processor.monetise/types.d.ts +16 -0
- package/lib/processor.monetise/types.js +3 -0
- package/lib/processor.monetise/types.js.map +1 -0
- package/lib/processor.monetise/types.yaml +9 -0
- package/lib/processor.whisper-transcribe/info.d.ts +9 -0
- package/lib/processor.whisper-transcribe/info.js +46 -0
- package/lib/processor.whisper-transcribe/info.js.map +1 -0
- package/lib/processor.whisper-transcribe/runtime.d.ts +22 -0
- package/lib/processor.whisper-transcribe/runtime.js +70 -0
- package/lib/processor.whisper-transcribe/runtime.js.map +1 -0
- package/lib/processor.whisper-transcribe/types.d.ts +21 -0
- package/lib/processor.whisper-transcribe/types.js +3 -0
- package/lib/processor.whisper-transcribe/types.js.map +1 -0
- package/lib/processor.whisper-transcribe/types.yaml +28 -0
- package/lib/shared/schemas.d.ts +8 -0
- package/lib/shared/schemas.js +44 -0
- package/lib/shared/schemas.js.map +1 -0
- package/lib/test/output.recorder.d.ts +1 -0
- package/lib/test/output.recorder.js +186 -0
- package/lib/test/output.recorder.js.map +1 -0
- package/lib/util.timestamps/info.d.ts +14 -0
- package/lib/util.timestamps/info.js +64 -0
- package/lib/util.timestamps/info.js.map +1 -0
- package/lib/util.timestamps/inline-view.d.ts +6 -0
- package/lib/util.timestamps/inline-view.js +95 -0
- package/lib/util.timestamps/inline-view.js.map +1 -0
- package/lib/util.timestamps/runtime.d.ts +13 -0
- package/lib/util.timestamps/runtime.js +51 -0
- package/lib/util.timestamps/runtime.js.map +1 -0
- package/lib/util.timestamps/types.d.ts +36 -0
- package/lib/util.timestamps/types.js +3 -0
- package/lib/util.timestamps/types.js.map +1 -0
- package/lib/util.timestamps/types.yaml +74 -0
- package/package.json +57 -0
@@ -0,0 +1,217 @@
|
|
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
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
const norsk_sdk_1 = require("@norskvideo/norsk-sdk");
|
30
|
+
const base_nodes_1 = require("@norskvideo/norsk-studio/lib/extension/base-nodes");
|
31
|
+
const util_1 = require("@norskvideo/norsk-studio/lib/shared/util");
|
32
|
+
const webrtcSettings_1 = require("@norskvideo/norsk-studio-built-ins/lib/shared/webrtcSettings");
|
33
|
+
const path_1 = __importDefault(require("path"));
|
34
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
35
|
+
const yaml_1 = __importDefault(require("yaml"));
|
36
|
+
const $RefParser = __importStar(require("@apidevtools/json-schema-ref-parser"));
|
37
|
+
const schemas_1 = require("../shared/schemas");
|
38
|
+
class MonetiseDefinition {
|
39
|
+
async create(norsk, cfg, cb, runtime) {
|
40
|
+
const node = new MonetiseOutput(norsk, runtime, cfg);
|
41
|
+
await node.initialised;
|
42
|
+
cb(node);
|
43
|
+
}
|
44
|
+
async schemas() {
|
45
|
+
return (0, schemas_1.schemaFromTypes)(path_1.default.join(__dirname, 'types.yaml'), { config: 'config' });
|
46
|
+
}
|
47
|
+
handleCommand(node, command) {
|
48
|
+
const t = command.type;
|
49
|
+
switch (t) {
|
50
|
+
case 'inject-advert':
|
51
|
+
node.injectAdvert(command.durationMs);
|
52
|
+
break;
|
53
|
+
default:
|
54
|
+
(0, util_1.assertUnreachable)(t);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
async instanceRoutes() {
|
58
|
+
const absolutePath = path_1.default.join(__dirname, 'types.yaml');
|
59
|
+
const types = await promises_1.default.readFile(absolutePath);
|
60
|
+
const parsedYaml = yaml_1.default.parse(types.toString());
|
61
|
+
const resolved = await $RefParser.dereference(absolutePath, parsedYaml);
|
62
|
+
return [
|
63
|
+
{
|
64
|
+
url: '/inject',
|
65
|
+
method: 'POST',
|
66
|
+
handler: ({ runtime: { updates } }) => ((req, res) => {
|
67
|
+
const inject = req.body;
|
68
|
+
if (inject.durationMs === undefined) {
|
69
|
+
res.status(400).send();
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
updates.sendCommand({
|
73
|
+
type: 'inject-advert',
|
74
|
+
durationMs: inject.durationMs,
|
75
|
+
});
|
76
|
+
res.status(204).send();
|
77
|
+
}
|
78
|
+
}),
|
79
|
+
requestBody: {
|
80
|
+
description: "The details of the inject marker",
|
81
|
+
content: {
|
82
|
+
"application/json": {
|
83
|
+
schema: resolved.components.schemas['inject']
|
84
|
+
},
|
85
|
+
}
|
86
|
+
},
|
87
|
+
responses: {
|
88
|
+
'200': {
|
89
|
+
description: "The injection was requested successfully, and will be applied in due course"
|
90
|
+
},
|
91
|
+
'400': {
|
92
|
+
description: "There was a problem with the request"
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
];
|
97
|
+
}
|
98
|
+
}
|
99
|
+
exports.default = MonetiseDefinition;
|
100
|
+
class MonetiseOutput extends base_nodes_1.CustomAutoDuplexNode {
|
101
|
+
initialised;
|
102
|
+
norsk;
|
103
|
+
updates;
|
104
|
+
shared;
|
105
|
+
cfg;
|
106
|
+
encoder;
|
107
|
+
whep;
|
108
|
+
delayed;
|
109
|
+
ancillary;
|
110
|
+
output;
|
111
|
+
start;
|
112
|
+
constructor(norsk, runtime, cfg) {
|
113
|
+
super(cfg.id);
|
114
|
+
this.cfg = cfg;
|
115
|
+
this.norsk = norsk;
|
116
|
+
this.updates = runtime.updates;
|
117
|
+
this.shared = runtime.shared;
|
118
|
+
this.initialised = this.initialise();
|
119
|
+
this.start = new Date();
|
120
|
+
}
|
121
|
+
async initialise() {
|
122
|
+
const whepCfg = {
|
123
|
+
id: `${this.cfg.id}-whep`,
|
124
|
+
name: `${this.cfg.id}`,
|
125
|
+
bufferDelayMs: 500.0,
|
126
|
+
...(0, webrtcSettings_1.webRtcSettings)(this.cfg.__global.iceServers),
|
127
|
+
};
|
128
|
+
this.whep = await this.norsk.output.whep(whepCfg);
|
129
|
+
this.ancillary = await this.norsk.processor.transform.ancillary({ id: `${this.cfg.id}-inject` });
|
130
|
+
this.delayed = await this.norsk.processor.transform.jitterBuffer({
|
131
|
+
id: `${this.cfg.id}-delay`,
|
132
|
+
delayMs: 2000
|
133
|
+
});
|
134
|
+
this.output = await this.norsk.processor.transform.streamMetadataOverride({
|
135
|
+
id: `${this.cfg.id}-output`
|
136
|
+
});
|
137
|
+
this.output.subscribe([
|
138
|
+
{ source: this.ancillary, sourceSelector: norsk_sdk_1.selectAncillary },
|
139
|
+
{ source: this.delayed, sourceSelector: norsk_sdk_1.selectAV }
|
140
|
+
]);
|
141
|
+
this.setup({
|
142
|
+
input: this.delayed,
|
143
|
+
output: [this.output]
|
144
|
+
});
|
145
|
+
}
|
146
|
+
injectAdvert(durationMs) {
|
147
|
+
this.updates.raiseEvent({ type: 'advert-started', durationMs });
|
148
|
+
let remaining = durationMs;
|
149
|
+
const updateTick = setInterval(() => {
|
150
|
+
remaining -= 1000;
|
151
|
+
this.updates.raiseEvent({
|
152
|
+
type: 'advert-tick',
|
153
|
+
timeLeftMs: Math.max(0, remaining)
|
154
|
+
});
|
155
|
+
}, 1000);
|
156
|
+
setTimeout(() => {
|
157
|
+
this.updates.raiseEvent({ type: 'advert-finished' });
|
158
|
+
clearInterval(updateTick);
|
159
|
+
}, durationMs);
|
160
|
+
const id = Math.random().toString().slice(-5);
|
161
|
+
this.ancillary?.sendScte35({
|
162
|
+
streamId: 1,
|
163
|
+
programNumber: 1,
|
164
|
+
sourceName: 'monetise',
|
165
|
+
renditionName: 'default'
|
166
|
+
}, {
|
167
|
+
sapType: 3,
|
168
|
+
protocolVersion: 0,
|
169
|
+
encryptedPacket: false,
|
170
|
+
encryptionAlgorithm: 0,
|
171
|
+
ptsAdjustment: BigInt(0),
|
172
|
+
cwIndex: 0,
|
173
|
+
tier: 4095,
|
174
|
+
spliceCommand: {
|
175
|
+
type: "insert",
|
176
|
+
value: {
|
177
|
+
spliceEventId: Number(id),
|
178
|
+
spliceEventCancelIndicator: false,
|
179
|
+
outOfNetworkIndicator: true,
|
180
|
+
spliceImmediateFlag: true,
|
181
|
+
mode: {
|
182
|
+
mode: 'program'
|
183
|
+
},
|
184
|
+
breakDuration: { autoReturn: true, duration: BigInt(durationMs * 90) },
|
185
|
+
uniqueProgramId: 12345,
|
186
|
+
availNum: 0,
|
187
|
+
availsExpected: 0
|
188
|
+
},
|
189
|
+
},
|
190
|
+
descriptors: []
|
191
|
+
});
|
192
|
+
}
|
193
|
+
async subscribe(sources) {
|
194
|
+
if (!this.whep)
|
195
|
+
return;
|
196
|
+
this.delayed?.subscribe(sources.map((s) => s.select()));
|
197
|
+
this.ancillary?.subscribe(sources.map((s) => s.select()));
|
198
|
+
await this.setupPreview(sources);
|
199
|
+
}
|
200
|
+
async setupPreview(sources) {
|
201
|
+
const video = sources.find((s) => s.isMedia("video"));
|
202
|
+
const audio = sources.find((s) => s.isMedia("audio"));
|
203
|
+
if (!video || !audio)
|
204
|
+
return;
|
205
|
+
this.encoder = await this.shared.previewEncode(video.select(), this.cfg.__global.hardware);
|
206
|
+
this.whep?.subscribe([
|
207
|
+
{ source: this.encoder, sourceSelector: norsk_sdk_1.selectVideo },
|
208
|
+
audio.select()
|
209
|
+
], (ctx) => {
|
210
|
+
if (ctx.streams.length == 2 && this.whep?.endpointUrl) {
|
211
|
+
this.updates.raiseEvent({ type: 'url-published', url: this.whep?.endpointUrl });
|
212
|
+
}
|
213
|
+
return (0, norsk_sdk_1.requireAV)(ctx);
|
214
|
+
});
|
215
|
+
}
|
216
|
+
}
|
217
|
+
//# sourceMappingURL=runtime.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/processor.monetise/runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkO;AAGlO,kFAAyF;AACzF,mEAA6E;AAE7E,iGAA6F;AAC7F,gDAAwB;AACxB,2DAA6B;AAC7B,gDAAwB;AACxB,gFAAkE;AAGlE,+CAAoD;AAuCpD,MAAqB,kBAAkB;IACrC,KAAK,CAAC,MAAM,CAAC,KAAY,EAAE,GAA2B,EAAE,EAA6B,EAAE,OAAuF;QAC5K,MAAM,IAAI,GAAG,IAAI,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QACrD,MAAM,IAAI,CAAC,WAAW,CAAC;QACvB,EAAE,CAAC,IAAI,CAAC,CAAC;IACX,CAAC;IAED,KAAK,CAAC,OAAO;QACX,OAAO,IAAA,yBAAe,EAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EACvD,EAAE,MAAM,EAAE,QAAQ,EAAE,CACrB,CAAA;IACH,CAAC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M,EAAE;SACf,EAAE,CAAC,GAAG,EAAE,EAAE;YACT,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC;gBACtD,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAA;YACjF,CAAC;YACD,OAAO,IAAA,qBAAS,EAAC,GAAG,CAAC,CAAC;QACxB,CAAC,CAAC,CAAA;IAEN,CAAC;CACF"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { MonetiseOutputCommand, MonetiseOutputSettings, MonetiseOutputState } from "./runtime";
|
2
|
+
declare function InlineView({ state, config, sendCommand }: {
|
3
|
+
state: MonetiseOutputState;
|
4
|
+
config: MonetiseOutputSettings;
|
5
|
+
sendCommand: (command: MonetiseOutputCommand) => void;
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
7
|
+
export default InlineView;
|
@@ -0,0 +1,40 @@
|
|
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, sendCommand }) {
|
7
|
+
const url = state.url;
|
8
|
+
const id = config.id;
|
9
|
+
const previewVideo = (0, react_1.useRef)(null);
|
10
|
+
const durationSlider = (0, react_1.useRef)(null);
|
11
|
+
(0, react_1.useEffect)(() => {
|
12
|
+
if (!url)
|
13
|
+
return;
|
14
|
+
setTimeout(() => {
|
15
|
+
if (!url)
|
16
|
+
return;
|
17
|
+
if (!previewVideo.current)
|
18
|
+
return;
|
19
|
+
const client = new webrtc_client_1.WhepClient({ url, container: previewVideo.current });
|
20
|
+
void client.start();
|
21
|
+
}, 1000.0);
|
22
|
+
}, [state.url]);
|
23
|
+
if (!url)
|
24
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Starting up..." });
|
25
|
+
{ }
|
26
|
+
return (0, jsx_runtime_1.jsx)("div", { className: "processor-monetise", children: (0, jsx_runtime_1.jsxs)("div", { className: "mb-5", children: [(0, jsx_runtime_1.jsx)("div", { ref: previewVideo, className: "", id: `preview-${id}` }), state.currentAdvert ? (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Advert currently playing: ", Math.floor(state.currentAdvert.timeLeftMs / 1000), "s"] }) :
|
27
|
+
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("label", { htmlFor: "default-range", className: "block mb-2 text-sm font-medium text-gray-900 dark:text-white", children: ["Advert Duration (", durationSlider.current?.value ?? 16, "s)"] }), (0, jsx_runtime_1.jsx)("input", { ref: durationSlider, id: "default-range", type: "range", defaultValue: "16", min: "16", max: "120", className: "w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700" }), (0, jsx_runtime_1.jsx)("button", { onClick: sendAdvertCommand, type: "button", className: "mt-2 mb-2 text-white w-full justify-center bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800", children: "Inject Advert" })] })] }) });
|
28
|
+
function sendAdvertCommand() {
|
29
|
+
if (!previewVideo.current)
|
30
|
+
return;
|
31
|
+
if (!durationSlider.current)
|
32
|
+
return;
|
33
|
+
sendCommand({
|
34
|
+
type: "inject-advert",
|
35
|
+
durationMs: parseInt(durationSlider.current.value, 10) * 1000
|
36
|
+
});
|
37
|
+
}
|
38
|
+
}
|
39
|
+
exports.default = InlineView;
|
40
|
+
//# sourceMappingURL=summary.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"summary.js","sourceRoot":"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AS,EAAC,8DAA8D,kCAAmB,cAAc,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE,UAAW,EACxK,kCAAO,GAAG,EAAE,cAAc,EAAE,EAAE,EAAC,eAAe,EAAC,IAAI,EAAC,OAAO,EAAC,YAAY,EAAC,IAAI,EAAC,GAAG,EAAC,IAAI,EAAC,GAAG,EAAC,KAAK,EAAC,SAAS,EAAC,mFAAmF,GAAS,EACvM,mCAAQ,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,wQAAwQ,8BAE3T,IACR,IAEA,GACF,CAAA;IAEP,SAAS,iBAAiB;QACxB,IAAI,CAAC,YAAY,CAAC,OAAO;YAAE,OAAO;QAClC,IAAI,CAAC,cAAc,CAAC,OAAO;YAAE,OAAO;QACpC,WAAW,CAAC;YACV,IAAI,EAAE,eAAe;YACrB,UAAU,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI;SAC9D,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAED,kBAAe,UAAU,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export type paths = Record<string, never>;
|
2
|
+
export type webhooks = Record<string, never>;
|
3
|
+
export interface components {
|
4
|
+
schemas: {
|
5
|
+
inject: {
|
6
|
+
durationMs?: number;
|
7
|
+
};
|
8
|
+
};
|
9
|
+
responses: never;
|
10
|
+
parameters: never;
|
11
|
+
requestBodies: never;
|
12
|
+
headers: never;
|
13
|
+
pathItems: never;
|
14
|
+
}
|
15
|
+
export type $defs = Record<string, never>;
|
16
|
+
export type operations = Record<string, never>;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/processor.monetise/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type Registration from "@norskvideo/norsk-studio/lib/extension/registration";
|
2
|
+
export default function ({ defineComponent, validation: { Z } }: Registration): import("@norskvideo/norsk-studio/lib/extension/client-types").NodeInfo<{
|
3
|
+
id: string;
|
4
|
+
displayName: string;
|
5
|
+
model: string;
|
6
|
+
translate: boolean;
|
7
|
+
language: string;
|
8
|
+
notes?: string;
|
9
|
+
}, object, object, object>;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = default_1;
|
4
|
+
function default_1({ defineComponent, validation: { Z } }) {
|
5
|
+
return defineComponent({
|
6
|
+
identifier: 'processor.whisper-transcribe',
|
7
|
+
category: 'processor',
|
8
|
+
name: "Whisper Transcribe",
|
9
|
+
description: "This component transcribes audio from a video stream.",
|
10
|
+
subscription: {
|
11
|
+
accepts: {
|
12
|
+
type: 'simple-stream',
|
13
|
+
audio: true,
|
14
|
+
video: true
|
15
|
+
},
|
16
|
+
produces: {
|
17
|
+
type: "simple-stream",
|
18
|
+
subtitle: true
|
19
|
+
}
|
20
|
+
},
|
21
|
+
extraValidation: function (ctx) {
|
22
|
+
const video = ctx.videoInputs();
|
23
|
+
const audio = ctx.audioInputs();
|
24
|
+
if (video.length !== 1) {
|
25
|
+
ctx.addError("Whisper Transcribe requires a single video stream to use as a reference");
|
26
|
+
}
|
27
|
+
if (audio.length !== 1) {
|
28
|
+
ctx.addError("Whisper Transcribe requires a single audio stream to transcribe");
|
29
|
+
}
|
30
|
+
},
|
31
|
+
display: (desc) => {
|
32
|
+
return {
|
33
|
+
model: desc.config.model
|
34
|
+
};
|
35
|
+
},
|
36
|
+
configForm: {
|
37
|
+
form: {
|
38
|
+
model: { help: "The ggml model path", hint: { type: 'text', validation: Z.string().min(1, "Choosing a model is mandatory") } },
|
39
|
+
translate: { help: "Whether to translate the output to English", hint: { type: 'boolean', optional: true, defaultValue: false } },
|
40
|
+
language: { help: "Source language (otherwise automatic)", hint: { type: 'text', optional: true, validation: Z.union([Z.string().length(0), Z.string().min(1)]) } },
|
41
|
+
notes: { help: "Notes about this component", hint: { type: 'text', optional: true } },
|
42
|
+
}
|
43
|
+
}
|
44
|
+
});
|
45
|
+
}
|
46
|
+
//# sourceMappingURL=info.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/processor.whisper-transcribe/info.ts"],"names":[],"mappings":";;AAGA,4BA4CC;AA5CD,mBAAwB,EACtB,eAAe,EACf,UAAU,EAAE,EAAE,CAAC,EAAE,EACJ;IACb,OAAO,eAAe,CAA0B;QAC9C,UAAU,EAAE,8BAA8B;QAC1C,QAAQ,EAAE,WAAW;QACrB,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE,uDAAuD;QACpE,YAAY,EAAE;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,IAAI;aACZ;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,eAAe;gBACrB,QAAQ,EAAE,IAAI;aACf;SACF;QACD,eAAe,EAAE,UAAS,GAAG;YAC3B,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;YAChC,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;YAChC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACvB,GAAG,CAAC,QAAQ,CAAC,yEAAyE,CAAC,CAAA;YACzF,CAAC;YACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACvB,GAAG,CAAC,QAAQ,CAAC,iEAAiE,CAAC,CAAA;YACjF,CAAC;QACH,CAAC;QACD,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YAChB,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;aACzB,CAAA;QACH,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,KAAK,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,+BAA+B,CAAC,EAAE,EAAE;gBAC9H,SAAS,EAAE,EAAE,IAAI,EAAE,4CAA4C,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE;gBACjI,QAAQ,EAAE,EAAE,IAAI,EAAE,uCAAuC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE;gBACnK,KAAK,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;aACtF;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { AudioTranscribeWhisperNode, Norsk, StreamKeyOverrideNode, StreamMetadataOverrideNode } from '@norskvideo/norsk-sdk';
|
2
|
+
import { CreatedMediaNode, OnCreated, RelatedMediaNodes, ServerComponentDefinition, ServerComponentSchemas, StudioComponentInputStream } from '@norskvideo/norsk-studio/lib/extension/runtime-types';
|
3
|
+
import { components } from './types';
|
4
|
+
export type WhisperTranscribeConfig = components['schemas']['WhisperTranscribeConfig'];
|
5
|
+
export default class WhisperTranscribeDefinition implements ServerComponentDefinition<WhisperTranscribeConfig, WhisperTranscribeNode> {
|
6
|
+
schemas(): Promise<ServerComponentSchemas>;
|
7
|
+
create(norsk: Norsk, cfg: WhisperTranscribeConfig, cb: OnCreated<WhisperTranscribeNode>): Promise<void>;
|
8
|
+
}
|
9
|
+
declare class WhisperTranscribeNode implements CreatedMediaNode {
|
10
|
+
norsk: Norsk;
|
11
|
+
cfg: WhisperTranscribeConfig;
|
12
|
+
initialised: Promise<void>;
|
13
|
+
whisper?: AudioTranscribeWhisperNode;
|
14
|
+
streamkey?: StreamKeyOverrideNode;
|
15
|
+
output?: StreamMetadataOverrideNode;
|
16
|
+
constructor(norsk: Norsk, cfg: WhisperTranscribeConfig);
|
17
|
+
get id(): string;
|
18
|
+
relatedMediaNodes: RelatedMediaNodes;
|
19
|
+
initialise(): Promise<void>;
|
20
|
+
subscribe(sources: StudioComponentInputStream[]): Promise<void>;
|
21
|
+
}
|
22
|
+
export {};
|
@@ -0,0 +1,70 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const norsk_sdk_1 = require("@norskvideo/norsk-sdk");
|
7
|
+
const runtime_types_1 = require("@norskvideo/norsk-studio/lib/extension/runtime-types");
|
8
|
+
const path_1 = __importDefault(require("path"));
|
9
|
+
const schemas_1 = require("../shared/schemas");
|
10
|
+
class WhisperTranscribeDefinition {
|
11
|
+
async schemas() {
|
12
|
+
return (0, schemas_1.schemaFromTypes)(path_1.default.join(__dirname, 'types.yaml'), {
|
13
|
+
config: 'WhisperTranscribeConfig'
|
14
|
+
});
|
15
|
+
}
|
16
|
+
async create(norsk, cfg, cb) {
|
17
|
+
const node = new WhisperTranscribeNode(norsk, cfg);
|
18
|
+
await node.initialised;
|
19
|
+
cb(node);
|
20
|
+
}
|
21
|
+
}
|
22
|
+
exports.default = WhisperTranscribeDefinition;
|
23
|
+
class WhisperTranscribeNode {
|
24
|
+
norsk;
|
25
|
+
cfg;
|
26
|
+
initialised;
|
27
|
+
whisper;
|
28
|
+
streamkey;
|
29
|
+
output;
|
30
|
+
constructor(norsk, cfg) {
|
31
|
+
this.norsk = norsk;
|
32
|
+
this.cfg = cfg;
|
33
|
+
this.initialised = this.initialise();
|
34
|
+
}
|
35
|
+
get id() { return this.cfg.id; }
|
36
|
+
relatedMediaNodes = new runtime_types_1.RelatedMediaNodes();
|
37
|
+
async initialise() {
|
38
|
+
this.output = await this.norsk.processor.transform.streamMetadataOverride({ id: `${this.id}-output` });
|
39
|
+
this.relatedMediaNodes.addOutput(this.output);
|
40
|
+
}
|
41
|
+
async subscribe(sources) {
|
42
|
+
if (!this.whisper) {
|
43
|
+
this.whisper = await this.norsk.processor.transform.audioTranscribeWhisper({
|
44
|
+
id: `${this.id}-whisper`,
|
45
|
+
outputStreamId: 540,
|
46
|
+
model: this.cfg.model,
|
47
|
+
language: this.cfg.language,
|
48
|
+
useGpu: true,
|
49
|
+
});
|
50
|
+
this.relatedMediaNodes.addInput(this.whisper);
|
51
|
+
}
|
52
|
+
const video = sources.find((s) => s.isMedia("video"));
|
53
|
+
const audio = sources.find((s) => s.isMedia("audio"));
|
54
|
+
if (video && audio && video.metadata) {
|
55
|
+
this.whisper.subscribe([audio.select()], undefined);
|
56
|
+
this.streamkey = await this.norsk.processor.transform.streamKeyOverride({
|
57
|
+
streamKey: { ...video.metadata.streamKey, renditionName: 'subs' }
|
58
|
+
});
|
59
|
+
this.streamkey.subscribe([{
|
60
|
+
source: this.whisper,
|
61
|
+
sourceSelector: norsk_sdk_1.selectSubtitles
|
62
|
+
}]);
|
63
|
+
this.output?.subscribe([{
|
64
|
+
source: this.streamkey,
|
65
|
+
sourceSelector: norsk_sdk_1.selectSubtitles
|
66
|
+
}]);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
//# sourceMappingURL=runtime.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/processor.whisper-transcribe/runtime.ts"],"names":[],"mappings":";;;;;AAAA,qDAA8I;AAC9I,wFAAqM;AACrM,gDAAwB;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C,CAAC;oBACtB,MAAM,EAAE,IAAI,CAAC,SAAS;oBACtB,cAAc,EAAE,2BAAe;iBAChC,CAAC,CAAC,CAAA;QACL,CAAC;IACH,CAAC;CACF"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export type paths = Record<string, never>;
|
2
|
+
export type webhooks = Record<string, never>;
|
3
|
+
export interface components {
|
4
|
+
schemas: {
|
5
|
+
WhisperTranscribeConfig: {
|
6
|
+
id: string;
|
7
|
+
displayName: string;
|
8
|
+
model: string;
|
9
|
+
translate: boolean;
|
10
|
+
language: string;
|
11
|
+
notes?: string;
|
12
|
+
};
|
13
|
+
};
|
14
|
+
responses: never;
|
15
|
+
parameters: never;
|
16
|
+
requestBodies: never;
|
17
|
+
headers: never;
|
18
|
+
pathItems: never;
|
19
|
+
}
|
20
|
+
export type $defs = Record<string, never>;
|
21
|
+
export type operations = Record<string, never>;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/processor.whisper-transcribe/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
openapi: 3.0.0
|
2
|
+
info:
|
3
|
+
title: Whisper Transcribe
|
4
|
+
version: 1.0.0
|
5
|
+
|
6
|
+
components:
|
7
|
+
schemas:
|
8
|
+
WhisperTranscribeConfig:
|
9
|
+
type: object
|
10
|
+
properties:
|
11
|
+
id:
|
12
|
+
type: string
|
13
|
+
displayName:
|
14
|
+
type: string
|
15
|
+
model:
|
16
|
+
type: string
|
17
|
+
translate:
|
18
|
+
type: boolean
|
19
|
+
language:
|
20
|
+
type: string
|
21
|
+
notes:
|
22
|
+
type: string
|
23
|
+
required:
|
24
|
+
- id
|
25
|
+
- displayName
|
26
|
+
- model
|
27
|
+
- translate
|
28
|
+
- language
|
@@ -0,0 +1,44 @@
|
|
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
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.schemaFromTypes = schemaFromTypes;
|
30
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
31
|
+
const yaml_1 = __importDefault(require("yaml"));
|
32
|
+
const $RefParser = __importStar(require("@apidevtools/json-schema-ref-parser"));
|
33
|
+
const path = __importStar(require("path"));
|
34
|
+
async function schemaFromTypes(filename, keys) {
|
35
|
+
const fullPath = path.resolve(filename);
|
36
|
+
const types = await promises_1.default.readFile(fullPath, 'utf8');
|
37
|
+
const root = yaml_1.default.parse(types);
|
38
|
+
const resolved = await $RefParser.dereference(fullPath, root);
|
39
|
+
return {
|
40
|
+
config: resolved.components.schemas[keys.config],
|
41
|
+
state: keys.state ? resolved.components.schemas[keys.state] : undefined
|
42
|
+
};
|
43
|
+
}
|
44
|
+
//# sourceMappingURL=schemas.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/shared/schemas.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,0CASC;AAfD,2DAA6B;AAC7B,gDAAwB;AACxB,gFAAkE;AAClE,2CAA6B;AAGtB,KAAK,UAAU,eAAe,CAAC,QAAgB,EAAE,IAAwC;IAC9F,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IACjD,MAAM,IAAI,GAAG,cAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAuB,CAAC;IACpF,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,UAAW,CAAC,OAAQ,CAAC,IAAI,CAAC,MAAM,CAA2B;QAC5E,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAW,CAAC,OAAQ,CAAC,IAAI,CAAC,KAAK,CAA2B,CAAC,CAAC,CAAC,SAAS;KACpG,CAAA;AACH,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function waitForAssert(condition: (() => Promise<boolean>), assert: (() => Promise<void>), timeout?: number, interval?: number): Promise<void>;
|