@norskvideo/norsk-studio-built-ins 1.14.0 → 1.15.0
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/client/info.js +224 -224
- package/lib/info.js +2 -2
- package/lib/info.js.map +1 -1
- package/lib/processor.onscreenGraphic/image-selection.d.ts +9 -0
- package/lib/{processor.dynamicBug/bug-selection.js → processor.onscreenGraphic/image-selection.js} +10 -10
- package/lib/processor.onscreenGraphic/image-selection.js.map +1 -0
- package/lib/processor.onscreenGraphic/info.d.ts +3 -0
- package/lib/{processor.dynamicBug → processor.onscreenGraphic}/info.js +10 -10
- package/lib/processor.onscreenGraphic/info.js.map +1 -0
- package/lib/processor.onscreenGraphic/runtime.d.ts +67 -0
- package/lib/{processor.dynamicBug → processor.onscreenGraphic}/runtime.js +75 -75
- package/lib/processor.onscreenGraphic/runtime.js.map +1 -0
- package/lib/processor.onscreenGraphic/summary-view.d.ts +4 -0
- package/lib/processor.onscreenGraphic/summary-view.js +128 -0
- package/lib/processor.onscreenGraphic/summary-view.js.map +1 -0
- package/lib/{processor.dynamicBug → processor.onscreenGraphic}/types.d.ts +2 -2
- package/lib/processor.onscreenGraphic/types.js.map +1 -0
- package/lib/{processor.dynamicBug → processor.onscreenGraphic}/types.yaml +7 -7
- package/lib/test/{dynamic-bug.js → onscreen-graphic.js} +79 -79
- package/lib/test/onscreen-graphic.js.map +1 -0
- package/package.json +3 -3
- package/lib/processor.dynamicBug/bug-selection.d.ts +0 -9
- package/lib/processor.dynamicBug/bug-selection.js.map +0 -1
- package/lib/processor.dynamicBug/info.d.ts +0 -3
- package/lib/processor.dynamicBug/info.js.map +0 -1
- package/lib/processor.dynamicBug/runtime.d.ts +0 -67
- package/lib/processor.dynamicBug/runtime.js.map +0 -1
- package/lib/processor.dynamicBug/summary-view.d.ts +0 -4
- package/lib/processor.dynamicBug/summary-view.js +0 -128
- package/lib/processor.dynamicBug/summary-view.js.map +0 -1
- package/lib/processor.dynamicBug/types.js.map +0 -1
- package/lib/test/dynamic-bug.js.map +0 -1
- /package/lib/{processor.dynamicBug → processor.onscreenGraphic}/types.js +0 -0
- /package/lib/test/{dynamic-bug.d.ts → onscreen-graphic.d.ts} +0 -0
package/lib/info.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"info.js","sourceRoot":"","sources":["../src/info.ts"],"names":[],"mappings":";;;;;AAYA,8BASC;AAdD,MAAM,qBAAqB,GAA4C,EAAE,CAAC;AAC1E,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB,MAAM,aAAa,GAAkD,EAAE,CAAC;AAExE,SAAwB,WAAW,CAAC,CAAe,EAAE,IAAY;IAC/D,IAAG,CAAC,WAAW,EAAE,CAAC;QAChB,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YAC1B,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACf,qBAAqB,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAA;QACF,WAAW,GAAG,IAAI,CAAC;IACrB,CAAC;IACD,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAED,6DAA2C;AAC3C,aAAa,CAAC,IAAI,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,IAAA,cAAU,EAAC,CAAC,CAAoC,CAAC,CAAC;AAC1F,gEAAiD;AACjD,aAAa,CAAC,IAAI,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,IAAA,cAAa,EAAC,CAAC,CAAoC,CAAC,CAAC;AAC7F,mEAAuD;AACvD,aAAa,CAAC,IAAI,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,IAAA,cAAgB,EAAC,CAAC,CAAoC,CAAC,CAAC;AAChG,qEAA2D;AAC3D,aAAa,CAAC,IAAI,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,IAAA,cAAkB,EAAC,CAAC,CAAoC,CAAC,CAAC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,yEAAiE;AACjE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,IAAA,eAAqB,EAAC,CAAC,CAAoC,CAAC,CAAC;AACrG,6EAAyE;AACzE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,IAAA,eAAyB,EAAC,CAAC,CAAoC,CAAC,CAAC;AACzG,gFAA+E;AAC/E,aAAa,CAAC,IAAI,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,IAAA,eAA4B,EAAC,CAAC,CAAoC,CAAC,CAAC;AAC5G,sEAA2D;AAC3D,aAAa,CAAC,IAAI,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,IAAA,eAAkB,EAAC,CAAC,CAAoC,CAAC,CAAC;AAClG,oEAAuD;AACvD,aAAa,CAAC,IAAI,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,IAAA,eAAgB,EAAC,CAAC,CAAoC,CAAC,CAAC;AAChG,mEAAqD;AACrD,aAAa,CAAC,IAAI,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,IAAA,eAAe,EAAC,CAAC,CAAoC,CAAC,CAAC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { OnscreenGraphicConfig } from "./runtime";
|
2
|
+
type GraphicSelectionProps = {
|
3
|
+
defaultValue?: string;
|
4
|
+
id: string;
|
5
|
+
onChanged: (value: string) => void;
|
6
|
+
latest: Partial<OnscreenGraphicConfig>;
|
7
|
+
};
|
8
|
+
declare function GraphicSelection(props: GraphicSelectionProps): import("react/jsx-runtime").JSX.Element;
|
9
|
+
export default GraphicSelection;
|
package/lib/{processor.dynamicBug/bug-selection.js → processor.onscreenGraphic/image-selection.js}
RENAMED
@@ -2,14 +2,14 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
4
4
|
const react_1 = require("react");
|
5
|
-
function
|
5
|
+
function GraphicSelection(props) {
|
6
6
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
7
7
|
(0, react_1.useEffect)(() => {
|
8
8
|
const fn = async () => {
|
9
|
-
const result = await fetch('components/processor.
|
9
|
+
const result = await fetch('components/processor.onscreenGraphic/graphics');
|
10
10
|
if (result.ok && result.body) {
|
11
|
-
const
|
12
|
-
|
11
|
+
const graphics = await result.json();
|
12
|
+
setGraphics(graphics);
|
13
13
|
setLoading(false);
|
14
14
|
if (props.defaultValue)
|
15
15
|
props.onChanged(props.defaultValue);
|
@@ -21,19 +21,19 @@ function BugSelection(props) {
|
|
21
21
|
};
|
22
22
|
fn().catch(console.error);
|
23
23
|
}, []);
|
24
|
-
const [
|
24
|
+
const [graphcs, setGraphics] = (0, react_1.useState)([]);
|
25
25
|
if (loading) {
|
26
26
|
return (0, jsx_runtime_1.jsx)("div", { children: "Loading.." });
|
27
27
|
}
|
28
|
-
if (
|
29
|
-
return (0, jsx_runtime_1.jsx)("div", { children: "No
|
28
|
+
if (graphcs.length == 0) {
|
29
|
+
return (0, jsx_runtime_1.jsx)("div", { children: "No graphics loaded" });
|
30
30
|
}
|
31
|
-
return (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("select", { defaultValue: props.defaultValue, className: `node-editor-select-input`, id: props.id, onChange: myOnChange, onBlur: myOnChange, children: [(0, jsx_runtime_1.jsx)("option", { value: '', children: "---" }, "empty"),
|
31
|
+
return (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("select", { defaultValue: props.defaultValue, className: `node-editor-select-input`, id: props.id, onChange: myOnChange, onBlur: myOnChange, children: [(0, jsx_runtime_1.jsx)("option", { value: '', children: "---" }, "empty"), graphcs.map((o, i) => {
|
32
32
|
return (0, jsx_runtime_1.jsx)("option", { value: o, children: o }, i);
|
33
33
|
})] }) });
|
34
34
|
function myOnChange(e) {
|
35
35
|
props.onChanged(e.target.value);
|
36
36
|
}
|
37
37
|
}
|
38
|
-
exports.default =
|
39
|
-
//# sourceMappingURL=
|
38
|
+
exports.default = GraphicSelection;
|
39
|
+
//# sourceMappingURL=image-selection.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"image-selection.js","sourceRoot":"","sources":["../../src/processor.onscreenGraphic/image-selection.tsx"],"names":[],"mappings":";;;AAAA,iCAAyD;AAUzD,SAAS,gBAAgB,CAAC,KAA4B;IACpD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IAE7C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,EAAE,GAAG,KAAK,IAAI,EAAE;YACpB,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,+CAA+C,CAAC,CAAA;YAC3E,IAAI,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC7B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,EAAc,CAAC;gBACjD,WAAW,CAAC,QAAQ,CAAC,CAAC;gBACtB,UAAU,CAAC,KAAK,CAAC,CAAC;gBAClB,IAAI,KAAK,CAAC,YAAY;oBACpB,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YACxC,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;gBACjC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;YACxB,CAAC;QACH,CAAC,CAAA;QACD,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAW,EAAE,CAAC,CAAC;IAEtD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,wDAAoB,CAAA;IAC7B,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,iEAA6B,CAAA;IACtC,CAAC;IAED,OAAO,0CACL,oCAAQ,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,EAAE,0BAA0B,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,aACrI,mCAAoB,KAAK,EAAC,EAAE,qBAAhB,OAAO,CAAsB,EACxC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;oBACpB,OAAO,mCAAgB,KAAK,EAAE,CAAC,YAAG,CAAC,IAAf,CAAC,CAAwB,CAAA;gBAC/C,CAAC,CAAC,IACK,GACL,CAAA;IAGN,SAAS,UAAU,CAAC,CAAiC;QACnD,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;AACH,CAAC;AAED,kBAAe,gBAAgB,CAAC"}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import type Registration from "@norskvideo/norsk-studio/lib/extension/registration";
|
2
|
+
import type { OnscreenGraphicCommand, OnscreenGraphicConfig, OnscreenGraphicEvent, OnscreenGraphicState } from "./runtime";
|
3
|
+
export default function ({ defineComponent, Video }: Registration): import("@norskvideo/norsk-studio/lib/extension/client-types").NodeInfo<OnscreenGraphicConfig, OnscreenGraphicState, OnscreenGraphicCommand, OnscreenGraphicEvent>;
|
@@ -30,12 +30,12 @@ exports.default = default_1;
|
|
30
30
|
const config_1 = require("@norskvideo/norsk-studio/lib/shared/config");
|
31
31
|
const react_1 = __importDefault(require("react"));
|
32
32
|
function default_1({ defineComponent, Video }) {
|
33
|
-
const
|
33
|
+
const GraphicSelection = react_1.default.lazy(async () => Promise.resolve().then(() => __importStar(require('./image-selection'))));
|
34
34
|
const SummaryView = react_1.default.lazy(async () => Promise.resolve().then(() => __importStar(require('./summary-view'))));
|
35
35
|
return defineComponent({
|
36
|
-
identifier: 'processor.
|
36
|
+
identifier: 'processor.onscreenGraphic',
|
37
37
|
category: 'processor',
|
38
|
-
name: "
|
38
|
+
name: "Onscreen Graphic",
|
39
39
|
description: "",
|
40
40
|
subscription: {
|
41
41
|
accepts: {
|
@@ -52,7 +52,7 @@ function default_1({ defineComponent, Video }) {
|
|
52
52
|
},
|
53
53
|
display: (desc) => {
|
54
54
|
return {
|
55
|
-
default: desc.config.
|
55
|
+
default: desc.config.initialGraphic ?? 'none',
|
56
56
|
};
|
57
57
|
},
|
58
58
|
runtime: {
|
@@ -61,8 +61,8 @@ function default_1({ defineComponent, Video }) {
|
|
61
61
|
handleEvent: (ev, state) => {
|
62
62
|
const evType = ev.type;
|
63
63
|
switch (evType) {
|
64
|
-
case "
|
65
|
-
return { ...state,
|
64
|
+
case "graphic-changed":
|
65
|
+
return { ...state, activeGraphic: { file: ev.file, position: ev.position } };
|
66
66
|
default:
|
67
67
|
assertUnreachable(evType);
|
68
68
|
}
|
@@ -73,16 +73,16 @@ function default_1({ defineComponent, Video }) {
|
|
73
73
|
hardware: (0, config_1.HardwareSelection)()
|
74
74
|
},
|
75
75
|
form: {
|
76
|
-
|
77
|
-
help: "The initial
|
76
|
+
initialGraphic: {
|
77
|
+
help: "The initial graphic to render on the video (if any)",
|
78
78
|
hint: {
|
79
79
|
type: "custom",
|
80
80
|
optional: true,
|
81
|
-
component:
|
81
|
+
component: GraphicSelection,
|
82
82
|
}
|
83
83
|
},
|
84
84
|
initialPosition: {
|
85
|
-
help: "The initial location at which to render the
|
85
|
+
help: "The initial location at which to render the graphic",
|
86
86
|
hint: {
|
87
87
|
type: 'select',
|
88
88
|
optional: true,
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/processor.onscreenGraphic/info.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,4BA0EC;AA7ED,uEAA+E;AAC/E,kDAA0B;AAE1B,mBAAyB,EACvB,eAAe,EACf,KAAK,EACQ;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N,QAAQ,EAAE,IAAA,0BAAiB,GAAE;aAC9B;YACD,IAAI,EAAE;gBACJ,cAAc,EAAE;oBACd,IAAI,EAAE,qDAAqD;oBAC3D,IAAI,EAAE;wBACJ,IAAI,EAAE,QAAQ;wBACd,QAAQ,EAAE,IAAI;wBACd,SAAS,EAAE,gBAAgB;qBAC5B;iBACF;gBACD,eAAe,EAAE;oBACf,IAAI,EAAE,qDAAqD;oBAC3D,IAAI,EAAE;wBACJ,IAAI,EAAE,QAAQ;wBACd,QAAQ,EAAE,IAAI;wBACd,OAAO,EAAE;4BACP,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE;4BACzC,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE;4BAC3C,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE;4BAC/C,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE;yBAClD;qBACF;iBACF;aACF;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,67 @@
|
|
1
|
+
import { ComposePart, FileImageInputNode, Norsk, VideoComposeNode, VideoStreamMetadata } from '@norskvideo/norsk-sdk';
|
2
|
+
import { CreatedMediaNode, InstanceRouteInfo, OnCreated, RelatedMediaNodes, RuntimeUpdates, ServerComponentDefinition, StaticRouteInfo, StudioNodeSubscriptionSource, StudioRuntime } from '@norskvideo/norsk-studio/lib/extension/runtime-types';
|
3
|
+
import { HardwareAccelerationType } from '@norskvideo/norsk-studio/lib/shared/config';
|
4
|
+
import { ContextPromiseControl } from '@norskvideo/norsk-studio/lib/runtime/util';
|
5
|
+
import { components } from './types';
|
6
|
+
export type OnscreenGraphicPosition = components['schemas']['position'];
|
7
|
+
export type OnscreenGraphicFile = components['schemas']['graphic'];
|
8
|
+
export type OnscreenGraphicApiConfig = components['schemas']['config'];
|
9
|
+
export type OnscreenGraphicConfig = {
|
10
|
+
__global: {
|
11
|
+
hardware?: HardwareAccelerationType;
|
12
|
+
dataDir?: string;
|
13
|
+
};
|
14
|
+
id: string;
|
15
|
+
displayName: string;
|
16
|
+
initialGraphic?: OnscreenGraphicFile;
|
17
|
+
initialPosition?: OnscreenGraphicPosition;
|
18
|
+
};
|
19
|
+
export type OnscreenGraphicState = {
|
20
|
+
activeGraphic?: {
|
21
|
+
file?: OnscreenGraphicFile;
|
22
|
+
position?: OnscreenGraphicPosition;
|
23
|
+
};
|
24
|
+
};
|
25
|
+
export type OnscreenGraphicCommand = {
|
26
|
+
type: 'change-graphic';
|
27
|
+
file?: OnscreenGraphicFile;
|
28
|
+
position?: OnscreenGraphicPosition;
|
29
|
+
};
|
30
|
+
export type OnscreenGraphicEvent = {
|
31
|
+
type: 'graphic-changed';
|
32
|
+
file?: OnscreenGraphicFile;
|
33
|
+
position?: OnscreenGraphicPosition;
|
34
|
+
};
|
35
|
+
export default class OnscreenGraphicDefinition implements ServerComponentDefinition<OnscreenGraphicConfig, OnscreenGraphic, OnscreenGraphicState, OnscreenGraphicCommand, OnscreenGraphicEvent> {
|
36
|
+
create(norsk: Norsk, cfg: OnscreenGraphicConfig, cb: OnCreated<OnscreenGraphic>, runtime: StudioRuntime<OnscreenGraphicState, OnscreenGraphicCommand, OnscreenGraphicEvent>): Promise<void>;
|
37
|
+
handleCommand(node: OnscreenGraphic, command: OnscreenGraphicCommand): Promise<void>;
|
38
|
+
staticRoutes(): Promise<StaticRouteInfo[]>;
|
39
|
+
instanceRoutes(): Promise<InstanceRouteInfo<OnscreenGraphicConfig, OnscreenGraphic, OnscreenGraphicState, OnscreenGraphicCommand, OnscreenGraphicEvent>[]>;
|
40
|
+
}
|
41
|
+
export declare class OnscreenGraphic implements CreatedMediaNode {
|
42
|
+
id: string;
|
43
|
+
relatedMediaNodes: RelatedMediaNodes;
|
44
|
+
contexts: ContextPromiseControl;
|
45
|
+
norsk: Norsk;
|
46
|
+
cfg: OnscreenGraphicConfig;
|
47
|
+
graphic?: string;
|
48
|
+
position?: OnscreenGraphicPosition;
|
49
|
+
videoSource?: StudioNodeSubscriptionSource;
|
50
|
+
composeNode?: VideoComposeNode<"video" | "graphic">;
|
51
|
+
imageSource?: FileImageInputNode;
|
52
|
+
oldImageSource?: FileImageInputNode;
|
53
|
+
activeImage: "a" | "b";
|
54
|
+
initialised: Promise<void>;
|
55
|
+
updates: RuntimeUpdates<OnscreenGraphicState, OnscreenGraphicCommand, OnscreenGraphicEvent>;
|
56
|
+
currentVideo?: VideoStreamMetadata;
|
57
|
+
static create(norsk: Norsk, cfg: OnscreenGraphicConfig, updates: RuntimeUpdates<OnscreenGraphicState, OnscreenGraphicCommand, OnscreenGraphicEvent>): Promise<OnscreenGraphic>;
|
58
|
+
constructor(norsk: Norsk, cfg: OnscreenGraphicConfig, updates: RuntimeUpdates<OnscreenGraphicState, OnscreenGraphicCommand, OnscreenGraphicEvent>);
|
59
|
+
handleContext(): Promise<void>;
|
60
|
+
doSubs(imageSource?: FileImageInputNode): void;
|
61
|
+
setupGraphic(graphic?: string, position?: OnscreenGraphicPosition): Promise<void>;
|
62
|
+
imagePart(position: OnscreenGraphicPosition): ComposePart<"graphic">;
|
63
|
+
videoPart(): ComposePart<"video">;
|
64
|
+
initialise(): Promise<void>;
|
65
|
+
subscribe(sources: StudioNodeSubscriptionSource[]): void;
|
66
|
+
setSources(): void;
|
67
|
+
}
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.
|
6
|
+
exports.OnscreenGraphic = void 0;
|
7
7
|
const norsk_sdk_1 = require("@norskvideo/norsk-sdk");
|
8
8
|
const runtime_types_1 = require("@norskvideo/norsk-studio/lib/extension/runtime-types");
|
9
9
|
const logging_1 = require("@norskvideo/norsk-studio/lib/server/logging");
|
@@ -16,27 +16,27 @@ const path_1 = __importDefault(require("path"));
|
|
16
16
|
const multer_1 = __importDefault(require("multer"));
|
17
17
|
const json_refs_1 = require("json-refs");
|
18
18
|
const yaml_1 = __importDefault(require("yaml"));
|
19
|
-
const
|
20
|
-
function
|
21
|
-
return path_1.default.join(config_2.default.server.workingDir(), process.env.
|
19
|
+
const onscreenGraphicPositions = ['topleft', 'topright', 'bottomleft', 'bottomright'];
|
20
|
+
function graphicsDir() {
|
21
|
+
return path_1.default.join(config_2.default.server.workingDir(), process.env.ONSCREENGRAPHIC_DIRECTORY ?? "graphics");
|
22
22
|
}
|
23
|
-
async function
|
24
|
-
const files = await promises_1.default.readdir(
|
23
|
+
async function getGraphics() {
|
24
|
+
const files = await promises_1.default.readdir(graphicsDir());
|
25
25
|
const images = files.filter((f) => {
|
26
26
|
return f.endsWith(".png") || f.endsWith(".jpg");
|
27
27
|
});
|
28
28
|
return images;
|
29
29
|
}
|
30
|
-
class
|
30
|
+
class OnscreenGraphicDefinition {
|
31
31
|
async create(norsk, cfg, cb, runtime) {
|
32
|
-
const node = await
|
32
|
+
const node = await OnscreenGraphic.create(norsk, cfg, runtime.updates);
|
33
33
|
cb(node);
|
34
34
|
}
|
35
35
|
async handleCommand(node, command) {
|
36
36
|
const commandType = command.type;
|
37
37
|
switch (commandType) {
|
38
|
-
case 'change-
|
39
|
-
await node.
|
38
|
+
case 'change-graphic':
|
39
|
+
await node.setupGraphic(command.file, command.position);
|
40
40
|
break;
|
41
41
|
default:
|
42
42
|
(0, util_1.assertUnreachable)(commandType);
|
@@ -44,16 +44,16 @@ class DynamicBugDefinition {
|
|
44
44
|
}
|
45
45
|
async staticRoutes() {
|
46
46
|
const storage = multer_1.default.diskStorage({
|
47
|
-
destination:
|
47
|
+
destination: graphicsDir(),
|
48
48
|
filename: function (_req, file, cb) {
|
49
49
|
cb(null, path_1.default.basename(file.originalname));
|
50
50
|
}
|
51
51
|
});
|
52
52
|
const fileFilter = async function (req, file, cb) {
|
53
53
|
try {
|
54
|
-
const
|
55
|
-
if (
|
56
|
-
return cb(new Error('A
|
54
|
+
const existingGraphics = await getGraphics();
|
55
|
+
if (existingGraphics.includes(file.originalname)) {
|
56
|
+
return cb(new Error('A graphic with this name already exists'));
|
57
57
|
}
|
58
58
|
else {
|
59
59
|
cb(null, true);
|
@@ -66,13 +66,13 @@ class DynamicBugDefinition {
|
|
66
66
|
const upload = (0, multer_1.default)({ storage, fileFilter });
|
67
67
|
return [
|
68
68
|
{
|
69
|
-
url: '/
|
69
|
+
url: '/graphics',
|
70
70
|
method: 'POST',
|
71
71
|
handler: () => async (req, res) => {
|
72
72
|
const uploader = upload.single('file');
|
73
73
|
uploader(req, res, (err) => {
|
74
74
|
if (err) {
|
75
|
-
if (err.message === 'A
|
75
|
+
if (err.message === 'A graphic with this name already exists') {
|
76
76
|
return res.status(409).json({ error: err.message });
|
77
77
|
}
|
78
78
|
(0, logging_1.warninglog)("An error occured during upload", err);
|
@@ -99,28 +99,28 @@ class DynamicBugDefinition {
|
|
99
99
|
}
|
100
100
|
},
|
101
101
|
responses: {
|
102
|
-
'204': { description: "The file
|
102
|
+
'204': { description: "The file was uploaded successfully" },
|
103
103
|
'400': { description: "No file was uploaded" },
|
104
104
|
'404': { description: "Not Found" },
|
105
|
-
'409': { description: "A
|
105
|
+
'409': { description: "A graphic with the same name already exists" },
|
106
106
|
'500': { description: "File upload failed" },
|
107
107
|
}
|
108
108
|
},
|
109
109
|
{
|
110
|
-
url: '/
|
110
|
+
url: '/graphics',
|
111
111
|
method: 'GET',
|
112
112
|
handler: (_) => (async (_req, res) => {
|
113
|
-
const images = await
|
113
|
+
const images = await getGraphics();
|
114
114
|
res.json(images);
|
115
115
|
}),
|
116
116
|
responses: {},
|
117
117
|
},
|
118
118
|
{
|
119
|
-
url: '/
|
119
|
+
url: '/graphic',
|
120
120
|
method: 'DELETE',
|
121
121
|
handler: () => (async (req, res) => {
|
122
122
|
const filename = req.body.filename;
|
123
|
-
const filePath = path_1.default.join(
|
123
|
+
const filePath = path_1.default.join(graphicsDir(), filename);
|
124
124
|
try {
|
125
125
|
await promises_1.default.access(filePath);
|
126
126
|
await promises_1.default.unlink(filePath);
|
@@ -128,11 +128,11 @@ class DynamicBugDefinition {
|
|
128
128
|
}
|
129
129
|
catch (error) {
|
130
130
|
if (error.code === 'ENOENT') {
|
131
|
-
res.status(404).json({ error: '
|
131
|
+
res.status(404).json({ error: 'Graphic not found' });
|
132
132
|
}
|
133
133
|
else {
|
134
|
-
(0, logging_1.warninglog)("Error deleting
|
135
|
-
res.status(500).json({ error: 'Failed to delete
|
134
|
+
(0, logging_1.warninglog)("Error deleting graphic", error);
|
135
|
+
res.status(500).json({ error: 'Failed to delete graphic' });
|
136
136
|
}
|
137
137
|
}
|
138
138
|
}),
|
@@ -144,7 +144,7 @@ class DynamicBugDefinition {
|
|
144
144
|
properties: {
|
145
145
|
filename: {
|
146
146
|
type: 'string',
|
147
|
-
description: 'The name of the
|
147
|
+
description: 'The name of the graphic file to delete'
|
148
148
|
}
|
149
149
|
},
|
150
150
|
required: ['filename']
|
@@ -153,9 +153,9 @@ class DynamicBugDefinition {
|
|
153
153
|
}
|
154
154
|
},
|
155
155
|
responses: {
|
156
|
-
'204': { description: "The
|
157
|
-
'404': { description: "The specified
|
158
|
-
'500': { description: "Failed to delete the
|
156
|
+
'204': { description: "The graphic was successfully deleted" },
|
157
|
+
'404': { description: "The specified graphic was not found" },
|
158
|
+
'500': { description: "Failed to delete the graphic" }
|
159
159
|
}
|
160
160
|
}
|
161
161
|
];
|
@@ -166,19 +166,19 @@ class DynamicBugDefinition {
|
|
166
166
|
const resolved = await (0, json_refs_1.resolveRefs)(root, {}).then((r) => r.resolved);
|
167
167
|
return [
|
168
168
|
{
|
169
|
-
url: '/active-
|
169
|
+
url: '/active-graphic',
|
170
170
|
method: 'GET',
|
171
171
|
handler: ({ runtime }) => ((_req, res) => {
|
172
172
|
const latest = runtime.updates.latest();
|
173
173
|
const response = {
|
174
|
-
|
175
|
-
position: latest.
|
174
|
+
graphic: latest.activeGraphic?.file,
|
175
|
+
position: latest.activeGraphic?.position
|
176
176
|
};
|
177
177
|
res.json(response);
|
178
178
|
}),
|
179
179
|
responses: {
|
180
180
|
'200': {
|
181
|
-
description: "Information about the currently overlaid
|
181
|
+
description: "Information about the currently overlaid graphic (if any)",
|
182
182
|
content: {
|
183
183
|
"application/json": {
|
184
184
|
schema: resolved.components.schemas['config']
|
@@ -188,35 +188,35 @@ class DynamicBugDefinition {
|
|
188
188
|
}
|
189
189
|
},
|
190
190
|
{
|
191
|
-
url: '/active-
|
191
|
+
url: '/active-graphic',
|
192
192
|
method: 'POST',
|
193
193
|
handler: ({ runtime }) => (async (req, res) => {
|
194
|
-
if ((req.body.
|
195
|
-
if (!
|
194
|
+
if ((req.body.graphic || req.body.position)) {
|
195
|
+
if (!onscreenGraphicPositions.includes(req.body.position)) {
|
196
196
|
res.status(400).json({
|
197
197
|
error: "bad position",
|
198
198
|
details: req.body.position
|
199
199
|
});
|
200
200
|
return;
|
201
201
|
}
|
202
|
-
const images = await
|
203
|
-
if (!images.includes(req.body.
|
202
|
+
const images = await getGraphics();
|
203
|
+
if (!images.includes(req.body.graphic)) {
|
204
204
|
res.status(400).json({
|
205
|
-
error: "Unknown
|
206
|
-
details: req.body.
|
205
|
+
error: "Unknown graphic",
|
206
|
+
details: req.body.graphic,
|
207
207
|
});
|
208
208
|
return;
|
209
209
|
}
|
210
210
|
}
|
211
211
|
runtime.updates.sendCommand({
|
212
|
-
type: 'change-
|
213
|
-
file: req.body.
|
212
|
+
type: 'change-graphic',
|
213
|
+
file: req.body.graphic,
|
214
214
|
position: req.body.position
|
215
215
|
});
|
216
216
|
res.status(204).send();
|
217
217
|
}),
|
218
218
|
requestBody: {
|
219
|
-
description: "The
|
219
|
+
description: "The graphic filename and location (sending an empty JSON object will delete the graphic)",
|
220
220
|
content: {
|
221
221
|
'application/json': {
|
222
222
|
schema: resolved.components.schemas['config']
|
@@ -224,9 +224,9 @@ class DynamicBugDefinition {
|
|
224
224
|
},
|
225
225
|
},
|
226
226
|
responses: {
|
227
|
-
'204': { description: "The active
|
227
|
+
'204': { description: "The active graphic was successfully updated" },
|
228
228
|
'400': {
|
229
|
-
description: "Unknown
|
229
|
+
description: "Unknown graphic",
|
230
230
|
content: {
|
231
231
|
"application/json": {
|
232
232
|
schema: {
|
@@ -242,27 +242,27 @@ class DynamicBugDefinition {
|
|
242
242
|
}
|
243
243
|
},
|
244
244
|
{
|
245
|
-
url: '/active-
|
245
|
+
url: '/active-graphic',
|
246
246
|
method: 'DELETE',
|
247
247
|
handler: ({ runtime }) => (async (_req, res) => {
|
248
248
|
runtime.updates.sendCommand({
|
249
|
-
type: 'change-
|
249
|
+
type: 'change-graphic'
|
250
250
|
});
|
251
251
|
res.status(204).send();
|
252
252
|
}),
|
253
|
-
responses: { '204': { description: "The active
|
253
|
+
responses: { '204': { description: "The active graphic was successfully deleted" } }
|
254
254
|
},
|
255
255
|
];
|
256
256
|
}
|
257
257
|
}
|
258
|
-
exports.default =
|
259
|
-
class
|
258
|
+
exports.default = OnscreenGraphicDefinition;
|
259
|
+
class OnscreenGraphic {
|
260
260
|
id;
|
261
261
|
relatedMediaNodes = new runtime_types_1.RelatedMediaNodes();
|
262
262
|
contexts = new util_2.ContextPromiseControl(this.handleContext.bind(this));
|
263
263
|
norsk;
|
264
264
|
cfg;
|
265
|
-
|
265
|
+
graphic;
|
266
266
|
position;
|
267
267
|
videoSource;
|
268
268
|
composeNode;
|
@@ -273,7 +273,7 @@ class DynamicBug {
|
|
273
273
|
updates;
|
274
274
|
currentVideo;
|
275
275
|
static async create(norsk, cfg, updates) {
|
276
|
-
const node = new
|
276
|
+
const node = new OnscreenGraphic(norsk, cfg, updates);
|
277
277
|
await node.initialised;
|
278
278
|
return node;
|
279
279
|
}
|
@@ -295,17 +295,17 @@ class DynamicBug {
|
|
295
295
|
}
|
296
296
|
else {
|
297
297
|
const nextVideo = video.message.value;
|
298
|
-
(0, logging_1.debuglog)("Creating compose for
|
298
|
+
(0, logging_1.debuglog)("Creating compose for onscreen graphic", { id: this.id, metadata: nextVideo });
|
299
299
|
if (this.currentVideo) {
|
300
300
|
if (nextVideo.height !== this.currentVideo.height || nextVideo.width !== this.currentVideo.width) {
|
301
|
-
(0, logging_1.debuglog)("Closing compose node in
|
301
|
+
(0, logging_1.debuglog)("Closing compose node in onscreen graphic because of metadata change", { id: this.id, old: this.currentVideo, new: nextVideo });
|
302
302
|
await this.composeNode?.close();
|
303
303
|
this.currentVideo = undefined;
|
304
304
|
}
|
305
305
|
}
|
306
306
|
this.currentVideo = nextVideo;
|
307
307
|
if (!this.composeNode) {
|
308
|
-
(0, logging_1.debuglog)("Creating compose node for
|
308
|
+
(0, logging_1.debuglog)("Creating compose node for onscreen graphic", { id: this.id, width: nextVideo.width, height: nextVideo.height });
|
309
309
|
const thisCompose = this.composeNode = await this.norsk.processor.transform.videoCompose({
|
310
310
|
onCreate: (n) => {
|
311
311
|
this.relatedMediaNodes.addOutput(n);
|
@@ -338,7 +338,7 @@ class DynamicBug {
|
|
338
338
|
this.videoPart(),
|
339
339
|
]
|
340
340
|
});
|
341
|
-
(0, logging_1.debuglog)("Closing old image source for
|
341
|
+
(0, logging_1.debuglog)("Closing old image source for graphic", { id: this.id, oldNode: this.oldImageSource?.id, newNode: this.imageSource?.id });
|
342
342
|
void this.oldImageSource?.close();
|
343
343
|
this.oldImageSource = undefined;
|
344
344
|
await this.handleContext();
|
@@ -372,51 +372,51 @@ class DynamicBug {
|
|
372
372
|
}
|
373
373
|
doSubs(imageSource) {
|
374
374
|
if (!imageSource) {
|
375
|
-
(0, logging_1.debuglog)("Doing subscriptions for
|
375
|
+
(0, logging_1.debuglog)("Doing subscriptions for onscreen graphic without image source");
|
376
376
|
this.composeNode?.subscribeToPins(this.videoSource?.selectVideoToPin("video") || []);
|
377
377
|
}
|
378
378
|
else {
|
379
|
-
(0, logging_1.debuglog)("Doing subscriptions for
|
379
|
+
(0, logging_1.debuglog)("Doing subscriptions for onscreen graphic with image source", { id: this.id, image: imageSource.id });
|
380
380
|
this.composeNode?.subscribeToPins((this.videoSource?.selectVideoToPin("video") ?? []).concat([
|
381
|
-
{ source: imageSource, sourceSelector: (0, norsk_sdk_1.videoToPin)("
|
381
|
+
{ source: imageSource, sourceSelector: (0, norsk_sdk_1.videoToPin)("graphic") }
|
382
382
|
]));
|
383
383
|
}
|
384
384
|
}
|
385
|
-
async
|
385
|
+
async setupGraphic(graphic, position) {
|
386
386
|
this.position = position;
|
387
|
-
if (!
|
388
|
-
(0, logging_1.debuglog)("Clearing
|
387
|
+
if (!graphic || graphic === "") {
|
388
|
+
(0, logging_1.debuglog)("Clearing graphic", { id: this.id });
|
389
389
|
this.doSubs();
|
390
390
|
await this.imageSource?.close();
|
391
391
|
this.imageSource = undefined;
|
392
|
-
this.
|
392
|
+
this.graphic = undefined;
|
393
393
|
this.position = undefined;
|
394
|
-
this.updates.raiseEvent({ type: '
|
394
|
+
this.updates.raiseEvent({ type: 'graphic-changed' });
|
395
395
|
await this.contexts.schedule();
|
396
396
|
return;
|
397
397
|
}
|
398
|
-
else if (
|
399
|
-
(0, logging_1.debuglog)("Changing
|
400
|
-
this.
|
398
|
+
else if (graphic !== this.graphic) {
|
399
|
+
(0, logging_1.debuglog)("Changing graphic", { id: this.id, graphic, position });
|
400
|
+
this.graphic = graphic;
|
401
401
|
this.activeImage = this.activeImage == "a" ? "b" : "a";
|
402
402
|
this.oldImageSource = this.imageSource;
|
403
403
|
this.imageSource = await this.norsk.input.fileImage({
|
404
404
|
id: `${this.id}-${this.activeImage}`,
|
405
|
-
sourceName: `${this.id}-
|
406
|
-
fileName: path_1.default.join(
|
405
|
+
sourceName: `${this.id}-graphic-${this.activeImage}`,
|
406
|
+
fileName: path_1.default.join(graphicsDir(), graphic)
|
407
407
|
});
|
408
408
|
this.setSources();
|
409
409
|
}
|
410
410
|
else {
|
411
|
-
(0, logging_1.debuglog)("Changing
|
411
|
+
(0, logging_1.debuglog)("Changing graphic position", { id: this.id, graphic, position });
|
412
412
|
this.position = position;
|
413
413
|
await this.contexts.schedule();
|
414
414
|
}
|
415
|
-
this.updates.raiseEvent({ type: '
|
415
|
+
this.updates.raiseEvent({ type: 'graphic-changed', file: graphic, position });
|
416
416
|
}
|
417
417
|
imagePart(position) {
|
418
418
|
const foo = {
|
419
|
-
id: "
|
419
|
+
id: "graphic",
|
420
420
|
zIndex: 1,
|
421
421
|
compose: (metadata, cfg) => {
|
422
422
|
const videoWidth = cfg.outputResolution.width;
|
@@ -432,7 +432,7 @@ class DynamicBug {
|
|
432
432
|
};
|
433
433
|
},
|
434
434
|
opacity: 1.0,
|
435
|
-
pin: "
|
435
|
+
pin: "graphic"
|
436
436
|
};
|
437
437
|
return foo;
|
438
438
|
}
|
@@ -446,7 +446,7 @@ class DynamicBug {
|
|
446
446
|
};
|
447
447
|
}
|
448
448
|
async initialise() {
|
449
|
-
await this.
|
449
|
+
await this.setupGraphic(this.cfg.initialGraphic, this.cfg.initialPosition);
|
450
450
|
}
|
451
451
|
subscribe(sources) {
|
452
452
|
this.videoSource = sources[0];
|
@@ -461,5 +461,5 @@ class DynamicBug {
|
|
461
461
|
this.contexts.setSources(this.videoSource ? [this.videoSource] : [], imageSources);
|
462
462
|
}
|
463
463
|
}
|
464
|
-
exports.
|
464
|
+
exports.OnscreenGraphic = OnscreenGraphic;
|
465
465
|
//# sourceMappingURL=runtime.js.map
|