@dcl/ecs 7.1.10-4896345180.commit-d9eebaf → 7.1.10-4897779046.commit-853bd22
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/components/generated/VideoEvent.gen.d.ts +1 -0
- package/dist/components/generated/VideoEvent.gen.js +25 -0
- package/dist/components/generated/component-names.gen.js +1 -0
- package/dist/components/generated/global.gen.d.ts +2 -0
- package/dist/components/generated/global.gen.js +1 -0
- package/dist/components/generated/index.gen.d.ts +4 -0
- package/dist/components/generated/index.gen.js +7 -0
- package/dist/components/generated/pb/decentraland/sdk/components/video_event.gen.d.ts +25 -0
- package/dist/components/generated/pb/decentraland/sdk/components/video_event.gen.js +91 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/runtime/initialization/index.d.ts +8 -0
- package/dist/runtime/initialization/index.js +7 -0
- package/dist/systems/videoEvents.d.ts +14 -0
- package/dist/systems/videoEvents.js +62 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PBVideoEvent } from './pb/decentraland/sdk/components/video_event.gen';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export const VideoEventSchema = {
|
|
6
|
+
COMPONENT_ID: 1044,
|
|
7
|
+
serialize(value, builder) {
|
|
8
|
+
const writer = PBVideoEvent.encode(value);
|
|
9
|
+
const buffer = new Uint8Array(writer.finish(), 0, writer.len);
|
|
10
|
+
builder.writeBuffer(buffer, false);
|
|
11
|
+
},
|
|
12
|
+
deserialize(reader) {
|
|
13
|
+
return PBVideoEvent.decode(reader.buffer(), reader.remainingBytes());
|
|
14
|
+
},
|
|
15
|
+
create() {
|
|
16
|
+
// TODO: this is a hack.
|
|
17
|
+
return PBVideoEvent.decode(new Uint8Array());
|
|
18
|
+
},
|
|
19
|
+
jsonSchema: {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: {},
|
|
22
|
+
serializationType: "protocol-buffer",
|
|
23
|
+
protocolBuffer: "PBVideoEvent"
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -26,6 +26,7 @@ import { PBUiInput } from './pb/decentraland/sdk/components/ui_input.gen';
|
|
|
26
26
|
import { PBUiInputResult } from './pb/decentraland/sdk/components/ui_input_result.gen';
|
|
27
27
|
import { PBUiText } from './pb/decentraland/sdk/components/ui_text.gen';
|
|
28
28
|
import { PBUiTransform } from './pb/decentraland/sdk/components/ui_transform.gen';
|
|
29
|
+
import { PBVideoEvent } from './pb/decentraland/sdk/components/video_event.gen';
|
|
29
30
|
import { PBVideoPlayer } from './pb/decentraland/sdk/components/video_player.gen';
|
|
30
31
|
import { PBVisibilityComponent } from './pb/decentraland/sdk/components/visibility_component.gen';
|
|
31
32
|
/** @public */ export declare const AudioSource: LastWriteWinElementSetComponentDefinition<PBAudioSource>;
|
|
@@ -54,5 +55,6 @@ import { PBVisibilityComponent } from './pb/decentraland/sdk/components/visibili
|
|
|
54
55
|
/** @public */ export declare const UiInputResult: LastWriteWinElementSetComponentDefinition<PBUiInputResult>;
|
|
55
56
|
/** @public */ export declare const UiText: LastWriteWinElementSetComponentDefinition<PBUiText>;
|
|
56
57
|
/** @public */ export declare const UiTransform: LastWriteWinElementSetComponentDefinition<PBUiTransform>;
|
|
58
|
+
/** @public */ export declare const VideoEvent: GrowOnlyValueSetComponentDefinition<PBVideoEvent>;
|
|
57
59
|
/** @public */ export declare const VideoPlayer: LastWriteWinElementSetComponentDefinition<PBVideoPlayer>;
|
|
58
60
|
/** @public */ export declare const VisibilityComponent: LastWriteWinElementSetComponentDefinition<PBVisibilityComponent>;
|
|
@@ -27,5 +27,6 @@ export * from './index.gen';
|
|
|
27
27
|
/** @public */ export const UiInputResult = /* @__PURE__ */ components.UiInputResult(engine);
|
|
28
28
|
/** @public */ export const UiText = /* @__PURE__ */ components.UiText(engine);
|
|
29
29
|
/** @public */ export const UiTransform = /* @__PURE__ */ components.UiTransform(engine);
|
|
30
|
+
/** @public */ export const VideoEvent = /* @__PURE__ */ components.VideoEvent(engine);
|
|
30
31
|
/** @public */ export const VideoPlayer = /* @__PURE__ */ components.VideoPlayer(engine);
|
|
31
32
|
/** @public */ export const VisibilityComponent = /* @__PURE__ */ components.VisibilityComponent(engine);
|
|
@@ -30,6 +30,7 @@ import { PBUiInput } from './pb/decentraland/sdk/components/ui_input.gen';
|
|
|
30
30
|
import { PBUiInputResult } from './pb/decentraland/sdk/components/ui_input_result.gen';
|
|
31
31
|
import { PBUiText } from './pb/decentraland/sdk/components/ui_text.gen';
|
|
32
32
|
import { PBUiTransform } from './pb/decentraland/sdk/components/ui_transform.gen';
|
|
33
|
+
import { PBVideoEvent } from './pb/decentraland/sdk/components/video_event.gen';
|
|
33
34
|
import { PBVideoPlayer } from './pb/decentraland/sdk/components/video_player.gen';
|
|
34
35
|
import { PBVisibilityComponent } from './pb/decentraland/sdk/components/visibility_component.gen';
|
|
35
36
|
export * from './pb/decentraland/sdk/components/animator.gen';
|
|
@@ -62,6 +63,7 @@ export * from './pb/decentraland/sdk/components/ui_input.gen';
|
|
|
62
63
|
export * from './pb/decentraland/sdk/components/ui_input_result.gen';
|
|
63
64
|
export * from './pb/decentraland/sdk/components/ui_text.gen';
|
|
64
65
|
export * from './pb/decentraland/sdk/components/ui_transform.gen';
|
|
66
|
+
export * from './pb/decentraland/sdk/components/video_event.gen';
|
|
65
67
|
export * from './pb/decentraland/sdk/components/video_player.gen';
|
|
66
68
|
export * from './pb/decentraland/sdk/components/visibility_component.gen';
|
|
67
69
|
export type LwwComponentGetter<T extends LastWriteWinElementSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineComponentFromSchema'>) => T;
|
|
@@ -96,6 +98,7 @@ export type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<an
|
|
|
96
98
|
/** @public */ export declare const UiInputResult: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiInputResult>>;
|
|
97
99
|
/** @public */ export declare const UiText: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiText>>;
|
|
98
100
|
/** @public */ export declare const UiTransform: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiTransform>>;
|
|
101
|
+
/** @public */ export declare const VideoEvent: GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBVideoEvent>>;
|
|
99
102
|
/** @public */ export declare const VideoPlayer: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBVideoPlayer>>;
|
|
100
103
|
/** @public */ export declare const VisibilityComponent: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBVisibilityComponent>>;
|
|
101
104
|
/** public */
|
|
@@ -130,6 +133,7 @@ export declare const componentDefinitionByName: {
|
|
|
130
133
|
"core::UiInputResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiInputResult>>;
|
|
131
134
|
"core::UiText": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiText>>;
|
|
132
135
|
"core::UiTransform": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiTransform>>;
|
|
136
|
+
"core::VideoEvent": GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBVideoEvent>>;
|
|
133
137
|
"core::VideoPlayer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBVideoPlayer>>;
|
|
134
138
|
"core::VisibilityComponent": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBVisibilityComponent>>;
|
|
135
139
|
};
|
|
@@ -28,6 +28,7 @@ import { UiInputSchema } from './UiInput.gen';
|
|
|
28
28
|
import { UiInputResultSchema } from './UiInputResult.gen';
|
|
29
29
|
import { UiTextSchema } from './UiText.gen';
|
|
30
30
|
import { UiTransformSchema } from './UiTransform.gen';
|
|
31
|
+
import { VideoEventSchema } from './VideoEvent.gen';
|
|
31
32
|
import { VideoPlayerSchema } from './VideoPlayer.gen';
|
|
32
33
|
import { VisibilityComponentSchema } from './VisibilityComponent.gen';
|
|
33
34
|
export * from './pb/decentraland/sdk/components/animator.gen';
|
|
@@ -60,6 +61,7 @@ export * from './pb/decentraland/sdk/components/ui_input.gen';
|
|
|
60
61
|
export * from './pb/decentraland/sdk/components/ui_input_result.gen';
|
|
61
62
|
export * from './pb/decentraland/sdk/components/ui_text.gen';
|
|
62
63
|
export * from './pb/decentraland/sdk/components/ui_transform.gen';
|
|
64
|
+
export * from './pb/decentraland/sdk/components/video_event.gen';
|
|
63
65
|
export * from './pb/decentraland/sdk/components/video_player.gen';
|
|
64
66
|
export * from './pb/decentraland/sdk/components/visibility_component.gen';
|
|
65
67
|
/** @public */ export const Animator = engine =>
|
|
@@ -124,6 +126,10 @@ export * from './pb/decentraland/sdk/components/visibility_component.gen';
|
|
|
124
126
|
/* @__PURE__ */ engine.defineComponentFromSchema("core::UiText", UiTextSchema);
|
|
125
127
|
/** @public */ export const UiTransform = engine =>
|
|
126
128
|
/* @__PURE__ */ engine.defineComponentFromSchema("core::UiTransform", UiTransformSchema);
|
|
129
|
+
/** @public */ export const VideoEvent = (engine) => /* @__PURE__ */ engine.defineValueSetComponentFromSchema("core::VideoEvent", VideoEventSchema, {
|
|
130
|
+
timestampFunction: (t) => t.timestamp,
|
|
131
|
+
maxElements: 100
|
|
132
|
+
});
|
|
127
133
|
/** @public */ export const VideoPlayer = engine =>
|
|
128
134
|
/* @__PURE__ */ engine.defineComponentFromSchema("core::VideoPlayer", VideoPlayerSchema);
|
|
129
135
|
/** @public */ export const VisibilityComponent = engine =>
|
|
@@ -160,6 +166,7 @@ export const componentDefinitionByName = /* @__PURE__ */ {
|
|
|
160
166
|
"core::UiInputResult": UiInputResult,
|
|
161
167
|
"core::UiText": UiText,
|
|
162
168
|
"core::UiTransform": UiTransform,
|
|
169
|
+
"core::VideoEvent": VideoEvent,
|
|
163
170
|
"core::VideoPlayer": VideoPlayer,
|
|
164
171
|
"core::VisibilityComponent": VisibilityComponent,
|
|
165
172
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
*/
|
|
4
|
+
export declare const enum VideoState {
|
|
5
|
+
VS_NONE = 0,
|
|
6
|
+
VS_ERROR = 1,
|
|
7
|
+
VS_LOADING = 2,
|
|
8
|
+
VS_READY = 3,
|
|
9
|
+
VS_PLAYING = 4,
|
|
10
|
+
VS_BUFFERING = 5,
|
|
11
|
+
VS_SEEKING = 6,
|
|
12
|
+
VS_PAUSED = 7
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export interface PBVideoEvent {
|
|
18
|
+
/** monotonic counter */
|
|
19
|
+
timestamp: number;
|
|
20
|
+
/** number of tick in which the event was produced, equals to EngineInfo.tick_number */
|
|
21
|
+
tickNumber: number;
|
|
22
|
+
currentOffset: number;
|
|
23
|
+
videoLength: number;
|
|
24
|
+
state: VideoState;
|
|
25
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import _m0 from "protobufjs/minimal";
|
|
3
|
+
const protobufPackageSarasa = "decentraland.sdk.components";
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export var VideoState;
|
|
8
|
+
(function (VideoState) {
|
|
9
|
+
VideoState[VideoState["VS_NONE"] = 0] = "VS_NONE";
|
|
10
|
+
VideoState[VideoState["VS_ERROR"] = 1] = "VS_ERROR";
|
|
11
|
+
VideoState[VideoState["VS_LOADING"] = 2] = "VS_LOADING";
|
|
12
|
+
VideoState[VideoState["VS_READY"] = 3] = "VS_READY";
|
|
13
|
+
VideoState[VideoState["VS_PLAYING"] = 4] = "VS_PLAYING";
|
|
14
|
+
VideoState[VideoState["VS_BUFFERING"] = 5] = "VS_BUFFERING";
|
|
15
|
+
VideoState[VideoState["VS_SEEKING"] = 6] = "VS_SEEKING";
|
|
16
|
+
VideoState[VideoState["VS_PAUSED"] = 7] = "VS_PAUSED";
|
|
17
|
+
})(VideoState || (VideoState = {}));
|
|
18
|
+
function createBasePBVideoEvent() {
|
|
19
|
+
return { timestamp: 0, tickNumber: 0, currentOffset: 0, videoLength: 0, state: 0 };
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export const PBVideoEvent = {
|
|
28
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
29
|
+
if (message.timestamp !== 0) {
|
|
30
|
+
writer.uint32(8).uint32(message.timestamp);
|
|
31
|
+
}
|
|
32
|
+
if (message.tickNumber !== 0) {
|
|
33
|
+
writer.uint32(16).uint32(message.tickNumber);
|
|
34
|
+
}
|
|
35
|
+
if (message.currentOffset !== 0) {
|
|
36
|
+
writer.uint32(29).float(message.currentOffset);
|
|
37
|
+
}
|
|
38
|
+
if (message.videoLength !== 0) {
|
|
39
|
+
writer.uint32(37).float(message.videoLength);
|
|
40
|
+
}
|
|
41
|
+
if (message.state !== 0) {
|
|
42
|
+
writer.uint32(40).int32(message.state);
|
|
43
|
+
}
|
|
44
|
+
return writer;
|
|
45
|
+
},
|
|
46
|
+
decode(input, length) {
|
|
47
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
48
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
49
|
+
const message = createBasePBVideoEvent();
|
|
50
|
+
while (reader.pos < end) {
|
|
51
|
+
const tag = reader.uint32();
|
|
52
|
+
switch (tag >>> 3) {
|
|
53
|
+
case 1:
|
|
54
|
+
if (tag != 8) {
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
message.timestamp = reader.uint32();
|
|
58
|
+
continue;
|
|
59
|
+
case 2:
|
|
60
|
+
if (tag != 16) {
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
message.tickNumber = reader.uint32();
|
|
64
|
+
continue;
|
|
65
|
+
case 3:
|
|
66
|
+
if (tag != 29) {
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
message.currentOffset = reader.float();
|
|
70
|
+
continue;
|
|
71
|
+
case 4:
|
|
72
|
+
if (tag != 37) {
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
message.videoLength = reader.float();
|
|
76
|
+
continue;
|
|
77
|
+
case 5:
|
|
78
|
+
if (tag != 40) {
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
message.state = reader.int32();
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if ((tag & 7) == 4 || tag == 0) {
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
reader.skipType(tag & 7);
|
|
88
|
+
}
|
|
89
|
+
return message;
|
|
90
|
+
},
|
|
91
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './runtime/helpers';
|
|
|
6
6
|
export { cyclicParentingChecker } from './systems/cyclicParentingChecker';
|
|
7
7
|
export * from './systems/events';
|
|
8
8
|
export * from './systems/raycast';
|
|
9
|
+
export * from './systems/videoEvents';
|
|
9
10
|
export * from './systems/async-task';
|
|
10
11
|
export * from './engine/entity';
|
|
11
12
|
export * from './components/types';
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from './runtime/helpers';
|
|
|
7
7
|
export { cyclicParentingChecker } from './systems/cyclicParentingChecker';
|
|
8
8
|
export * from './systems/events';
|
|
9
9
|
export * from './systems/raycast';
|
|
10
|
+
export * from './systems/videoEvents';
|
|
10
11
|
export * from './systems/async-task';
|
|
11
12
|
export * from './engine/entity';
|
|
12
13
|
export * from './components/types';
|
|
@@ -7,6 +7,7 @@ import { Task } from '../../systems/async-task';
|
|
|
7
7
|
import { PointerEventsSystem } from '../../systems/events';
|
|
8
8
|
import { IInputSystem } from './../../engine/input';
|
|
9
9
|
import { RaycastSystem } from '../../systems/raycast';
|
|
10
|
+
import { VideoEventsSystem } from '../../systems/videoEvents';
|
|
10
11
|
/**
|
|
11
12
|
* @public
|
|
12
13
|
* The engine is the part of the scene that sits in the middle and manages all of the other parts.
|
|
@@ -42,6 +43,13 @@ export { PointerEventsSystem };
|
|
|
42
43
|
*/
|
|
43
44
|
export declare const raycastSystem: RaycastSystem;
|
|
44
45
|
export { RaycastSystem };
|
|
46
|
+
/**
|
|
47
|
+
* @alpha
|
|
48
|
+
* @public
|
|
49
|
+
* Register callback functions to a particular entity on video events.
|
|
50
|
+
*/
|
|
51
|
+
export declare const videoEventsSystem: VideoEventsSystem;
|
|
52
|
+
export { VideoEventsSystem };
|
|
45
53
|
/**
|
|
46
54
|
* @public
|
|
47
55
|
* Runs an async function
|
|
@@ -7,6 +7,7 @@ import { createTaskSystem } from '../../systems/async-task';
|
|
|
7
7
|
import { createPointerEventsSystem } from '../../systems/events';
|
|
8
8
|
import { createInputSystem } from './../../engine/input';
|
|
9
9
|
import { createRaycastSystem } from '../../systems/raycast';
|
|
10
|
+
import { createVideoEventsSystem } from '../../systems/videoEvents';
|
|
10
11
|
/**
|
|
11
12
|
* @public
|
|
12
13
|
* The engine is the part of the scene that sits in the middle and manages all of the other parts.
|
|
@@ -39,6 +40,12 @@ export const pointerEventsSystem = /* @__PURE__ */ createPointerEventsSystem(eng
|
|
|
39
40
|
* Register callback functions to a particular entity on raycast results.
|
|
40
41
|
*/
|
|
41
42
|
export const raycastSystem = /* @__PURE__ */ createRaycastSystem(engine);
|
|
43
|
+
/**
|
|
44
|
+
* @alpha
|
|
45
|
+
* @public
|
|
46
|
+
* Register callback functions to a particular entity on video events.
|
|
47
|
+
*/
|
|
48
|
+
export const videoEventsSystem = /* @__PURE__ */ createVideoEventsSystem(engine);
|
|
42
49
|
/**
|
|
43
50
|
* @public
|
|
44
51
|
* Runs an async function
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DeepReadonlyObject, Entity } from '../engine';
|
|
2
|
+
import { PBVideoEvent } from '../components';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export type VideoEventsSystemCallback = (event: DeepReadonlyObject<PBVideoEvent>) => void;
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface VideoEventsSystem {
|
|
11
|
+
removeVideoEventsEntity(entity: Entity): void;
|
|
12
|
+
registerVideoEventsEntity(entity: Entity, callback: VideoEventsSystemCallback): void;
|
|
13
|
+
hasVideoEventsEntity(entity: Entity): boolean;
|
|
14
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as components from '../components';
|
|
2
|
+
import { EntityState } from '../engine/entity';
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export function createVideoEventsSystem(engine) {
|
|
7
|
+
const videoPlayerComponent = components.VideoPlayer(engine);
|
|
8
|
+
const videoEventComponent = components.VideoEvent(engine);
|
|
9
|
+
const entitiesCallbackVideoStateMap = new Map();
|
|
10
|
+
function registerVideoEventsEntity(entity, callback) {
|
|
11
|
+
// video event component is not added here because the renderer adds it
|
|
12
|
+
// to every entity with a VideoPlayer component
|
|
13
|
+
entitiesCallbackVideoStateMap.set(entity, { callback: callback });
|
|
14
|
+
}
|
|
15
|
+
function removeVideoEventsEntity(entity) {
|
|
16
|
+
entitiesCallbackVideoStateMap.delete(entity);
|
|
17
|
+
}
|
|
18
|
+
function hasVideoEventsEntity(entity) {
|
|
19
|
+
return entitiesCallbackVideoStateMap.has(entity);
|
|
20
|
+
}
|
|
21
|
+
// @internal
|
|
22
|
+
engine.addSystem(function EventSystem() {
|
|
23
|
+
for (const [entity, data] of entitiesCallbackVideoStateMap) {
|
|
24
|
+
const videoPlayer = videoPlayerComponent.getOrNull(entity);
|
|
25
|
+
if (engine.getEntityState(entity) === EntityState.Removed || !videoPlayer) {
|
|
26
|
+
removeVideoEventsEntity(entity);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
// Compare with last state
|
|
30
|
+
const videoEvent = videoEventComponent.get(entity);
|
|
31
|
+
const values = videoEvent.values();
|
|
32
|
+
const valuesAmount = videoEvent.size;
|
|
33
|
+
let latestVideoEventComponentState = undefined;
|
|
34
|
+
// get latest component state
|
|
35
|
+
let index = 0;
|
|
36
|
+
for (const value of values) {
|
|
37
|
+
if (index === valuesAmount - 1)
|
|
38
|
+
latestVideoEventComponentState = value;
|
|
39
|
+
index++;
|
|
40
|
+
}
|
|
41
|
+
if (latestVideoEventComponentState === undefined ||
|
|
42
|
+
(data.lastVideoState !== undefined && data.lastVideoState === latestVideoEventComponentState.state))
|
|
43
|
+
continue;
|
|
44
|
+
data.callback(latestVideoEventComponentState);
|
|
45
|
+
entitiesCallbackVideoStateMap.set(entity, {
|
|
46
|
+
callback: data.callback,
|
|
47
|
+
lastVideoState: latestVideoEventComponentState.state
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
removeVideoEventsEntity(entity) {
|
|
53
|
+
removeVideoEventsEntity(entity);
|
|
54
|
+
},
|
|
55
|
+
registerVideoEventsEntity(entity, callback) {
|
|
56
|
+
registerVideoEventsEntity(entity, callback);
|
|
57
|
+
},
|
|
58
|
+
hasVideoEventsEntity(entity) {
|
|
59
|
+
return hasVideoEventsEntity(entity);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/ecs",
|
|
3
3
|
"description": "Decentraland ECS",
|
|
4
|
-
"version": "7.1.10-
|
|
4
|
+
"version": "7.1.10-4897779046.commit-853bd22",
|
|
5
5
|
"author": "DCL",
|
|
6
6
|
"bugs": "https://github.com/decentraland/ecs/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@dcl/js-runtime": "7.1.10-
|
|
8
|
+
"@dcl/js-runtime": "7.1.10-4897779046.commit-853bd22"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"ts-proto": "^1.122.0"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
},
|
|
38
38
|
"types": "./dist/index.d.ts",
|
|
39
39
|
"typings": "./dist/index.d.ts",
|
|
40
|
-
"commit": "
|
|
40
|
+
"commit": "853bd22662d7996fa52755792237b79e2d465177"
|
|
41
41
|
}
|