@xibosignage/xibo-layout-renderer 1.0.21 → 1.0.23

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 (38) hide show
  1. package/README.md +67 -0
  2. package/dist/src/Lib/BlobLoader.d.ts +11 -0
  3. package/dist/src/Lib/index.d.ts +3 -0
  4. package/dist/src/Modules/ActionController/index.d.ts +2 -1
  5. package/dist/src/Modules/Generators/Generators.d.ts +15 -5
  6. package/dist/src/Modules/Generators/index.d.ts +2 -1
  7. package/dist/src/Modules/Layout/Layout.d.ts +6 -3
  8. package/dist/src/Modules/Layout/OverlayLayout.d.ts +3 -2
  9. package/dist/src/Modules/Media/Media.d.ts +13 -7
  10. package/dist/src/Modules/Media/VideoMedia.d.ts +16 -1
  11. package/dist/src/Modules/Region/Region.d.ts +54 -1
  12. package/dist/src/Modules/SplashScreen/index.d.ts +2 -1
  13. package/dist/src/Modules/Transitions/index.d.ts +2 -1
  14. package/dist/src/Types/Events/Events.types.d.ts +37 -0
  15. package/dist/src/Types/Events/index.d.ts +1 -0
  16. package/dist/src/Types/Layout/Layout.types.d.ts +15 -10
  17. package/dist/src/Types/Layout/index.d.ts +2 -1
  18. package/dist/src/Types/Media/Media.types.d.ts +6 -2
  19. package/dist/src/Types/Media/index.d.ts +2 -1
  20. package/dist/src/Types/Platform/Platform.types.d.ts +12 -0
  21. package/dist/src/Types/Platform/index.d.ts +1 -0
  22. package/dist/src/Types/Region/Region.types.d.ts +6 -6
  23. package/dist/src/Types/Region/index.d.ts +2 -1
  24. package/dist/src/Types/XLR/XLR.types.d.ts +3 -1
  25. package/dist/src/Types/XLR/index.d.ts +2 -1
  26. package/dist/src/index.d.ts +0 -1
  27. package/dist/src/types.d.ts +2 -0
  28. package/dist/xibo-layout-renderer.cjs.js +6216 -5253
  29. package/dist/xibo-layout-renderer.cjs.js.map +1 -1
  30. package/dist/xibo-layout-renderer.d.ts +169 -43
  31. package/dist/xibo-layout-renderer.esm.js +6211 -5252
  32. package/dist/xibo-layout-renderer.esm.js.map +1 -1
  33. package/dist/xibo-layout-renderer.js +6216 -5253
  34. package/dist/xibo-layout-renderer.min.js +8 -8
  35. package/dist/xibo-layout-renderer.min.js.map +1 -1
  36. package/package.json +5 -3
  37. package/dist/src/Modules/Platform/Platform.d.ts +0 -2
  38. package/dist/src/Modules/Platform/index.d.ts +0 -1
package/README.md CHANGED
@@ -1,2 +1,69 @@
1
1
  # Xibo Layout Renderer
2
2
  This is a npm module for rendering Xibo layouts to a browser window.
