@clockworkdog/cogs-client-react 3.0.0-alpha.7 → 3.0.0-alpha.8
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SurfaceManager } from '@clockworkdog/cogs-client';
|
|
1
|
+
import { MediaPreloader, SurfaceManager } from '@clockworkdog/cogs-client';
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
3
|
export function MediaSurface({ cogsConnection }) {
|
|
4
4
|
const surfaceManagerRef = useRef(undefined);
|
|
@@ -6,7 +6,13 @@ export function MediaSurface({ cogsConnection }) {
|
|
|
6
6
|
const [surfaceElem, setSurfaceElem] = useState();
|
|
7
7
|
// Create and attach new surface manager
|
|
8
8
|
useEffect(() => {
|
|
9
|
-
const
|
|
9
|
+
const mediaPreloader = new MediaPreloader(cogsConnection.getAssetUrl);
|
|
10
|
+
const sm = new SurfaceManager(cogsConnection.getAssetUrl, {}, mediaPreloader);
|
|
11
|
+
cogsConnection.addEventListener('message', ({ message }) => {
|
|
12
|
+
if (message.type === 'media_config_update') {
|
|
13
|
+
mediaPreloader.setState(message.files);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
10
16
|
surfaceManagerRef.current = sm;
|
|
11
17
|
surfaceElem?.replaceChildren(sm.element);
|
|
12
18
|
return () => {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "React components and hooks to connect to COGS to build a custom Media Master",
|
|
4
4
|
"author": "Clockwork Dog <info@clockwork.dog>",
|
|
5
5
|
"homepage": "https://github.com/clockwork-dog/cogs-sdk/tree/main/packages/react",
|
|
6
|
-
"version": "3.0.0-alpha.
|
|
6
|
+
"version": "3.0.0-alpha.8",
|
|
7
7
|
"keywords": [],
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"repository": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"prerelease": "yarn npm publish --access public --tag=next"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@clockworkdog/cogs-client": "^3.0.0-alpha.
|
|
31
|
+
"@clockworkdog/cogs-client": "^3.0.0-alpha.8"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": "^18.0.0 || ^19.0.0",
|