@realsee/vreo 2.6.5 → 3.0.0-webgpu.10
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/LICENSE-UPDATE.txt +2 -2
- package/README.md +6 -6
- package/lib/PlayController/createHTMLAudioElement.d.ts +1 -0
- package/lib/PlayController/createHTMLAudioElement.d.ts.map +1 -0
- package/lib/PlayController/index.d.ts +14 -24
- package/lib/PlayController/index.d.ts.map +1 -0
- package/lib/PlayController/index.js +74 -220
- package/lib/PlayController/index.js.map +1 -0
- package/lib/Player/App.d.ts +2 -2
- package/lib/Player/App.d.ts.map +1 -0
- package/lib/Player/Controller.d.ts +11 -6
- package/lib/Player/Controller.d.ts.map +1 -0
- package/lib/Player/PlaybackLifecycle.d.ts +1 -0
- package/lib/Player/PlaybackLifecycle.d.ts.map +1 -0
- package/lib/Player/custom/SpatialScenePanel/index.d.ts +2 -2
- package/lib/Player/custom/SpatialScenePanel/index.d.ts.map +1 -0
- package/lib/Player/hooks.d.ts +3 -2
- package/lib/Player/hooks.d.ts.map +1 -0
- package/lib/Player/index.d.ts +3 -2
- package/lib/Player/index.d.ts.map +1 -0
- package/lib/Player/index.js +1770 -437
- package/lib/Player/index.js.map +1 -0
- package/lib/Player/modules/Drawer/index.d.ts +2 -2
- package/lib/Player/modules/Drawer/index.d.ts.map +1 -0
- package/lib/Player/modules/PopUp/index.d.ts +2 -2
- package/lib/Player/modules/PopUp/index.d.ts.map +1 -0
- package/lib/Player/modules/ResizeObserver/index.d.ts +2 -2
- package/lib/Player/modules/ResizeObserver/index.d.ts.map +1 -0
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +5 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts.map +1 -0
- package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +8 -5
- package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts.map +1 -0
- package/lib/Player/modules/VideoAgent/index.d.ts +11 -2
- package/lib/Player/modules/VideoAgent/index.d.ts.map +1 -0
- package/lib/Player/modules/Wave/index.d.ts +2 -2
- package/lib/Player/modules/Wave/index.d.ts.map +1 -0
- package/lib/Player/modules/keyframes/BgMusic/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/BgMusic/index.d.ts.map +1 -0
- package/lib/Player/modules/keyframes/CameraMovement/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/CameraMovement/index.d.ts.map +1 -0
- package/lib/Player/modules/keyframes/InfoPanel/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/InfoPanel/index.d.ts.map +1 -0
- package/lib/Player/modules/keyframes/ModelVideo/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/ModelVideo/index.d.ts.map +1 -0
- package/lib/Player/modules/keyframes/PanoEffect/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/PanoEffect/index.d.ts.map +1 -0
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.d.ts +3 -2
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.d.ts.map +1 -0
- package/lib/Player/modules/keyframes/PanoTag/index.d.ts +1 -0
- package/lib/Player/modules/keyframes/PanoTag/index.d.ts.map +1 -0
- package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts.map +1 -0
- package/lib/Player/modules/keyframes/Prompter/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/Prompter/index.d.ts.map +1 -0
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.d.ts.map +1 -0
- package/lib/Player/modules/keyframes/VideoEffect/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/VideoEffect/index.d.ts.map +1 -0
- package/lib/Player/playback-types.d.ts +1 -0
- package/lib/Player/playback-types.d.ts.map +1 -0
- package/lib/Player/typings.d.ts +2 -1
- package/lib/Player/typings.d.ts.map +1 -0
- package/lib/chunks/index-BgPSzRSs.js +93 -0
- package/lib/chunks/index-BgPSzRSs.js.map +1 -0
- package/lib/chunks/index-CunyJn6H.js +51 -0
- package/lib/chunks/index-CunyJn6H.js.map +1 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.d.ts +2 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.d.ts.map +1 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.d.ts +5 -6
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.d.ts.map +1 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.d.ts +1 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.d.ts.map +1 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +5 -22
- package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts.map +1 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.d.ts +2 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.d.ts.map +1 -0
- package/lib/fivePlugins/CameraMovementPlugin/index.d.ts +2 -1
- package/lib/fivePlugins/CameraMovementPlugin/index.d.ts.map +1 -0
- package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +2 -1
- package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts.map +1 -0
- package/lib/fivePlugins/ModelTVVideoPlugin/index.d.ts +2 -1
- package/lib/fivePlugins/ModelTVVideoPlugin/index.d.ts.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +12 -1
- package/lib/index.js.map +1 -0
- package/lib/plugins/CSS3DRenderPlugin.js +115 -0
- package/lib/plugins/CSS3DRenderPlugin.js.map +1 -0
- package/lib/plugins/CameraMovementPlugin.js +6 -0
- package/lib/plugins/CameraMovementPlugin.js.map +1 -0
- package/lib/plugins/ModelTVVideoPlugin.js +162 -0
- package/lib/plugins/ModelTVVideoPlugin.js.map +1 -0
- package/lib/react/index.d.ts +5 -4
- package/lib/react/index.d.ts.map +1 -0
- package/lib/react/index.js +39 -226
- package/lib/react/index.js.map +1 -0
- package/lib/shared-utils/Audio.d.ts +3 -1
- package/lib/shared-utils/Audio.d.ts.map +1 -0
- package/lib/shared-utils/AudioLike.d.ts +2 -1
- package/lib/shared-utils/AudioLike.d.ts.map +1 -0
- package/lib/shared-utils/Preloader.d.ts +1 -0
- package/lib/shared-utils/Preloader.d.ts.map +1 -0
- package/lib/shared-utils/addResizeListener.d.ts +2 -1
- package/lib/shared-utils/addResizeListener.d.ts.map +1 -0
- package/lib/shared-utils/animationFrame/BetterTween.d.ts +1 -0
- package/lib/shared-utils/animationFrame/BetterTween.d.ts.map +1 -0
- package/lib/shared-utils/animationFrame/index.d.ts +5 -14
- package/lib/shared-utils/animationFrame/index.d.ts.map +1 -0
- package/lib/shared-utils/animationFrame/tween.d.ts +1 -0
- package/lib/shared-utils/animationFrame/tween.d.ts.map +1 -0
- package/lib/shared-utils/createTransMatrix.d.ts +3 -1
- package/lib/shared-utils/createTransMatrix.d.ts.map +1 -0
- package/lib/shared-utils/getFileExpandedName.d.ts +1 -0
- package/lib/shared-utils/getFileExpandedName.d.ts.map +1 -0
- package/lib/shared-utils/getMediaInfo.d.ts +1 -0
- package/lib/shared-utils/getMediaInfo.d.ts.map +1 -0
- package/lib/shared-utils/setElementDataset.d.ts +1 -0
- package/lib/shared-utils/setElementDataset.d.ts.map +1 -0
- package/lib/timeline/index.d.ts +18 -0
- package/lib/timeline/index.d.ts.map +1 -0
- package/lib/types/index.js +10 -0
- package/lib/types/index.js.map +1 -0
- package/lib/typings/VreoUnit.d.ts +2 -1
- package/lib/typings/VreoUnit.d.ts.map +1 -0
- package/lib/typings/index.d.ts +1 -0
- package/lib/typings/index.d.ts.map +1 -0
- package/package.json +50 -70
- package/lib/PlayController/createHTMLAudioElement.js +0 -34
- package/lib/Player/App.js +0 -52
- package/lib/Player/Controller.js +0 -536
- package/lib/Player/PlaybackLifecycle.js +0 -118
- package/lib/Player/custom/SpatialScenePanel/index.js +0 -240
- package/lib/Player/hooks.js +0 -22
- package/lib/Player/modules/Drawer/index.js +0 -40
- package/lib/Player/modules/PopUp/index.js +0 -23
- package/lib/Player/modules/ResizeObserver/index.js +0 -22
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +0 -456
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +0 -53
- package/lib/Player/modules/VideoAgent/index.js +0 -72
- package/lib/Player/modules/Wave/index.js +0 -171
- package/lib/Player/modules/keyframes/BgMusic/index.js +0 -65
- package/lib/Player/modules/keyframes/CameraMovement/index.js +0 -75
- package/lib/Player/modules/keyframes/InfoPanel/index.js +0 -170
- package/lib/Player/modules/keyframes/ModelVideo/index.js +0 -128
- package/lib/Player/modules/keyframes/PanoEffect/index.js +0 -99
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +0 -30
- package/lib/Player/modules/keyframes/PanoTag/index.js +0 -110
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +0 -122
- package/lib/Player/modules/keyframes/Prompter/index.js +0 -56
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +0 -98
- package/lib/Player/modules/keyframes/VideoEffect/index.js +0 -154
- package/lib/Player/playback-types.js +0 -1
- package/lib/Player/typings.js +0 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -4
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -25
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -4
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +0 -226
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +0 -8
- package/lib/fivePlugins/CameraMovementPlugin/index.js +0 -245
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -15
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +0 -349
- package/lib/shared-utils/Audio.js +0 -151
- package/lib/shared-utils/AudioLike.js +0 -123
- package/lib/shared-utils/Preloader.js +0 -37
- package/lib/shared-utils/addResizeListener.js +0 -39
- package/lib/shared-utils/animationFrame/BetterTween.js +0 -58
- package/lib/shared-utils/animationFrame/index.js +0 -52
- package/lib/shared-utils/animationFrame/tween.js +0 -58
- package/lib/shared-utils/createTransMatrix.js +0 -12
- package/lib/shared-utils/getFileExpandedName.js +0 -6
- package/lib/shared-utils/getMediaInfo.js +0 -55
- package/lib/shared-utils/setElementDataset.js +0 -16
- package/lib/typings/VreoUnit.js +0 -64
- package/lib/typings/index.js +0 -1
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Vector3 } from 'three';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import lineAnime from "./lineAnime.js";
|
|
6
|
-
import { useController, useFiveInstance, useFiveProject2d } from "../../../hooks.js";
|
|
7
|
-
import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
|
|
8
|
-
export function PanoEffect() {
|
|
9
|
-
var _React$useState = React.useState(null),
|
|
10
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
11
|
-
state = _React$useState2[0],
|
|
12
|
-
setState = _React$useState2[1];
|
|
13
|
-
var five = useFiveInstance();
|
|
14
|
-
var lineRef = React.useRef(null);
|
|
15
|
-
var _React$useState3 = React.useState(null),
|
|
16
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
17
|
-
pos = _React$useState4[0],
|
|
18
|
-
setPos = _React$useState4[1];
|
|
19
|
-
var timeoutRef = React.useRef();
|
|
20
|
-
var controller = useController();
|
|
21
|
-
var project2d = useFiveProject2d();
|
|
22
|
-
var delLine = function delLine() {
|
|
23
|
-
if (lineRef.current) {
|
|
24
|
-
lineRef.current.dispose();
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
React.useEffect(function () {
|
|
28
|
-
var callback = function callback(keyframe) {
|
|
29
|
-
var start = keyframe.start,
|
|
30
|
-
end = keyframe.end,
|
|
31
|
-
data = keyframe.data;
|
|
32
|
-
var videoEffectData = data;
|
|
33
|
-
var _videoEffectData$twoV = _slicedToArray(videoEffectData.twoVertexs, 2),
|
|
34
|
-
v1 = _videoEffectData$twoV[0],
|
|
35
|
-
v2 = _videoEffectData$twoV[1];
|
|
36
|
-
var p1 = new Vector3(v1.x, v1.y, v1.z);
|
|
37
|
-
var p2 = new Vector3(v2.x, v2.y, v2.z);
|
|
38
|
-
lineRef.current = lineAnime(five, p1.clone(), p2.clone());
|
|
39
|
-
lineRef.current.play();
|
|
40
|
-
var center = p1.lerp(p2, 0.5);
|
|
41
|
-
var distance = p1.distanceTo(p2);
|
|
42
|
-
var p = project2d(center);
|
|
43
|
-
if (!p) return;
|
|
44
|
-
var left = p.x,
|
|
45
|
-
top = p.y;
|
|
46
|
-
setState({
|
|
47
|
-
center: center,
|
|
48
|
-
distance: distance
|
|
49
|
-
});
|
|
50
|
-
setPos({
|
|
51
|
-
left: left,
|
|
52
|
-
top: top
|
|
53
|
-
});
|
|
54
|
-
timeoutRef.current = setTimeout(function () {
|
|
55
|
-
setState(null);
|
|
56
|
-
setPos(null);
|
|
57
|
-
delLine();
|
|
58
|
-
}, end - start);
|
|
59
|
-
};
|
|
60
|
-
controller.on(VreoKeyframeEnum.PanoEffect, callback);
|
|
61
|
-
return function () {
|
|
62
|
-
controller.off(VreoKeyframeEnum.PanoEffect, callback);
|
|
63
|
-
if (timeoutRef.current) {
|
|
64
|
-
clearTimeout(timeoutRef.current);
|
|
65
|
-
}
|
|
66
|
-
delLine();
|
|
67
|
-
};
|
|
68
|
-
}, [controller]);
|
|
69
|
-
React.useEffect(function () {
|
|
70
|
-
var callback = function callback() {
|
|
71
|
-
if (!(state !== null && state !== void 0 && state.center)) return;
|
|
72
|
-
var _state$center = state.center,
|
|
73
|
-
x = _state$center.x,
|
|
74
|
-
y = _state$center.y,
|
|
75
|
-
z = _state$center.z;
|
|
76
|
-
var res = project2d(new Vector3(x, y, z));
|
|
77
|
-
if (!res) return;
|
|
78
|
-
var left = res.x,
|
|
79
|
-
top = res.y;
|
|
80
|
-
setPos({
|
|
81
|
-
left: left,
|
|
82
|
-
top: top
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
five.on('currentStateChange', callback);
|
|
86
|
-
return function () {
|
|
87
|
-
five.off('currentStateChange', callback);
|
|
88
|
-
};
|
|
89
|
-
}, [state === null || state === void 0 ? void 0 : state.center]);
|
|
90
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
91
|
-
className: classNames('PanoEffect', {
|
|
92
|
-
'PanoEffect--notHidden': state
|
|
93
|
-
}),
|
|
94
|
-
style: {
|
|
95
|
-
left: ((pos === null || pos === void 0 ? void 0 : pos.left) || 0) + 'px',
|
|
96
|
-
top: ((pos === null || pos === void 0 ? void 0 : pos.top) || 0) + 'px'
|
|
97
|
-
}
|
|
98
|
-
}, (state === null || state === void 0 ? void 0 : state.distance.toFixed(4)) + 'm'));
|
|
99
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { Line as FiveLine } from '@realsee/five/line';
|
|
3
|
-
import { tweenProgress } from "../../../../shared-utils/animationFrame/BetterTween.js";
|
|
4
|
-
export default function lineAnime(five, startPoint, endPoint) {
|
|
5
|
-
var pointImage = 'data:image/png;base64,' + 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAAD////////////////////////////////////////PIev5AAAACnRSTlMAG/Py2baba05un7UgfgAAAHJJREFUKM9joBpgLHVSCRdA4metAoJlCJHmVWBgAeNzroKCCVCBLpjACqgJVjCBxRBT2FbBQQJYQAohsBAsUIUQWA4WiEIILAULeCEEloAFtBACizAEMLRgGIphLabDMJ2O6TlM72MGECIIMQIZIxqoBQCPvpJ/e9FaAAAAAABJRU5ErkJggg==';
|
|
6
|
-
var pointTexture = new THREE.TextureLoader().load(pointImage);
|
|
7
|
-
var color = new THREE.Color(0xffffff);
|
|
8
|
-
var line = new FiveLine();
|
|
9
|
-
line.setMaterial({
|
|
10
|
-
linewidth: 2,
|
|
11
|
-
color: color
|
|
12
|
-
});
|
|
13
|
-
var pointMaterial = line.points.material;
|
|
14
|
-
pointMaterial.map = pointTexture;
|
|
15
|
-
pointMaterial.color.set(color);
|
|
16
|
-
line.line.material.depthTest = false;
|
|
17
|
-
return tweenProgress().onUpdate(function (_ref) {
|
|
18
|
-
var progress = _ref.progress;
|
|
19
|
-
var lerpLeft = 0.5 - progress / 2;
|
|
20
|
-
var lerpRight = 0.5 + progress / 2;
|
|
21
|
-
var leftPoint = startPoint.clone().lerp(endPoint, lerpLeft);
|
|
22
|
-
var rightPoint = startPoint.clone().lerp(endPoint, lerpRight);
|
|
23
|
-
line.setPoints(leftPoint, rightPoint);
|
|
24
|
-
}).onStart(function () {
|
|
25
|
-
return five.scene.add(line);
|
|
26
|
-
}).onDispose(function () {
|
|
27
|
-
five.scene.remove(line);
|
|
28
|
-
five.needsRender = true;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useController, useFiveInstance } from "../../../hooks.js";
|
|
3
|
-
import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
|
|
4
|
-
import { PanoTagPlugin } from '@realsee/dnalogel';
|
|
5
|
-
export function PanoTag() {
|
|
6
|
-
var timeoutRef = React.useRef();
|
|
7
|
-
var controller = useController();
|
|
8
|
-
var five = useFiveInstance();
|
|
9
|
-
var panoTagPlugin = React.useRef(PanoTagPlugin(five, {
|
|
10
|
-
config: {
|
|
11
|
-
globalConfig: {
|
|
12
|
-
visibleConfig: {
|
|
13
|
-
keep: 'visible'
|
|
14
|
-
},
|
|
15
|
-
unfoldedConfig: {
|
|
16
|
-
autoUnfold: false,
|
|
17
|
-
unfoldDistance: {
|
|
18
|
-
max: 100
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}));
|
|
24
|
-
React.useEffect(function () {
|
|
25
|
-
var _controller$configs;
|
|
26
|
-
if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.PanoTag) === false) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
var callback = function callback(keyframe) {
|
|
30
|
-
var run = controller.playback.capture();
|
|
31
|
-
if (!panoTagPlugin.current || !(run !== null && run !== void 0 && run.valid())) return;
|
|
32
|
-
var start = keyframe.start,
|
|
33
|
-
end = keyframe.end,
|
|
34
|
-
data = keyframe.data;
|
|
35
|
-
var panoTagData = data;
|
|
36
|
-
var id = Date.now().toString();
|
|
37
|
-
var pointType = 'PointTag';
|
|
38
|
-
var dimensionType = '2D';
|
|
39
|
-
var position = [panoTagData.vertex.x, panoTagData.vertex.y, panoTagData.vertex.z];
|
|
40
|
-
var tag = function () {
|
|
41
|
-
if (panoTagData.imgUrl) {
|
|
42
|
-
return {
|
|
43
|
-
id: id,
|
|
44
|
-
pointType: pointType,
|
|
45
|
-
position: position,
|
|
46
|
-
dimensionType: dimensionType,
|
|
47
|
-
contentType: 'ImageText',
|
|
48
|
-
stickType: '2DPoint',
|
|
49
|
-
data: {
|
|
50
|
-
text: panoTagData.text,
|
|
51
|
-
mediaData: [{
|
|
52
|
-
type: 'Image',
|
|
53
|
-
url: panoTagData.imgUrl
|
|
54
|
-
}]
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
} else {
|
|
58
|
-
return {
|
|
59
|
-
id: id,
|
|
60
|
-
pointType: pointType,
|
|
61
|
-
position: position,
|
|
62
|
-
dimensionType: dimensionType,
|
|
63
|
-
contentType: 'Text',
|
|
64
|
-
stickType: '2DPoint',
|
|
65
|
-
data: {
|
|
66
|
-
text: panoTagData.text
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}();
|
|
71
|
-
|
|
72
|
-
// show
|
|
73
|
-
panoTagPlugin.current.load({
|
|
74
|
-
tagList: [tag]
|
|
75
|
-
});
|
|
76
|
-
var tagInstance = panoTagPlugin.current.getTagById(id);
|
|
77
|
-
if (tagInstance) {
|
|
78
|
-
tagInstance.setMediaManager(run.mediaManager);
|
|
79
|
-
tagInstance.state.unfolded = true;
|
|
80
|
-
panoTagPlugin.current.updateRenderAllTags();
|
|
81
|
-
}
|
|
82
|
-
timeoutRef.current = setTimeout(function () {
|
|
83
|
-
var _tag$hooks;
|
|
84
|
-
// clear
|
|
85
|
-
var tag = panoTagPlugin.current.getTagById(id);
|
|
86
|
-
if (!tag) return;
|
|
87
|
-
if (tag.state) {
|
|
88
|
-
tag.state.unfolded = false;
|
|
89
|
-
panoTagPlugin.current.updateRenderAllTags();
|
|
90
|
-
}
|
|
91
|
-
(_tag$hooks = tag.hooks) === null || _tag$hooks === void 0 ? void 0 : _tag$hooks.on('folded', function () {
|
|
92
|
-
setTimeout(function () {
|
|
93
|
-
if (tag.state) {
|
|
94
|
-
tag.state.visible = false;
|
|
95
|
-
panoTagPlugin.current.destroyTagById(id);
|
|
96
|
-
}
|
|
97
|
-
}, 1500);
|
|
98
|
-
});
|
|
99
|
-
}, end - start);
|
|
100
|
-
};
|
|
101
|
-
controller.on(VreoKeyframeEnum.PanoTag, callback);
|
|
102
|
-
return function () {
|
|
103
|
-
controller.off(VreoKeyframeEnum.PanoTag, callback);
|
|
104
|
-
if (timeoutRef.current) {
|
|
105
|
-
clearTimeout(timeoutRef.current);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
}, [controller]);
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import * as THREE from 'three';
|
|
4
|
-
import { createRoot } from 'react-dom/client';
|
|
5
|
-
import { Vector3, Quaternion } from 'three';
|
|
6
|
-
import { useController, useFiveInstance } from "../../../hooks.js";
|
|
7
|
-
import { CSS3DRenderPlugin } from "../../../../fivePlugins/CSS3DRenderPlugin/index.js";
|
|
8
|
-
import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
|
|
9
|
-
/**
|
|
10
|
-
* 通过传入中心点确定矩形框架容器的四个点:
|
|
11
|
-
* 1. 已知矩形长宽和中心点
|
|
12
|
-
* 2. 借助planeGeometry生成垂直相机视角的平面上的四个点
|
|
13
|
-
* 3. 通过向量相加,平行四边形法则获取到移动position后的面上四个点
|
|
14
|
-
*/
|
|
15
|
-
var calcPoints = function calcPoints(centerPoint, normal, wrapperLength, wrapperWidth) {
|
|
16
|
-
// 375px 对应 1m
|
|
17
|
-
var length = wrapperLength / 375;
|
|
18
|
-
var width = wrapperWidth / 375;
|
|
19
|
-
var geometry = new THREE.PlaneGeometry(length, width);
|
|
20
|
-
if (normal) {
|
|
21
|
-
var lookPoint = new THREE.Vector3(normal.x + centerPoint.x, normal.y + centerPoint.y, normal.z + centerPoint.z);
|
|
22
|
-
geometry.lookAt(lookPoint);
|
|
23
|
-
}
|
|
24
|
-
// const pointgeometry = new THREE.Geometry()
|
|
25
|
-
// pointgeometry.vertices.push(cameraPosition)
|
|
26
|
-
// const pointmaterial = new THREE.PointsMaterial({
|
|
27
|
-
// color: 0xffffff,
|
|
28
|
-
// size: 0.4,
|
|
29
|
-
// })
|
|
30
|
-
// _point = new THREE.Points(pointgeometry, pointmaterial)
|
|
31
|
-
// console.log(cameraPosition)
|
|
32
|
-
|
|
33
|
-
var material = new THREE.MeshBasicMaterial({
|
|
34
|
-
color: 0xffff00,
|
|
35
|
-
side: THREE.DoubleSide
|
|
36
|
-
});
|
|
37
|
-
var plane = new THREE.Mesh(geometry, material);
|
|
38
|
-
var v0 = centerPoint.clone();
|
|
39
|
-
plane.position.copy(v0);
|
|
40
|
-
|
|
41
|
-
// 计算传入的四个点的坐标
|
|
42
|
-
var _plane$geometry$verti = _slicedToArray(plane.geometry.vertices, 4),
|
|
43
|
-
v1 = _plane$geometry$verti[0],
|
|
44
|
-
v2 = _plane$geometry$verti[1],
|
|
45
|
-
v3 = _plane$geometry$verti[2],
|
|
46
|
-
v4 = _plane$geometry$verti[3];
|
|
47
|
-
var downLeft = v0.clone().add(v4);
|
|
48
|
-
var downRight = v0.clone().add(v3);
|
|
49
|
-
var upLeft = v0.clone().add(v2);
|
|
50
|
-
var upRight = v0.clone().add(v1);
|
|
51
|
-
|
|
52
|
-
// 插件使用要求:矩形四个点位数据,顺序为**必须**为左下、右下、右上、左上
|
|
53
|
-
return [downLeft, downRight, upRight, upLeft];
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* 空间文本标签。
|
|
58
|
-
*/
|
|
59
|
-
export function PanoTextLabel() {
|
|
60
|
-
var timeoutRef = React.useRef();
|
|
61
|
-
var controller = useController();
|
|
62
|
-
var five = useFiveInstance();
|
|
63
|
-
var ref = React.useRef();
|
|
64
|
-
React.useEffect(function () {
|
|
65
|
-
var _controller$configs;
|
|
66
|
-
if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.PanoTextLabel) === false) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
var callback = function callback(keyframe) {
|
|
70
|
-
var _panoTextLabelData$no, _panoTextLabelData$no2, _panoTextLabelData$no3;
|
|
71
|
-
var start = keyframe.start,
|
|
72
|
-
end = keyframe.end,
|
|
73
|
-
data = keyframe.data;
|
|
74
|
-
var panoTextLabelData = data;
|
|
75
|
-
// 增加无文本情况的判断
|
|
76
|
-
if (data.text === '') return;
|
|
77
|
-
var _panoTextLabelData$ve = panoTextLabelData.vertex,
|
|
78
|
-
x = _panoTextLabelData$ve.x,
|
|
79
|
-
y = _panoTextLabelData$ve.y,
|
|
80
|
-
z = _panoTextLabelData$ve.z;
|
|
81
|
-
var centerPoint = new Vector3(x, y, z);
|
|
82
|
-
var normal = new Vector3((_panoTextLabelData$no = panoTextLabelData.normal) === null || _panoTextLabelData$no === void 0 ? void 0 : _panoTextLabelData$no.x, (_panoTextLabelData$no2 = panoTextLabelData.normal) === null || _panoTextLabelData$no2 === void 0 ? void 0 : _panoTextLabelData$no2.y, (_panoTextLabelData$no3 = panoTextLabelData.normal) === null || _panoTextLabelData$no3 === void 0 ? void 0 : _panoTextLabelData$no3.z);
|
|
83
|
-
// 生成传入的四个点,将文本框最大宽度定在200px,最高高度在30px
|
|
84
|
-
var wrapperLength = 200;
|
|
85
|
-
var wrapperWidth = 30;
|
|
86
|
-
var points = calcPoints(centerPoint, panoTextLabelData.normal && normal, wrapperLength, wrapperWidth);
|
|
87
|
-
if (!ref.current) ref.current = CSS3DRenderPlugin(five);
|
|
88
|
-
var container = ref.current.create3DDomContainer(points);
|
|
89
|
-
var css3DObject = container === null || container === void 0 ? void 0 : container.css3DObject;
|
|
90
|
-
// 将获取的mesh进行旋转操作,根据欧拉角去进行mesh的变换
|
|
91
|
-
if (data.quaternion) {
|
|
92
|
-
var quaternion = new Quaternion(data.quaternion.x, data.quaternion.y, data.quaternion.z, data.quaternion.w);
|
|
93
|
-
css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.quaternion.copy(quaternion);
|
|
94
|
-
}
|
|
95
|
-
if (container !== null && container !== void 0 && container.container) {
|
|
96
|
-
var root = createRoot(container.container);
|
|
97
|
-
root.render( /*#__PURE__*/React.createElement("div", {
|
|
98
|
-
className: "PanoTextLabel PanoTextLabel--notHidden"
|
|
99
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
100
|
-
className: "PanoTextLabel-wrapper"
|
|
101
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
102
|
-
style: {
|
|
103
|
-
fontSize: "".concat(data.fontSize || 16, "px")
|
|
104
|
-
},
|
|
105
|
-
className: "PanoText-innerText"
|
|
106
|
-
}, data.text || ''))));
|
|
107
|
-
}
|
|
108
|
-
timeoutRef.current = setTimeout(function () {
|
|
109
|
-
var _ref$current;
|
|
110
|
-
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.disposeAll();
|
|
111
|
-
}, end - start);
|
|
112
|
-
};
|
|
113
|
-
controller.on(VreoKeyframeEnum.PanoTextLabel, callback);
|
|
114
|
-
return function () {
|
|
115
|
-
controller.off(VreoKeyframeEnum.PanoTextLabel, callback);
|
|
116
|
-
if (timeoutRef.current) {
|
|
117
|
-
clearTimeout(timeoutRef.current);
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
}, [controller]);
|
|
121
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
122
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { useController } from "../../../hooks.js";
|
|
6
|
-
import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
|
|
7
|
-
export function Prompter() {
|
|
8
|
-
var _React$useState = React.useState(''),
|
|
9
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
10
|
-
text = _React$useState2[0],
|
|
11
|
-
setText = _React$useState2[1];
|
|
12
|
-
var _React$useState3 = React.useState(true),
|
|
13
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
14
|
-
hidden = _React$useState4[0],
|
|
15
|
-
setHidden = _React$useState4[1];
|
|
16
|
-
var ref = React.useRef(null);
|
|
17
|
-
var controller = useController();
|
|
18
|
-
React.useEffect(function () {
|
|
19
|
-
var _controller$configs;
|
|
20
|
-
if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.Prompter) === false) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
var callback = function callback(keyframe) {
|
|
24
|
-
var start = keyframe.start,
|
|
25
|
-
end = keyframe.end,
|
|
26
|
-
data = keyframe.data;
|
|
27
|
-
setText(data.text);
|
|
28
|
-
setHidden(false);
|
|
29
|
-
if (ref.current) {
|
|
30
|
-
clearTimeout(ref.current);
|
|
31
|
-
ref.current = null;
|
|
32
|
-
}
|
|
33
|
-
ref.current = setTimeout(function () {
|
|
34
|
-
setHidden(true);
|
|
35
|
-
setText('');
|
|
36
|
-
// setTimeout(() => setText(''), 500)
|
|
37
|
-
|
|
38
|
-
if (ref.current) clearTimeout(ref.current);
|
|
39
|
-
ref.current = null;
|
|
40
|
-
}, end - start);
|
|
41
|
-
};
|
|
42
|
-
controller.on(VreoKeyframeEnum.Prompter, callback);
|
|
43
|
-
return function () {
|
|
44
|
-
controller.off(VreoKeyframeEnum.Prompter, callback);
|
|
45
|
-
};
|
|
46
|
-
}, [controller]);
|
|
47
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
48
|
-
className: classNames('vreo-prompter', _defineProperty({
|
|
49
|
-
'vreo-prompter--hidden': hidden
|
|
50
|
-
}, "vreo-prompter-left--".concat(controller.agentType), true))
|
|
51
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
52
|
-
className: "vreo-prompter-text"
|
|
53
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
className: "vreo-prompter-innerText"
|
|
55
|
-
}, text)));
|
|
56
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { parseWork } from '@realsee/five';
|
|
3
|
-
import { useController, useFiveInstance } from "../../../hooks.js";
|
|
4
|
-
import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
|
|
5
|
-
export function UpdateVRPanorama() {
|
|
6
|
-
var controller = useController();
|
|
7
|
-
var five = useFiveInstance();
|
|
8
|
-
var deafultWorkRef = React.useRef(null);
|
|
9
|
-
var updateWorkRef = React.useRef(null);
|
|
10
|
-
|
|
11
|
-
// 恢复默认 VR
|
|
12
|
-
var restoreCallback = React.useCallback(function () {
|
|
13
|
-
// 先清理掉 之前的 VR 数据备份
|
|
14
|
-
updateWorkRef.current = null;
|
|
15
|
-
if (deafultWorkRef.current) {
|
|
16
|
-
var work = parseWork(deafultWorkRef.current);
|
|
17
|
-
five.load(work);
|
|
18
|
-
}
|
|
19
|
-
}, []);
|
|
20
|
-
|
|
21
|
-
// 暂停时: 恢复默认 VR
|
|
22
|
-
var pausedCallback = React.useCallback(function () {
|
|
23
|
-
if (deafultWorkRef.current) {
|
|
24
|
-
var work = parseWork(deafultWorkRef.current);
|
|
25
|
-
Object.assign(window, {
|
|
26
|
-
$rawWork: work
|
|
27
|
-
});
|
|
28
|
-
five.load(work);
|
|
29
|
-
}
|
|
30
|
-
}, []);
|
|
31
|
-
|
|
32
|
-
// 播放时:如果暂停前有更新 VR 需要还原
|
|
33
|
-
var playingCallback = React.useCallback(function () {
|
|
34
|
-
if (!updateWorkRef.current) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
five.load(updateWorkRef.current);
|
|
38
|
-
}, []);
|
|
39
|
-
React.useEffect(function () {
|
|
40
|
-
var callback = function callback(keyframe) {
|
|
41
|
-
var _five$work, _five$work$raw, _five$work2, _five$work2$raw, _five$work2$raw$works;
|
|
42
|
-
if (!deafultWorkRef.current && (_five$work = five.work) !== null && _five$work !== void 0 && (_five$work$raw = _five$work.raw) !== null && _five$work$raw !== void 0 && _five$work$raw.works) {
|
|
43
|
-
deafultWorkRef.current = five.work.raw.works;
|
|
44
|
-
}
|
|
45
|
-
var data = keyframe.data;
|
|
46
|
-
|
|
47
|
-
// 如果数据中有新 work 数据,则直接载入
|
|
48
|
-
if (data.work) {
|
|
49
|
-
updateWorkRef.current = parseWork(data.work);
|
|
50
|
-
five.load(updateWorkRef.current);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
var lastRawWork = (_five$work2 = five.work) === null || _five$work2 === void 0 ? void 0 : (_five$work2$raw = _five$work2.raw) === null || _five$work2$raw === void 0 ? void 0 : (_five$work2$raw$works = _five$work2$raw.works) === null || _five$work2$raw$works === void 0 ? void 0 : _five$work2$raw$works[0];
|
|
54
|
-
if (!lastRawWork) {
|
|
55
|
-
console.warn('UpdateVRPanorama: 没有可用的 work 数据');
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// 动态场景:不提供完成的签名数据,需重新整理
|
|
60
|
-
if (data.dynamic_scene && !data.panorama) {
|
|
61
|
-
var lastWork = JSON.parse(lastRawWork);
|
|
62
|
-
var panorama = lastWork.panorama;
|
|
63
|
-
var index = data.dynamic_scene.images.index;
|
|
64
|
-
panorama.list[index] = data.dynamic_scene.images;
|
|
65
|
-
data.panorama = panorama;
|
|
66
|
-
delete data.dynamic_scene;
|
|
67
|
-
}
|
|
68
|
-
Object.assign(window, {
|
|
69
|
-
$work1: JSON.parse(lastRawWork),
|
|
70
|
-
$work2: data,
|
|
71
|
-
parseWork: parseWork
|
|
72
|
-
});
|
|
73
|
-
updateWorkRef.current = parseWork([lastRawWork, data]);
|
|
74
|
-
five.load(updateWorkRef.current);
|
|
75
|
-
};
|
|
76
|
-
controller.on(VreoKeyframeEnum.UpdateVRPanorama, callback);
|
|
77
|
-
|
|
78
|
-
// 离开 将之前的内容清空
|
|
79
|
-
controller.on(VreoKeyframeEnum.Exit, restoreCallback);
|
|
80
|
-
|
|
81
|
-
// 新载入数据 将之前的内容清空
|
|
82
|
-
controller.on('loaded', restoreCallback);
|
|
83
|
-
|
|
84
|
-
// 暂停 回到默认状态
|
|
85
|
-
controller.on('paused', pausedCallback);
|
|
86
|
-
// 播放 回归暂停前状态
|
|
87
|
-
controller.on('playing', playingCallback);
|
|
88
|
-
return function () {
|
|
89
|
-
// 清理事件监听
|
|
90
|
-
controller.off(VreoKeyframeEnum.UpdateVRPanorama, callback);
|
|
91
|
-
controller.off(VreoKeyframeEnum.Exit, restoreCallback);
|
|
92
|
-
controller.off('loaded', restoreCallback);
|
|
93
|
-
controller.off('paused', pausedCallback);
|
|
94
|
-
controller.off('playing', playingCallback);
|
|
95
|
-
};
|
|
96
|
-
}, []);
|
|
97
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
98
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
// import { Preloader } from '../../../../shared-utils/Preloader'
|
|
7
|
-
import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
|
|
8
|
-
import { useController, useFiveInstance } from "../../../hooks.js"; // const emptyVideo = '//vr-static.realsee-cdn.cn/release/web/leisure.69fd3522.mov'
|
|
9
|
-
var PI = Math.PI;
|
|
10
|
-
var PI_2 = PI * 2;
|
|
11
|
-
export function VideoEffect() {
|
|
12
|
-
var ref = React.useRef(null);
|
|
13
|
-
var videoRef = React.useRef();
|
|
14
|
-
var controller = useController();
|
|
15
|
-
var timeoutRef = React.useRef();
|
|
16
|
-
var _React$useState = React.useState(false),
|
|
17
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
18
|
-
visible = _React$useState2[0],
|
|
19
|
-
setVisible = _React$useState2[1];
|
|
20
|
-
var five = useFiveInstance();
|
|
21
|
-
React.useEffect(function () {
|
|
22
|
-
var output;
|
|
23
|
-
var generation = 0;
|
|
24
|
-
var removeCanPlay;
|
|
25
|
-
var callback = /*#__PURE__*/function () {
|
|
26
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(keyframe) {
|
|
27
|
-
var _removeCanPlay;
|
|
28
|
-
var start, end, _ref2, videoSrc, fov, direction, panoIndex, vector, _ref3, _ref4, longitude, latitude, currentGeneration, run, active, valid, video, media, play;
|
|
29
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
30
|
-
while (1) {
|
|
31
|
-
switch (_context.prev = _context.next) {
|
|
32
|
-
case 0:
|
|
33
|
-
start = keyframe.start, end = keyframe.end;
|
|
34
|
-
_ref2 = keyframe.data, videoSrc = _ref2.videoSrc, fov = _ref2.fov, direction = _ref2.direction, panoIndex = _ref2.panoIndex, vector = _ref2.vector;
|
|
35
|
-
_ref3 = function () {
|
|
36
|
-
if (vector) {
|
|
37
|
-
return [vector.longitude, vector.latitude];
|
|
38
|
-
}
|
|
39
|
-
if (!direction) {
|
|
40
|
-
return [0, 0];
|
|
41
|
-
}
|
|
42
|
-
var longitude = -Math.atan2(direction.x, -direction.z);
|
|
43
|
-
longitude = (longitude % PI_2 + PI_2) % PI_2;
|
|
44
|
-
var latitude = -Math.asin(direction.y / 1);
|
|
45
|
-
return [longitude, latitude];
|
|
46
|
-
}(), _ref4 = _slicedToArray(_ref3, 2), longitude = _ref4[0], latitude = _ref4[1];
|
|
47
|
-
destroy();
|
|
48
|
-
currentGeneration = generation;
|
|
49
|
-
five.setState({
|
|
50
|
-
fov: fov,
|
|
51
|
-
panoIndex: panoIndex,
|
|
52
|
-
longitude: longitude,
|
|
53
|
-
latitude: latitude
|
|
54
|
-
}, true);
|
|
55
|
-
(_removeCanPlay = removeCanPlay) === null || _removeCanPlay === void 0 ? void 0 : _removeCanPlay();
|
|
56
|
-
run = controller.playback.capture();
|
|
57
|
-
active = function active() {
|
|
58
|
-
return !!(run !== null && run !== void 0 && run.valid());
|
|
59
|
-
};
|
|
60
|
-
valid = function valid() {
|
|
61
|
-
return currentGeneration === generation && active();
|
|
62
|
-
};
|
|
63
|
-
video = videoRef.current;
|
|
64
|
-
if (!(!video || !valid())) {
|
|
65
|
-
_context.next = 13;
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
return _context.abrupt("return");
|
|
69
|
-
case 13:
|
|
70
|
-
media = output = run.bind(video);
|
|
71
|
-
media.muted = true;
|
|
72
|
-
media.src = videoSrc;
|
|
73
|
-
play = function play() {
|
|
74
|
-
var _removeCanPlay2;
|
|
75
|
-
(_removeCanPlay2 = removeCanPlay) === null || _removeCanPlay2 === void 0 ? void 0 : _removeCanPlay2();
|
|
76
|
-
if (!valid()) return;
|
|
77
|
-
media.muted = false;
|
|
78
|
-
void media.play().catch(function (error) {
|
|
79
|
-
if (valid()) {
|
|
80
|
-
controller.playback.cancel();
|
|
81
|
-
console.error(error);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
removeCanPlay = function removeCanPlay() {
|
|
86
|
-
return video.removeEventListener('canplaythrough', play);
|
|
87
|
-
};
|
|
88
|
-
video.addEventListener('canplaythrough', play);
|
|
89
|
-
media.load();
|
|
90
|
-
setVisible(true);
|
|
91
|
-
timeoutRef.current = setTimeout(destroy, Math.max(0, end - start));
|
|
92
|
-
case 22:
|
|
93
|
-
case "end":
|
|
94
|
-
return _context.stop();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}, _callee);
|
|
98
|
-
}));
|
|
99
|
-
return function callback(_x) {
|
|
100
|
-
return _ref.apply(this, arguments);
|
|
101
|
-
};
|
|
102
|
-
}();
|
|
103
|
-
controller.on(VreoKeyframeEnum.VideoEffect, callback);
|
|
104
|
-
var destroy = function destroy() {
|
|
105
|
-
var _removeCanPlay3;
|
|
106
|
-
++generation;
|
|
107
|
-
if (timeoutRef.current) {
|
|
108
|
-
clearTimeout(timeoutRef.current);
|
|
109
|
-
}
|
|
110
|
-
(_removeCanPlay3 = removeCanPlay) === null || _removeCanPlay3 === void 0 ? void 0 : _removeCanPlay3();
|
|
111
|
-
if (output) {
|
|
112
|
-
output.muted = true;
|
|
113
|
-
output.pause();
|
|
114
|
-
output.src = '';
|
|
115
|
-
}
|
|
116
|
-
output = undefined;
|
|
117
|
-
setVisible(false);
|
|
118
|
-
};
|
|
119
|
-
var remove = controller.playback.add(destroy);
|
|
120
|
-
return function () {
|
|
121
|
-
destroy();
|
|
122
|
-
remove();
|
|
123
|
-
controller.off(VreoKeyframeEnum.VideoEffect, callback);
|
|
124
|
-
if (timeoutRef.current) {
|
|
125
|
-
clearTimeout(timeoutRef.current);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
}, [controller]);
|
|
129
|
-
React.useEffect(function () {
|
|
130
|
-
var _controller$configs, _controller$configs$v;
|
|
131
|
-
if (!ref.current) return;
|
|
132
|
-
var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : (_controller$configs$v = _controller$configs.videos) === null || _controller$configs$v === void 0 ? void 0 : _controller$configs$v.videoEffect) || document.createElement('video');
|
|
133
|
-
// <video playsInline key="VideoEffect-video" className="VideoEffect-video" src={blobSrc} />
|
|
134
|
-
video.setAttribute('playsinline', 'true');
|
|
135
|
-
video.setAttribute('webkit-playsinline', 'true');
|
|
136
|
-
video.autoplay = false;
|
|
137
|
-
video.muted = true;
|
|
138
|
-
video.setAttribute('key', 'VideoEffect-video');
|
|
139
|
-
video.setAttribute('class', 'VideoEffect-video');
|
|
140
|
-
videoRef.current = video;
|
|
141
|
-
ref.current.append(videoRef.current);
|
|
142
|
-
return function () {
|
|
143
|
-
video.muted = true;
|
|
144
|
-
video.pause();
|
|
145
|
-
video.remove();
|
|
146
|
-
};
|
|
147
|
-
}, []);
|
|
148
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
149
|
-
ref: ref,
|
|
150
|
-
className: classNames('VideoEffect', {
|
|
151
|
-
'VideoEffect--visible': visible
|
|
152
|
-
})
|
|
153
|
-
});
|
|
154
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/Player/typings.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|