3
+
4
+ ## How It Works
5
+
6
+ ### 1. Initialization Flow
7
+
8
+ ```
9
+ Consumer calls XiboLayoutRenderer(inputLayouts, overlays, options)
10
+ ├─ bootstrap() → Sets up DOM (#preview_canvas), splash screen
11
+ ├─ init() → Calls prepareLayouts()
12
+ │ ├─ parseLayouts() → Determines current + next layout from schedule loop
13
+ │ ├─ prepareLayoutXlf() → Fetches XLF XML, parses with DOMParser
14
+ │ └─ new Layout() → Parses XLF → creates Regions → creates Media objects
15
+ └─ playSchedules() → Makes current layout visible, runs regions + overlays
16
+ ```
17
+
18
+ ### 2. Layout Lifecycle
19
+
20
+ Each layout goes through these states defined in `ELayoutState`:
21
+
22
+ | State | Meaning |
23
+ |-------------|---------------------------------------------|
24
+ | `IDLE` | Layout created but not yet running |
25
+ | `RUNNING` | Layout is actively displayed |
26
+ | `PLAYED` | Layout has finished (all regions expired) |
27
+ | `CANCELLED` | Layout was removed before completing |
28
+ | `ERROR` | Layout encountered an error |
29
+
30
+ ### 3. Region → Media Playback
31
+
32
+ - A **Layout** contains one or more **Regions** (positioned `<div>` containers)
33
+ - Each **Region** contains a playlist of **Media** items (widgets)
34
+ - Media items can be: `image`, `video`, `audio`, `html` (iframe-based widgets)
35
+ - When a media item's duration expires, the region transitions to the next media
36
+ - When all regions have completed their cycle, the layout emits `'end'`, triggering the next layout
37
+
38
+ ### 4. Schedule Loop
39
+
40
+ The orchestrator (IXlr) maintains a **current** and **next** layout. When the current layout ends:
41
+ 1. The next layout becomes current
42
+ 2. A new next layout is prepared from the input schedule
43
+ 3. This creates a continuous loop of layouts
44
+
45
+ ### 5. Overlay System
46
+
47
+ OverlayLayoutManager handles layouts that display on top of the main schedule. Overlays are paused during "interrupt" layouts (layouts with `shareOfVoice > 0`).
48
+
49
+ ### 6. Event System
50
+
51
+ Uses [nanoevents](https://github.com/ai/nanoevents) for a pub/sub event pattern:
52
+
53
+ | Level | Events |
54
+ |---------|--------------------------------------------------|
55
+ | **XLR** | `layoutChange`, `layoutStart`, `layoutEnd`, `layoutError`, `widgetStart`, `widgetEnd`, `updateLoop`, `updateOverlays`, `adRequest`, `overlayStart`, `overlayEnd`, `commandCodeReceived` |
56
+ | **Layout** | `start`, `end`, `cancelled` |
57
+ | **Region** | `start`, `end` |
58
+ | **Media** | `start`, `end` |
59
+
60
+ ### 7. Platform Abstraction
61
+
62
+ The library supports multiple platforms via `ConsumerPlatform` enum and the `options.platform` flag:
63
+
64
+ | Platform | XLF Source | Special Behavior |
65
+ |-------------|--------------------------------|-----------------------------------|
66
+ | `CMS` | Fetched via URL with JWT | Preview-only features, "Play again" UI |
67
+ | `chromeOS` | Local file path | Fault reporting via Service Worker |
68
+ | `electron` | App host + URL | Standard playback |
69
+ | PWA | Proxy/hosted | Service Worker caching |
@@ -0,0 +1,11 @@
1
+ export declare class BlobLoader {
2
+ private static cache;
3
+ /**
4
+ * Fetches a video and returns a local Blob URL (e.g., blob:http://localhost/...)
5
+ */
6
+ static load(url: string): Promise<string>;
7
+ /**
8
+ * Frees memory. CRITICAL for 24/7 signage.
9
+ */
10
+ static release(url: string): void;
11
+ }
@@ -0,0 +1,3 @@
1
+ export { BlobLoader } from './BlobLoader';
2
+ export { default as PwaSW } from './pwa-sw';
3
+ export * from './translations';
@@ -1 +1,2 @@
1
- export { default, Action, ActionsWrapper, InactOptions, } from './ActionController';
1
+ export type { InactOptions, } from './ActionController';
2
+ export { default, Action, ActionsWrapper, } from './ActionController';
@@ -1,15 +1,16 @@
1
1
  import { IMedia } from '../../Types/Media';
2
2
  import { InputLayoutType, OptionsType } from '../../Types/Layout';
3
+ import { IRegion } from "../../Types/Region";
3
4
  export declare function nextId(options: {
4
5
  idCounter: number;
5
6
  }): number;
6
7
  export declare const getMediaId: ({ mediaType, containerName }: IMedia) => string;
7
8
  export declare const capitalizeStr: (inputStr: string) => string;
8
- export declare function getDataBlob(src: string): Promise<unknown>;
9
+ export declare function getDataBlob(src: string, jwtToken: string | null): Promise<unknown>;
9
10
  export type MediaTypes = 'video' | 'audio' | 'image';
10
- export declare function preloadMediaBlob(src: string, type: MediaTypes): Promise<string>;
11
- export declare function fetchJSON(url: string): Promise<any>;
12
- export declare function fetchText(url: string): Promise<string>;
11
+ export declare function preloadMediaBlob(src: string, type: MediaTypes, jwtToken: string | null): Promise<string>;
12
+ export declare function fetchJSON(url: string, jwtToken: string | null): Promise<any>;
13
+ export declare function fetchText(url: string, jwtToken: string | null): Promise<string>;
13
14
  export declare function getFileExt(filename: string): string;
14
15
  export declare function audioFileType(str: string): string | undefined;
15
16
  export declare function videoFileType(str: string): string | undefined;
@@ -51,5 +52,14 @@ export declare function getLayoutIndexByLayoutId(layouts: InputLayoutType[], lay
51
52
  export declare function hasDefaultOnly(inputLayouts: InputLayoutType[]): boolean;
52
53
  export declare function isDefaultLayout(inputLayout: InputLayoutType): boolean;
53
54
  export declare function hasSspLayout(inputLayouts: InputLayoutType[], defaultValue?: boolean): boolean;
54
- export declare function createMediaElement(mediaObject: IMedia, role: 'current' | 'next'): HTMLElement;
55
+ export declare function prepareIframe(media: IMedia): HTMLIFrameElement;
56
+ export declare function prepareImage(media: IMedia, container: HTMLElement): HTMLElement;
57
+ export declare function prepareVideo(media: IMedia, container: HTMLVideoElement): HTMLVideoElement;
58
+ export declare function prepareAudio(media: IMedia, container: HTMLAudioElement): HTMLAudioElement;
59
+ export declare function createMediaElement(mediaObject: IMedia): HTMLElement;
60
+ export declare function prepareVideoMedia(media: IMedia, region: IRegion): void;
61
+ export declare function prepareImageMedia(media: IMedia, region: IRegion): void;
62
+ export declare function prepareAudioMedia(media: IMedia, region: IRegion): void;
63
+ export declare function prepareHtmlMedia(media: IMedia, region: IRegion): void;
64
+ export declare function playerReportFault(msg: string, media: IMedia): Promise<void>;
55
65
  export {};
@@ -1 +1,2 @@
1
- export { getFileExt, nextId, preloadMediaBlob, getMediaId, fetchJSON, capitalizeStr, audioFileType, MediaTypes, videoFileType, setExpiry, composeMediaUrl, fetchText, getDataBlob, composeResourceUrl, composeResourceUrlByPlatform, getIndexByLayoutId, isEmpty, composeBgUrlByPlatform, hasDefaultOnly, isLayoutValid, } from './Generators';
1
+ export type { MediaTypes, } from './Generators';
2
+ export { getFileExt, nextId, preloadMediaBlob, getMediaId, fetchJSON, capitalizeStr, audioFileType, videoFileType, setExpiry, composeMediaUrl, fetchText, getDataBlob, composeResourceUrl, composeResourceUrlByPlatform, getIndexByLayoutId, isEmpty, composeBgUrlByPlatform, hasDefaultOnly, isLayoutValid, createMediaElement, } from './Generators';
@@ -1,5 +1,6 @@
1
1
  import { Emitter } from 'nanoevents';
2
- import { ELayoutState, GetLayoutParamType, GetLayoutType, ILayout, ILayoutEvents, OptionsType } from '../../Types/Layout';
2
+ import { ELayoutState, GetLayoutParamType, GetLayoutType, ILayout, LayoutPlaybackType, OptionsType } from '../../Types/Layout';
3
+ import { ILayoutEvents } from "../../types";
3
4
  import { IXlr } from '../../Types/XLR';
4
5
  import './layout.css';
5
6
  import ActionController, { Action } from '../ActionController';
@@ -48,6 +49,8 @@ export default class Layout implements ILayout {
48
49
  scheduleId?: number;
49
50
  layoutNode?: Document;
50
51
  path?: string;
52
+ errorCode: number | null;
53
+ html: HTMLElement | null;
51
54
  options: OptionsType;
52
55
  xlr: IXlr;
53
56
  private readonly layoutObj;
@@ -59,11 +62,11 @@ export default class Layout implements ILayout {
59
62
  playRegions(): void;
60
63
  regionExpired(): void;
61
64
  end(): void;
62
- regionEnded(): Promise<void>;
65
+ regionEnded(): void;
63
66
  stopAllMedia(): Promise<void>;
64
67
  resetLayout(): Promise<void>;
65
68
  finishAllRegions(): Promise<void[]>;
66
- removeLayout(): void;
69
+ removeLayout(caller?: LayoutPlaybackType): void;
67
70
  getXlf(): string;
68
71
  isInterrupt(): boolean;
69
72
  on<E extends keyof ILayoutEvents>(event: E, callback: ILayoutEvents[E]): import("nanoevents").Unsubscribe;
@@ -1,7 +1,8 @@
1
+ import { Emitter, Unsubscribe } from "nanoevents";
1
2
  import Layout from "./Layout";
2
- import { ILayout, ILayoutEvents, OptionsType } from "../../Types/Layout";
3
+ import { ILayout, OptionsType } from "../../Types/Layout";
4
+ import { ILayoutEvents } from "../../Types/Events";
3
5
  import { IXlr } from "../../Types/XLR";
4
- import { Emitter, Unsubscribe } from "nanoevents";
5
6
  export interface IOverlayLayoutEvents extends ILayoutEvents {
6
7
  }
7
8
  export default class OverlayLayout extends Layout {
@@ -2,14 +2,11 @@ import { Emitter } from 'nanoevents';
2
2
  import Player from "video.js/dist/types/player";
3
3
  import { OptionsType } from '../../Types/Layout';
4
4
  import { IRegion } from '../../Types/Region';
5
- import { IMedia } from '../../Types/Media';
5
+ import { IMedia, MediaState } from '../../Types/Media';
6
6
  import { IXlr } from '../../Types/XLR';
7
- import { MediaState } from "../../Types/Media/Media.types";
7
+ import { IMediaEvents } from "../../Types/Events";
8
8
  import 'video.js/dist/video-js.min.css';
9
- export interface IMediaEvents {
10
- start: (media: IMedia) => void;
11
- end: (media: IMedia) => void;
12
- }
9
+ import { IVideoMediaHandler } from "./VideoMedia";
13
10
  export declare class Media implements IMedia {
14
11
  attachedAudio: boolean;
15
12
  checkIframeStatus: boolean;
@@ -49,14 +46,23 @@ export declare class Media implements IMedia {
49
46
  url: string | null;
50
47
  useDuration: boolean;
51
48
  xml: Element | null;
52
- private mediaTimer;
49
+ videoHandler?: IVideoMediaHandler;
50
+ mediaTimer: ReturnType<typeof setInterval> | undefined;
53
51
  private mediaTimeCount;
54
52
  private xlr;
55
53
  private readonly statsBC;
54
+ private hasCommandExecuted;
56
55
  constructor(region: IRegion, mediaId: string, xml: Element, options: OptionsType, xlr: IXlr);
57
56
  private startMediaTimer;
58
57
  private on;
59
58
  private init;
60
59
  run(): void;
61
60
  stop(): Promise<void>;
61
+ /**
62
+ * Emits a command from the shell command widget.
63
+ *
64
+ * @param media
65
+ * @private
66
+ */
67
+ private emitCommand;
62
68
  }
@@ -1,9 +1,24 @@
1
+ import Player from "video.js/dist/types/player";
1
2
  import { IMedia } from '../../Types/Media';
2
- import { IXlr } from '../../types';
3
+ import { IXlr, OptionsType } from '../../types';
3
4
  import './media.css';
4
5
  export declare function composeVideoSource($media: HTMLVideoElement, media: IMedia): HTMLVideoElement;
6
+ export declare const defaultVjsOpts: {
7
+ autoplay: boolean;
8
+ muted: boolean;
9
+ preload: string;
10
+ controls: boolean;
11
+ };
12
+ export declare const vjsDefaultOptions: (opts?: any) => any;
13
+ export interface IVideoMediaHandler {
14
+ player: Player | undefined;
15
+ duration: number;
16
+ stop(disposeOnly?: boolean): void;
17
+ }
18
+ export declare function videoMediaHandler(media: IMedia, platform: OptionsType['platform']): IVideoMediaHandler;
5
19
  export declare function VideoMedia(media: IMedia, xlr: IXlr): {
6
20
  duration: number;
7
21
  init: () => void;
8
22
  stop: (disposeOnly?: boolean) => void;
23
+ play: () => void;
9
24
  };
@@ -1,4 +1,57 @@
1
1
  import { ILayout, OptionsType } from '../../Types/Layout';
2
2
  import { IRegion } from '../../Types/Region';
3
+ import { IMedia } from '../../Types/Media';
4
+ import { IRegionEvents } from "../../Types/Events";
3
5
  import { IXlr } from '../../Types/XLR';
4
- export default function Region(layout: ILayout, xml: Element, regionId: string, options: OptionsType, xlr: IXlr): IRegion;
6
+ export default class Region implements IRegion {
7
+ layout: ILayout;
8
+ xml: Element | null;
9
+ regionId: string;
10
+ options: OptionsType;
11
+ xlr: IXlr;
12
+ complete: boolean;
13
+ containerName: string;
14
+ currMedia: IMedia | undefined;
15
+ currEl: HTMLElement | null;
16
+ currentMedia: number;
17
+ currentMediaIndex: number;
18
+ ended: boolean;
19
+ ending: boolean;
20
+ html: HTMLDivElement;
21
+ id: string;
22
+ index: number;
23
+ mediaObjects: IMedia[];
24
+ mediaObjectsActions: IMedia[];
25
+ nxtMedia: IMedia | undefined;
26
+ nxtEl: HTMLElement | null;
27
+ offsetX: number;
28
+ offsetY: number;
29
+ oldMedia: IMedia | undefined;
30
+ oneMedia: boolean;
31
+ ready: boolean;
32
+ sHeight: number;
33
+ sWidth: number;
34
+ totalMediaObjects: number;
35
+ uniqueId: string;
36
+ zIndex: number;
37
+ emitter: import("nanoevents").Emitter<IRegionEvents>;
38
+ constructor(layout: ILayout, xml: Element, regionId: string, options: OptionsType, xlr: IXlr);
39
+ prepareRegion(): void;
40
+ prepareMedia(media: IMedia): void;
41
+ prepareFirstMedia(): void;
42
+ prepareNextMedia(): void;
43
+ prepareMediaObjects(): void;
44
+ finished(): void;
45
+ private prepareVideo;
46
+ private prepareImage;
47
+ private prepareIframe;
48
+ run(): void;
49
+ transitionNodes(oldMedia: IMedia | undefined, newMedia: IMedia | undefined): void;
50
+ playNextMedia(): void;
51
+ playPreviousMedia(): void;
52
+ end(): void;
53
+ exitTransition(): void;
54
+ exitTransitionComplete(): void;
55
+ reset(): void;
56
+ on<E extends keyof IRegionEvents>(event: E, callback: IRegionEvents[E]): import("nanoevents").Unsubscribe;
57
+ }
@@ -1 +1,2 @@
1
- export { default, ISplashScreen, PreviewSplashElement, } from './SplashScreen';
1
+ export type { ISplashScreen, PreviewSplashElement, } from './SplashScreen';
2
+ export { default, } from './SplashScreen';
@@ -1 +1,2 @@
1
- export { compassPoints, defaultTrans, fadeInElem, fadeOutElem, flyInElem, flyOutElem, transitionElement, flyTransitionKeyframes, flyTransitionParams, TransitionNameType, KeyframeOptionsType, TransitionElementOptions, } from './Transitions';
1
+ export type { compassPoints, flyTransitionParams, TransitionNameType, KeyframeOptionsType, TransitionElementOptions, } from './Transitions';
2
+ export { defaultTrans, fadeInElem, fadeOutElem, flyInElem, flyOutElem, transitionElement, flyTransitionKeyframes, } from './Transitions';
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Centralized event type definitions
3
+ * All module events should be defined here
4
+ */
5
+ import { ILayout } from "../Layout";
6
+ import { IMedia } from "../Media";
7
+ import { IRegion } from "../Region";
8
+ /**
9
+ * Events emitted by Layout
10
+ */
11
+ export interface ILayoutEvents {
12
+ start: (layout: ILayout) => void;
13
+ end: (layout: ILayout) => void;
14
+ cancelled: (layout: ILayout) => void;
15
+ layoutStart?: (layout: ILayout) => void;
16
+ layoutEnd?: (layout: ILayout) => void;
17
+ }
18
+ /**
19
+ * Events emitted by Region
20
+ */
21
+ export interface IRegionEvents {
22
+ start: (region: IRegion) => void;
23
+ end: (region: IRegion) => void;
24
+ }
25
+ /**
26
+ * Events emitted by Media
27
+ */
28
+ export interface IMediaEvents {
29
+ start: (media: IMedia) => void;
30
+ end: (media: IMedia) => void;
31
+ cancelled: (media: IMedia) => void;
32
+ }
33
+ /**
34
+ * Type alias for event unsubscriber
35
+ */
36
+ export type EventUnsubscriber = () => void;
37
+ export type EventEmitter<T> = <K extends keyof T>(event: K, ...args: Parameters<T[K] extends (...args: any[]) => any ? T[K] : never>) => void;
@@ -0,0 +1 @@
1
+ export * from './Events.types';
@@ -2,16 +2,19 @@ import { Emitter, Unsubscribe } from 'nanoevents';
2
2
  import { IRegion } from '../Region';
3
3
  import { IXlr } from '../XLR';
4
4
  import InteractiveActions, { Action } from '../../Modules/ActionController';
5
- export interface ILayoutEvents {
6
- start: (layout: ILayout) => void;
7
- end: (layout: ILayout) => void;
8
- cancelled: (layout: ILayout) => void;
9
- }
5
+ import { ILayoutEvents } from "../Events";
6
+ import { ConsumerPlatform } from "../Platform";
10
7
  export declare enum ELayoutState {
11
8
  IDLE = 0,
12
9
  RUNNING = 1,
13
10
  PLAYED = 2,
14
- CANCELLED = 3
11
+ CANCELLED = 3,
12
+ ERROR = 4
13
+ }
14
+ export declare enum LayoutPlaybackType {
15
+ CURRENT = "current",
16
+ NEXT = "next",
17
+ OVERLAY = "overlay"
15
18
  }
16
19
  export type InputLayoutType = {
17
20
  response: any;
@@ -29,12 +32,12 @@ export type OptionsType = {
29
32
  getResourceUrl: string;
30
33
  layoutBackgroundDownloadUrl: string;
31
34
  layoutPreviewUrl: string;
32
- libraryDownloadUrl: string;
33
35
  loaderUrl: string;
36
+ previewJwt: string;
34
37
  idCounter: number;
35
38
  inPreview: boolean;
36
39
  appHost?: string | null;
37
- platform: 'CMS' | 'chromeOS';
40
+ platform: ConsumerPlatform;
38
41
  config?: {
39
42
  cmsUrl: string | null;
40
43
  schemaVersion: number;
@@ -87,7 +90,7 @@ export interface ILayout {
87
90
  on<E extends keyof ILayoutEvents>(event: E, callback: ILayoutEvents[E]): Unsubscribe;
88
91
  regionExpired(): void;
89
92
  end(): void;
90
- regionEnded(): Promise<void>;
93
+ regionEnded(): void;
91
94
  stopAllMedia(): Promise<void>;
92
95
  resetLayout(): Promise<void>;
93
96
  index: number;
@@ -96,7 +99,7 @@ export interface ILayout {
96
99
  xlr: IXlr;
97
100
  finishAllRegions(): Promise<void[]>;
98
101
  inLoop: boolean;
99
- removeLayout(): void;
102
+ removeLayout(caller?: LayoutPlaybackType): void;
100
103
  xlfString: string;
101
104
  getXlf(): string;
102
105
  ad: any;
@@ -104,6 +107,8 @@ export interface ILayout {
104
107
  shareOfVoice: number;
105
108
  isInterrupt(): boolean;
106
109
  state: ELayoutState;
110
+ errorCode: number | null;
111
+ html: HTMLElement | null;
107
112
  }
108
113
  export declare const initialLayout: ILayout;
109
114
  export type GetLayoutParamType = {
@@ -1 +1,2 @@
1
- export { GetLayoutParamType, GetLayoutType, ILayout, InputLayoutType, OptionsType, initialLayout, ILayoutEvents, ELayoutState, } from './Layout.types';
1
+ export type { GetLayoutParamType, GetLayoutType, ILayout, InputLayoutType, OptionsType, } from './Layout.types';
2
+ export { initialLayout, ELayoutState, LayoutPlaybackType, } from './Layout.types';
@@ -1,13 +1,15 @@
1
1
  import { Emitter } from 'nanoevents';
2
2
  import Player from "video.js/dist/types/player";
3
- import { IMediaEvents } from '../../Modules/Media/Media';
4
3
  import { IRegion } from '../Region';
5
4
  import { OptionsType } from '../Layout';
6
- export type MediaState = 'idle' | 'playing' | 'ended';
5
+ import { IVideoMediaHandler } from "../../Modules/Media";
6
+ import { IMediaEvents } from "../Events";
7
+ export type MediaState = 'idle' | 'playing' | 'ended' | 'cancelled';
7
8
  export declare const MediaState: {
8
9
  readonly IDLE: "idle";
9
10
  readonly PLAYING: "playing";
10
11
  readonly ENDED: "ended";
12
+ readonly CANCELLED: "cancelled";
11
13
  };
12
14
  export interface IMedia {
13
15
  attachedAudio: boolean;
@@ -50,5 +52,7 @@ export interface IMedia {
50
52
  url: string | null;
51
53
  useDuration: boolean;
52
54
  xml: Element | null;
55
+ videoHandler?: IVideoMediaHandler;
56
+ mediaTimer: ReturnType<typeof setInterval> | undefined;
53
57
  }
54
58
  export declare const initialMedia: IMedia;
@@ -1 +1,2 @@
1
- export { IMedia, initialMedia, } from './Media.types';
1
+ export type { IMedia, } from './Media.types';
2
+ export { initialMedia, MediaState, } from './Media.types';
@@ -0,0 +1,12 @@
1
+ export declare enum ConsumerPlatform {
2
+ CMS = "CMS",
3
+ CHROMEOS = "chromeOS",
4
+ ELECTRON = "electron",
5
+ IOS = "ios",
6
+ MACOS = "macos",
7
+ ANDROID = "android",
8
+ LINUX = "linux",
9
+ WINDOWS = "windows",
10
+ WEBOS = "webos",
11
+ TIZEN = "tizen"
12
+ }
@@ -0,0 +1 @@
1
+ export * from './Platform.types';
@@ -1,15 +1,13 @@
1
1
  import { DefaultEvents, Emitter, Unsubscribe } from 'nanoevents';
2
2
  import { ILayout } from '../Layout';
3
3
  import { IMedia } from '../Media';
4
- export interface IRegionEvents {
5
- start: (layout: IRegion) => void;
6
- end: (layout: IRegion) => void;
7
- }
4
+ import { IRegionEvents } from "../Events";
5
+ import { IXlr } from "../XLR";
8
6
  export interface IRegion {
9
7
  complete: boolean;
10
8
  containerName: string;
11
9
  currMedia: IMedia | undefined;
12
- currEl: HTMLElement | undefined;
10
+ currEl: HTMLElement | null;
13
11
  currentMedia: number;
14
12
  currentMediaIndex: number;
15
13
  emitter?: Emitter<DefaultEvents>;
@@ -26,7 +24,7 @@ export interface IRegion {
26
24
  mediaObjects: IMedia[];
27
25
  mediaObjectsActions: IMedia[];
28
26
  nxtMedia: IMedia | undefined;
29
- nxtEl: HTMLElement | undefined;
27
+ nxtEl: HTMLElement | null;
30
28
  offsetX: number;
31
29
  offsetY: number;
32
30
  oldMedia: IMedia | undefined;
@@ -50,5 +48,7 @@ export interface IRegion {
50
48
  uniqueId: string;
51
49
  xml: null | Element;
52
50
  zIndex: number;
51
+ prepareNextMedia(): void;
52
+ xlr: IXlr;
53
53
  }
54
54
  export declare const initialRegion: IRegion;
@@ -1 +1,2 @@
1
- export { IRegion, IRegionEvents, initialRegion, } from './Region.types';
1
+ export type { IRegion, } from './Region.types';
2
+ export { initialRegion, } from './Region.types';
@@ -21,6 +21,8 @@ export type IXlrEvents = {
21
21
  updateOverlays: (overlays: InputLayoutType[]) => void;
22
22
  overlayStart: (overlay: ILayout) => void;
23
23
  overlayEnd: (overlay: ILayout) => void;
24
+ commandCodeReceived: (commandCode: string) => void;
25
+ commandStringReceived: (commandString: string) => void;
24
26
  };
25
27
  export interface IXlrPlayback {
26
28
  currentLayout: ILayout | undefined;
@@ -56,7 +58,7 @@ export interface IXlr {
56
58
  overlays: InputLayoutType[];
57
59
  parseLayouts(loopUpdate?: boolean): IXlrPlayback;
58
60
  playLayouts(xlr: IXlr): void;
59
- playSchedules(xlr: IXlr): void;
61
+ playSchedules(xlr: IXlr): Promise<void>;
60
62
  prepareForSsp(nextLayout: ILayout): Promise<ILayout>;
61
63
  prepareLayoutXlf(inputLayout: ILayout | undefined): Promise<ILayout>;
62
64
  prepareLayouts(): Promise<IXlr>;
@@ -1 +1,2 @@
1
- export { ELayoutType, IXlr, initialXlr, IXlrEvents, PrepareLayoutsType, IXlrPlayback, } from './XLR.types';
1
+ export type { IXlr, IXlrEvents, PrepareLayoutsType, IXlrPlayback, } from './XLR.types';
2
+ export { ELayoutType, initialXlr, } from './XLR.types';
@@ -3,7 +3,6 @@ export * from './Modules/ActionController';
3
3
  export * from './Modules/Generators';
4
4
  export * from './Modules/Layout';
5
5
  export * from './Modules/Media';
6
- export * from './Modules/Platform';
7
6
  export * from './Modules/Region';
8
7
  export * from './Modules/SplashScreen';
9
8
  export * from './Modules/Transitions';
@@ -1,4 +1,6 @@
1
1
  export * from './Types/Layout';
2
2
  export * from './Types/Media';
3
3
  export * from './Types/Region';
4
+ export * from './Types/Events';
4
5
  export * from './Types/XLR';
6
+ export * from './Types/Platform';