@clockworkdog/cogs-client 3.0.0-alpha.1 → 3.0.0-alpha.11
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/dist/AudioPlayer.js +6 -5
- package/dist/CogsConnection.js +37 -20
- package/dist/DataStore.js +11 -15
- package/dist/VideoPlayer.js +10 -7
- package/dist/browser/index.mjs +1576 -1274
- package/dist/browser/index.umd.js +6 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/state-based/MediaClipManager.d.ts +45 -0
- package/dist/state-based/MediaClipManager.js +275 -0
- package/dist/state-based/MediaPreloader.d.ts +14 -0
- package/dist/state-based/MediaPreloader.js +93 -0
- package/dist/state-based/SurfaceManager.d.ts +20 -0
- package/dist/state-based/SurfaceManager.js +86 -0
- package/dist/types/MediaSchema.d.ts +13 -0
- package/dist/types/MediaSchema.js +3 -0
- package/dist/utils/getStateAtTime.js +8 -3
- package/package.json +12 -4
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { defaultAudioOptions, defaultImageOptions, defaultVideoOptions } from '../types/MediaSchema';
|
|
2
2
|
export function getStateAtTime(state, time) {
|
|
3
|
+
//If there are any null keyframes the clip has been terminated
|
|
4
|
+
const nullKeyframes = state.keyframes.filter((kf) => kf[1] === null);
|
|
5
|
+
if (nullKeyframes.some((kf) => kf[0] <= time)) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
3
8
|
switch (state.type) {
|
|
4
9
|
case 'image': {
|
|
5
10
|
const firstTimestamp = state.keyframes[0][0];
|
|
@@ -47,11 +52,11 @@ export function getPropertiesAtTime(keyframes, time) {
|
|
|
47
52
|
// If lerp and set are both present, we assume we lerp up until the timestamp,
|
|
48
53
|
// then set to a new value
|
|
49
54
|
Object.entries(properties.lerp ?? {}).forEach(([property, value]) => {
|
|
50
|
-
propertyKeyframes[property]
|
|
55
|
+
propertyKeyframes[property] ??= {};
|
|
51
56
|
propertyKeyframes[property].before = [timestamp, value];
|
|
52
57
|
});
|
|
53
58
|
Object.entries(properties.set ?? {}).forEach(([property, value]) => {
|
|
54
|
-
propertyKeyframes[property]
|
|
59
|
+
propertyKeyframes[property] ??= {};
|
|
55
60
|
propertyKeyframes[property].before = [timestamp, value];
|
|
56
61
|
});
|
|
57
62
|
}
|
|
@@ -59,7 +64,7 @@ export function getPropertiesAtTime(keyframes, time) {
|
|
|
59
64
|
// We're trying to find the closest timestamp afterwards for lerping
|
|
60
65
|
// So only set if not yet set
|
|
61
66
|
Object.entries(properties.lerp ?? {}).forEach(([property, value]) => {
|
|
62
|
-
propertyKeyframes[property]
|
|
67
|
+
propertyKeyframes[property] ??= {};
|
|
63
68
|
if (propertyKeyframes[property].after === undefined) {
|
|
64
69
|
propertyKeyframes[property].after = [timestamp, value];
|
|
65
70
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "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/javascript",
|
|
6
|
-
"version": "3.0.0-alpha.
|
|
6
|
+
"version": "3.0.0-alpha.11",
|
|
7
7
|
"keywords": [],
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"repository": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"default": "./dist/index.js"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
|
-
"test": "yarn types && yarn lint && vitest",
|
|
25
|
+
"test": "yarn types && yarn lint && vitest && yarn cy:run",
|
|
26
26
|
"types": "tsc --noEmit",
|
|
27
27
|
"lint": "eslint .",
|
|
28
28
|
"build": "yarn build:ts && yarn build:browser",
|
|
@@ -31,24 +31,32 @@
|
|
|
31
31
|
"watch-build": "tsc -w",
|
|
32
32
|
"build-docs": "typedoc --out ../../docs/javascript --name @clockworkdog/cogs-client src/index.ts",
|
|
33
33
|
"release": "yarn npm publish --access public",
|
|
34
|
-
"prerelease": "yarn npm publish --access public --tag=next"
|
|
34
|
+
"prerelease": "yarn npm publish --access public --tag=next",
|
|
35
|
+
"cy:open": "cypress open",
|
|
36
|
+
"cy:run": "cypress run --component",
|
|
37
|
+
"cy:generate": "cypress run --e2e"
|
|
35
38
|
},
|
|
36
39
|
"dependencies": {
|
|
37
|
-
"@clockworkdog/timesync": "^3.0.0-alpha.
|
|
40
|
+
"@clockworkdog/timesync": "^3.0.0-alpha.11",
|
|
38
41
|
"howler": "clockwork-dog/howler.js#fix-looping-clips",
|
|
39
42
|
"reconnecting-websocket": "^4.4.0",
|
|
40
43
|
"zod": "^4.1.13"
|
|
41
44
|
},
|
|
42
45
|
"devDependencies": {
|
|
46
|
+
"@cypress/mount-utils": "^4.1.2",
|
|
43
47
|
"@eslint/js": "^9.17.0",
|
|
44
48
|
"@types/howler": "2.2.12",
|
|
45
49
|
"@types/jsdom": "^27",
|
|
46
50
|
"@types/node": "^22.10.2",
|
|
51
|
+
"cypress": "^14.5.4",
|
|
47
52
|
"eslint": "^9.17.0",
|
|
48
53
|
"eslint-config-prettier": "^9.1.0",
|
|
49
54
|
"eslint-plugin-prettier": "^5.2.1",
|
|
50
55
|
"jsdom": "^27.1.0",
|
|
51
56
|
"prettier": "^3.4.2",
|
|
57
|
+
"react": "^19.1.1",
|
|
58
|
+
"react-dom": "^19.1.1",
|
|
59
|
+
"sharp": "^0.34.5",
|
|
52
60
|
"typedoc": "^0.27.5",
|
|
53
61
|
"typescript": "~5.7.2",
|
|
54
62
|
"typescript-eslint": "^8.18.1",
|