@realsee/vreo 2.6.2 → 2.6.4-alpha.2
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/lib/PlayController/createHTMLAudioElement.js +10 -14
- package/lib/PlayController/index.js +63 -73
- package/lib/Player/App.js +2 -2
- package/lib/Player/AudioFocus.d.ts +36 -0
- package/lib/Player/AudioFocus.js +139 -0
- package/lib/Player/Controller.d.ts +16 -0
- package/lib/Player/Controller.js +119 -61
- package/lib/Player/custom/SpatialScenePanel/index.js +34 -11
- package/lib/Player/index.d.ts +8 -2
- package/lib/Player/index.js +182 -123
- package/lib/Player/modules/Drawer/index.js +1 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +8 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +173 -203
- package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +1 -0
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +6 -2
- package/lib/Player/modules/VideoAgent/index.js +10 -2
- package/lib/Player/modules/keyframes/BgMusic/index.js +46 -54
- package/lib/Player/modules/keyframes/CameraMovement/index.js +43 -45
- package/lib/Player/modules/keyframes/InfoPanel/index.js +37 -32
- package/lib/Player/modules/keyframes/ModelVideo/index.js +98 -57
- package/lib/Player/modules/keyframes/PanoTag/index.js +1 -1
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +3 -3
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +3 -3
- package/lib/Player/modules/keyframes/VideoEffect/index.js +87 -74
- package/lib/Player/typings.d.ts +10 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +6 -6
- package/lib/fivePlugins/CameraMovementPlugin/index.js +173 -180
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +6 -6
- package/lib/fivePlugins/ModelTVVideoPlugin/index.d.ts +2 -0
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +87 -43
- package/lib/index.d.ts +1 -0
- package/lib/react/index.js +1 -1
- package/lib/shared-utils/Audio.js +53 -56
- package/lib/shared-utils/AudioLike.js +12 -14
- package/lib/shared-utils/animationFrame/BetterTween.js +13 -15
- package/lib/shared-utils/animationFrame/tween.js +1 -3
- package/lib/shared-utils/getMediaInfo.js +0 -1
- package/lib/typings/VreoUnit.js +134 -27
- package/package.json +6 -4
- package/docs/.nojekyll +0 -1
- package/docs/assets/custom.css +0 -78
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -127
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1640
- package/docs/classes/Player.AudioLike.html +0 -15
- package/docs/classes/Player.Controller.html +0 -87
- package/docs/classes/Player.Player.html +0 -54
- package/docs/classes/Player.VideoAgentMesh.html +0 -72
- package/docs/classes/Player.VideoAgentScene.html +0 -9
- package/docs/demo/assets/AppReact-CkuqZtcS.js +0 -1
- package/docs/demo/assets/default-BQGCQRLt.css +0 -1
- package/docs/demo/assets/default-CVvVdmSW.js +0 -5540
- package/docs/demo/assets/dynamic-CO5wq52h.js +0 -1
- package/docs/demo/assets/examples-BCLzFApO.css +0 -1
- package/docs/demo/assets/examples-DfiAz2fR.js +0 -25
- package/docs/demo/assets/index-CBBSwaYT.js +0 -1
- package/docs/demo/assets/index-CmEXi2sK.css +0 -1
- package/docs/demo/assets/main-BF1tvUg-.js +0 -25
- package/docs/demo/assets/react-BnzBLum3.css +0 -1
- package/docs/demo/assets/react-C4h9qndP.js +0 -25
- package/docs/demo/examples.html +0 -16
- package/docs/demo/index-react-dynamic.html +0 -18
- package/docs/demo/index-react.html +0 -19
- package/docs/demo/index.html +0 -19
- package/docs/enums/Player.InfoPanelStyleEnum.html +0 -3
- package/docs/enums/Player.InfoPanelTypeEnum.html +0 -4
- package/docs/enums/Player.PanoEffectEnum.html +0 -4
- package/docs/enums/Player.PanoTagEnum.html +0 -4
- package/docs/enums/Player.PanoTagStyleEnum.html +0 -6
- package/docs/enums/Player.VreoKeyframeEnum.html +0 -25
- package/docs/enums/fivePlugins.CameraMovementEffect.html +0 -3
- package/docs/enums/fivePlugins.Rotation.html +0 -4
- package/docs/functions/custom.SpatialScenePanel.html +0 -2
- package/docs/functions/react.useVreoAction.html +0 -8
- package/docs/functions/react.useVreoEventCallback.html +0 -10
- package/docs/functions/react.useVreoPausedState.html +0 -8
- package/docs/hierarchy.html +0 -1
- package/docs/index.html +0 -160
- package/docs/interfaces/Player.Appearance.html +0 -2
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +0 -3
- package/docs/interfaces/Player.PlayerConfigs.html +0 -20
- package/docs/interfaces/Player.Vertex.html +0 -5
- package/docs/interfaces/Player.VideoAgentMeshOptions.html +0 -9
- package/docs/interfaces/Player.VreoKeyframe.html +0 -8
- package/docs/interfaces/Player.VreoUnit.html +0 -9
- package/docs/interfaces/Player.VreoVideo.html +0 -7
- package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +0 -8
- package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +0 -3
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +0 -5
- package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +0 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +0 -5
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +0 -4
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +0 -2
- package/docs/interfaces/fivePlugins.Vector3Position.html +0 -5
- package/docs/interfaces/react.VreoActionCallbacks.html +0 -18
- package/docs/interfaces/react.VreoProviderProps.html +0 -6
- package/docs/modules/Player.html +0 -1
- package/docs/modules/custom.html +0 -1
- package/docs/modules/fivePlugins.html +0 -1
- package/docs/modules/react.html +0 -1
- package/docs/modules.html +0 -1
- package/docs/types/Player.AppSize.html +0 -1
- package/docs/types/Player.AudioLikeEvent.html +0 -6
- package/docs/types/Player.CameraMovementData.html +0 -2
- package/docs/types/Player.CustomData.html +0 -2
- package/docs/types/Player.InfoPanelData.html +0 -7
- package/docs/types/Player.ModelVideoData.html +0 -9
- package/docs/types/Player.PanoEffectData.html +0 -4
- package/docs/types/Player.PanoTagData.html +0 -6
- package/docs/types/Player.PanoTextLabelData.html +0 -7
- package/docs/types/Player.PrompterData.html +0 -3
- package/docs/types/Player.QuadrangleVertexs.html +0 -2
- package/docs/types/Player.Quaternion.html +0 -6
- package/docs/types/Player.UpdateVRPanoramaData.html +0 -7
- package/docs/types/Player.Vertexs.html +0 -2
- package/docs/types/Player.VideoEffectData.html +0 -7
- package/docs/types/Player.VreoKeyframeEvent.html +0 -2
- package/docs/types/Player.VreoKeyframeMap.html +0 -6
- package/docs/types/Player.VreoSubscribe.html +0 -1
- package/docs/types/Player.WaveAppearance.html +0 -1
- package/docs/types/fivePlugins.CSS3DRenderPluginParameterType.html +0 -1
- package/docs/types/fivePlugins.MoveArgs.html +0 -1
- package/docs/types/fivePlugins.MoveOpts.html +0 -1
- package/docs/types/fivePlugins.RotateArgs.html +0 -1
- package/docs/types/fivePlugins.RotateOpts.html +0 -1
- package/docs/variables/fivePlugins.CSS3DRenderPlugin.html +0 -3
- package/docs/variables/fivePlugins.CameraMovementPlugin.html +0 -2
- package/docs/variables/fivePlugins.ModelTVVideoPlugin.html +0 -1
- package/docs/variables/react.VreoProvider.html +0 -9
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import { getAudio } from "../../../../shared-utils/Audio.js";
|
|
5
4
|
import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
|
|
@@ -7,63 +6,56 @@ import { useController } from "../../../hooks.js";
|
|
|
7
6
|
export function BgMusic() {
|
|
8
7
|
var controller = useController();
|
|
9
8
|
React.useEffect(function () {
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
audio.addEventListener('ended', function () {
|
|
40
|
-
cleanAudio();
|
|
41
|
-
});
|
|
42
|
-
play = function play() {
|
|
43
|
-
if (audio.realSrc === keyframe.data.url) {
|
|
44
|
-
// 有可能会被其他音轨打断
|
|
45
|
-
audio.play();
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
audio.addEventListener('pause', play);
|
|
49
|
-
controller.once('paused', function () {
|
|
50
|
-
cleanAudio();
|
|
51
|
-
});
|
|
52
|
-
case 12:
|
|
53
|
-
case "end":
|
|
54
|
-
return _context.stop();
|
|
55
|
-
}
|
|
9
|
+
var tracks = new Set();
|
|
10
|
+
var callback = function callback(keyframe, currentTime) {
|
|
11
|
+
var valid = controller.audioFocus.capture();
|
|
12
|
+
if (!valid()) return;
|
|
13
|
+
var audio = getAudio();
|
|
14
|
+
var cleaned = false;
|
|
15
|
+
var _clean = function clean() {
|
|
16
|
+
if (cleaned) return;
|
|
17
|
+
cleaned = true;
|
|
18
|
+
audio.removeEventListener('canplay', _play);
|
|
19
|
+
audio.removeEventListener('ended', _clean);
|
|
20
|
+
audio.muted = true;
|
|
21
|
+
audio.pause();
|
|
22
|
+
audio.src = '';
|
|
23
|
+
remove();
|
|
24
|
+
tracks.delete(_clean);
|
|
25
|
+
controller.setWaitingForBgMusic(false);
|
|
26
|
+
};
|
|
27
|
+
var remove = controller.audioFocus.add(_clean);
|
|
28
|
+
tracks.add(_clean);
|
|
29
|
+
var _play = function play() {
|
|
30
|
+
audio.removeEventListener('canplay', _play);
|
|
31
|
+
if (!valid() || cleaned) return;
|
|
32
|
+
audio.muted = false;
|
|
33
|
+
void audio.play().catch(function (error) {
|
|
34
|
+
if (valid() && !cleaned) {
|
|
35
|
+
_clean();
|
|
36
|
+
controller.audioFocus.cancel('paused');
|
|
37
|
+
console.error(error);
|
|
56
38
|
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return function callback(_x, _x2) {
|
|
60
|
-
return _ref.apply(this, arguments);
|
|
39
|
+
});
|
|
40
|
+
controller.setWaitingForBgMusic(false);
|
|
61
41
|
};
|
|
62
|
-
|
|
42
|
+
audio.muted = true;
|
|
43
|
+
audio.src = keyframe.data.url;
|
|
44
|
+
audio.currentTime = Math.max(0, (currentTime - keyframe.start) / 1000);
|
|
45
|
+
audio.addEventListener('ended', _clean);
|
|
46
|
+
if (controller.configs.waitForBgMusicLoaded && audio.readyState < 3) {
|
|
47
|
+
controller.setWaitingForBgMusic(true);
|
|
48
|
+
audio.addEventListener('canplay', _play);
|
|
49
|
+
} else _play();
|
|
50
|
+
};
|
|
63
51
|
controller.on(VreoKeyframeEnum.BgMusic, callback);
|
|
64
52
|
return function () {
|
|
65
53
|
controller.off(VreoKeyframeEnum.BgMusic, callback);
|
|
54
|
+
for (var _i = 0, _arr = _toConsumableArray(tracks); _i < _arr.length; _i++) {
|
|
55
|
+
var clean = _arr[_i];
|
|
56
|
+
clean();
|
|
57
|
+
}
|
|
66
58
|
};
|
|
67
|
-
});
|
|
59
|
+
}, [controller]);
|
|
68
60
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
69
61
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
|
|
2
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
3
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import { CameraMovementPlugin } from "../../../../fivePlugins/CameraMovementPlugin/index.js";
|
|
5
6
|
import { CameraMovementEffect } from "../../../../fivePlugins/CameraMovementPlugin/typings.js";
|
|
@@ -11,54 +12,51 @@ export function CameraMovement() {
|
|
|
11
12
|
var ref = React.useRef();
|
|
12
13
|
React.useEffect(function () {
|
|
13
14
|
var callback = /*#__PURE__*/function () {
|
|
14
|
-
var _ref = _asyncToGenerator(
|
|
15
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(keyframe) {
|
|
15
16
|
var start, end, data, cameraMovementData, effect;
|
|
16
|
-
return
|
|
17
|
-
while (1) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
_context.next = 9;
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
_context.next = 7;
|
|
31
|
-
return ref.current.rotate(data, end - start);
|
|
32
|
-
case 7:
|
|
33
|
-
_context.next = 21;
|
|
17
|
+
return _regenerator().w(function (_context) {
|
|
18
|
+
while (1) switch (_context.n) {
|
|
19
|
+
case 0:
|
|
20
|
+
if (!ref.current) {
|
|
21
|
+
ref.current = CameraMovementPlugin(five, {});
|
|
22
|
+
}
|
|
23
|
+
start = keyframe.start, end = keyframe.end, data = keyframe.data;
|
|
24
|
+
cameraMovementData = data;
|
|
25
|
+
effect = cameraMovementData.effect;
|
|
26
|
+
if (!(effect === CameraMovementEffect.Rotate)) {
|
|
27
|
+
_context.n = 2;
|
|
34
28
|
break;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
_context.
|
|
29
|
+
}
|
|
30
|
+
_context.n = 1;
|
|
31
|
+
return ref.current.rotate(data, end - start);
|
|
32
|
+
case 1:
|
|
33
|
+
_context.n = 7;
|
|
34
|
+
break;
|
|
35
|
+
case 2:
|
|
36
|
+
if (!(effect === CameraMovementEffect.Move)) {
|
|
37
|
+
_context.n = 4;
|
|
44
38
|
break;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
_context.
|
|
39
|
+
}
|
|
40
|
+
_context.n = 3;
|
|
41
|
+
return ref.current.move(data, end - start);
|
|
42
|
+
case 3:
|
|
43
|
+
_context.n = 7;
|
|
44
|
+
break;
|
|
45
|
+
case 4:
|
|
46
|
+
if (!(cameraMovementData.panoIndex !== undefined && cameraMovementData.panoIndex !== five.panoIndex)) {
|
|
47
|
+
_context.n = 6;
|
|
54
48
|
break;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
}
|
|
50
|
+
_context.n = 5;
|
|
51
|
+
return ref.current.move(data, end - start);
|
|
52
|
+
case 5:
|
|
53
|
+
_context.n = 7;
|
|
54
|
+
break;
|
|
55
|
+
case 6:
|
|
56
|
+
_context.n = 7;
|
|
57
|
+
return ref.current.rotate(data, end - start);
|
|
58
|
+
case 7:
|
|
59
|
+
return _context.a(2);
|
|
62
60
|
}
|
|
63
61
|
}, _callee);
|
|
64
62
|
}));
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { InfoPanelStyleEnum, InfoPanelTypeEnum, VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
|
|
3
3
|
import { useController } from "../../../hooks.js";
|
|
4
|
-
var isWX = navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1;
|
|
5
|
-
var isIOS = navigator.userAgent.toLowerCase().indexOf('iphone') !== -1;
|
|
6
|
-
var isIOSorWX = isIOS || isWX;
|
|
7
|
-
var _videoElement = document.createElement('video');
|
|
8
|
-
_videoElement.setAttribute('playsinline', 'true');
|
|
9
|
-
_videoElement.setAttribute('webkit-playsinline', 'true');
|
|
10
|
-
if (isIOSorWX) {
|
|
11
|
-
if (_videoElement.paused) {
|
|
12
|
-
_videoElement.addEventListener('click', function () {
|
|
13
|
-
return _videoElement.play();
|
|
14
|
-
}, {
|
|
15
|
-
once: true
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
4
|
function InfoPanelImg(_ref) {
|
|
20
5
|
var url = _ref.url,
|
|
21
6
|
children = _ref.children;
|
|
@@ -33,32 +18,50 @@ function InfoPanelVideo(_ref2) {
|
|
|
33
18
|
var videoWrapperRef = React.useRef(null);
|
|
34
19
|
var controller = useController();
|
|
35
20
|
React.useEffect(function () {
|
|
36
|
-
var _controller$configs
|
|
21
|
+
var _controller$configs;
|
|
37
22
|
// if (!isIOSorWX) return
|
|
38
|
-
var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0
|
|
23
|
+
var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0 || (_controller$configs = _controller$configs.videos) === null || _controller$configs === void 0 ? void 0 : _controller$configs.videoPanel) || document.createElement('video');
|
|
24
|
+
var valid = controller.audioFocus.capture();
|
|
25
|
+
var disposed = false;
|
|
26
|
+
video.playsInline = true;
|
|
27
|
+
video.muted = true;
|
|
28
|
+
var stop = function stop() {
|
|
29
|
+
disposed = true;
|
|
30
|
+
video.muted = true;
|
|
31
|
+
video.pause();
|
|
32
|
+
video.removeEventListener('canplaythrough', _canplaythrough);
|
|
33
|
+
};
|
|
39
34
|
if (!videoWrapperRef.current) return;
|
|
35
|
+
var remove = controller.audioFocus.add(stop);
|
|
40
36
|
video.src = url;
|
|
41
37
|
if (!videoWrapperRef.current.contains(video)) {
|
|
42
38
|
videoWrapperRef.current.appendChild(video);
|
|
43
39
|
}
|
|
44
|
-
var
|
|
45
|
-
video.removeEventListener('canplaythrough',
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
var _canplaythrough = function canplaythrough() {
|
|
41
|
+
video.removeEventListener('canplaythrough', _canplaythrough);
|
|
42
|
+
if (disposed || !valid()) return;
|
|
43
|
+
video.muted = false;
|
|
44
|
+
void video.play().catch(function (error) {
|
|
45
|
+
if (valid() && !disposed) {
|
|
46
|
+
stop();
|
|
47
|
+
controller.audioFocus.cancel('paused');
|
|
48
|
+
console.error(error);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
49
51
|
};
|
|
50
|
-
video.addEventListener('canplaythrough',
|
|
52
|
+
video.addEventListener('canplaythrough', _canplaythrough);
|
|
51
53
|
video.load();
|
|
52
54
|
// video.play()
|
|
53
55
|
|
|
54
56
|
return function () {
|
|
55
57
|
var _videoWrapperRef$curr;
|
|
56
|
-
|
|
58
|
+
stop();
|
|
59
|
+
remove();
|
|
57
60
|
if ((_videoWrapperRef$curr = videoWrapperRef.current) !== null && _videoWrapperRef$curr !== void 0 && _videoWrapperRef$curr.contains(video)) {
|
|
58
61
|
videoWrapperRef.current.removeChild(video);
|
|
59
62
|
}
|
|
60
63
|
};
|
|
61
|
-
}, [
|
|
64
|
+
}, [controller, url]);
|
|
62
65
|
return /*#__PURE__*/React.createElement("div", {
|
|
63
66
|
className: "vreo-infoPanel-container"
|
|
64
67
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -99,14 +102,14 @@ export function InfoPanel() {
|
|
|
99
102
|
do {
|
|
100
103
|
if (style === InfoPanelStyleEnum.PopUp) {
|
|
101
104
|
if (infoPanelData.type === InfoPanelTypeEnum.Image) {
|
|
102
|
-
controller.openPopUp(
|
|
105
|
+
controller.openPopUp(/*#__PURE__*/React.createElement(InfoPanelImg, {
|
|
103
106
|
url: infoPanelData.url
|
|
104
107
|
}, /*#__PURE__*/React.createElement(Title, {
|
|
105
108
|
title: title,
|
|
106
109
|
subTitle: subTitle
|
|
107
110
|
})));
|
|
108
111
|
} else if (infoPanelData.type === InfoPanelTypeEnum.Video) {
|
|
109
|
-
controller.openPopUp(
|
|
112
|
+
controller.openPopUp(/*#__PURE__*/React.createElement(InfoPanelVideo, {
|
|
110
113
|
url: infoPanelData.url
|
|
111
114
|
}, /*#__PURE__*/React.createElement(Title, {
|
|
112
115
|
title: title,
|
|
@@ -143,13 +146,15 @@ export function InfoPanel() {
|
|
|
143
146
|
}, end - start);
|
|
144
147
|
};
|
|
145
148
|
controller.on(VreoKeyframeEnum.InfoPanel, callback);
|
|
146
|
-
|
|
149
|
+
var close = function close() {
|
|
150
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
151
|
+
controller.openDrawer(false);
|
|
147
152
|
controller.openPopUp(false);
|
|
148
|
-
}
|
|
149
|
-
controller.
|
|
150
|
-
controller.openPopUp(false);
|
|
151
|
-
});
|
|
153
|
+
};
|
|
154
|
+
var remove = controller.audioFocus.add(close);
|
|
152
155
|
return function () {
|
|
156
|
+
remove();
|
|
157
|
+
close();
|
|
153
158
|
controller.off(VreoKeyframeEnum.InfoPanel, callback);
|
|
154
159
|
if (timeoutRef.current) {
|
|
155
160
|
clearTimeout(timeoutRef.current);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
|
|
2
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
3
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import * as THREE from 'three';
|
|
5
6
|
import { useController, useFiveInstance } from "../../../hooks.js";
|
|
@@ -12,65 +13,100 @@ export function ModelVideo() {
|
|
|
12
13
|
var ref = React.useRef();
|
|
13
14
|
var timeoutRef = React.useRef();
|
|
14
15
|
React.useEffect(function () {
|
|
16
|
+
var generation = 0;
|
|
17
|
+
var stop = function stop() {
|
|
18
|
+
var _ref$current;
|
|
19
|
+
++generation;
|
|
20
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
21
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.disable();
|
|
22
|
+
};
|
|
23
|
+
var remove = controller.audioFocus.add(stop);
|
|
15
24
|
var callback = /*#__PURE__*/function () {
|
|
16
|
-
var _ref = _asyncToGenerator(
|
|
17
|
-
var _controller$configs,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return
|
|
34
|
-
}
|
|
35
|
-
var box = new THREE.Box3();
|
|
36
|
-
vertexs.forEach(function (v) {
|
|
37
|
-
return box.expandByPoint(new THREE.Vector3(v.x, v.y, v.z));
|
|
38
|
-
});
|
|
39
|
-
return [new THREE.Vector3(box.min.x, box.max.y, box.max.z), new THREE.Vector3(box.min.x, box.min.y, box.max.z), new THREE.Vector3(box.max.x, box.min.y, box.max.z), new THREE.Vector3(box.max.x, box.max.y, box.max.z)];
|
|
40
|
-
}();
|
|
41
|
-
points = function () {
|
|
42
|
-
if (matrixWorld) {
|
|
43
|
-
var transMatrix = createTransMatrix(matrixWorld);
|
|
44
|
-
return [position.map(function (p) {
|
|
45
|
-
var res = transMatrix([p.x, p.y, p.z]);
|
|
46
|
-
return {
|
|
47
|
-
x: res[0],
|
|
48
|
-
y: res[1],
|
|
49
|
-
z: res[2]
|
|
50
|
-
};
|
|
51
|
-
})];
|
|
25
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(keyframe) {
|
|
26
|
+
var current, valid, start, end, _ref2, videoSrc, videoPosterSrc, vertexs, matrixWorld, position, points, _controller$configs, _t;
|
|
27
|
+
return _regenerator().w(function (_context) {
|
|
28
|
+
while (1) switch (_context.p = _context.n) {
|
|
29
|
+
case 0:
|
|
30
|
+
stop();
|
|
31
|
+
current = generation;
|
|
32
|
+
valid = controller.audioFocus.capture();
|
|
33
|
+
if (valid()) {
|
|
34
|
+
_context.n = 1;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
return _context.a(2);
|
|
38
|
+
case 1:
|
|
39
|
+
if (!ref.current) {
|
|
40
|
+
ref.current = ModelTVVideoPlugin(five, {
|
|
41
|
+
canPlay: function canPlay() {
|
|
42
|
+
return controller.audioFocus.active;
|
|
52
43
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
start = keyframe.start, end = keyframe.end;
|
|
47
|
+
_ref2 = keyframe.data, videoSrc = _ref2.videoSrc, videoPosterSrc = _ref2.videoPosterSrc, vertexs = _ref2.vertexs, matrixWorld = _ref2.matrixWorld;
|
|
48
|
+
position = function () {
|
|
49
|
+
if (vertexs.length < 4) {
|
|
50
|
+
throw new Error('ModelVideo: 顶点数据集合不够,无法组成矩形 ....');
|
|
51
|
+
}
|
|
52
|
+
if (vertexs.length === 4) {
|
|
53
|
+
return vertexs;
|
|
54
|
+
}
|
|
55
|
+
var box = new THREE.Box3();
|
|
56
|
+
vertexs.forEach(function (v) {
|
|
57
|
+
return box.expandByPoint(new THREE.Vector3(v.x, v.y, v.z));
|
|
58
|
+
});
|
|
59
|
+
return [new THREE.Vector3(box.min.x, box.max.y, box.max.z), new THREE.Vector3(box.min.x, box.min.y, box.max.z), new THREE.Vector3(box.max.x, box.min.y, box.max.z), new THREE.Vector3(box.max.x, box.max.y, box.max.z)];
|
|
60
|
+
}();
|
|
61
|
+
points = function () {
|
|
62
|
+
if (matrixWorld) {
|
|
63
|
+
var transMatrix = createTransMatrix(matrixWorld);
|
|
64
|
+
return [position.map(function (p) {
|
|
65
|
+
var res = transMatrix([p.x, p.y, p.z]);
|
|
66
|
+
return {
|
|
67
|
+
x: res[0],
|
|
68
|
+
y: res[1],
|
|
69
|
+
z: res[2]
|
|
70
|
+
};
|
|
71
|
+
})];
|
|
72
|
+
}
|
|
73
|
+
return [position];
|
|
74
|
+
}();
|
|
75
|
+
ref.current.disable();
|
|
76
|
+
_context.p = 2;
|
|
77
|
+
_context.n = 3;
|
|
78
|
+
return ref.current.load({
|
|
79
|
+
video_src: videoSrc,
|
|
80
|
+
video_poster_src: videoPosterSrc,
|
|
81
|
+
points: points
|
|
82
|
+
}, (_controller$configs = controller.configs) === null || _controller$configs === void 0 || (_controller$configs = _controller$configs.videos) === null || _controller$configs === void 0 ? void 0 : _controller$configs.modelTVVideo);
|
|
83
|
+
case 3:
|
|
84
|
+
_context.n = 5;
|
|
85
|
+
break;
|
|
86
|
+
case 4:
|
|
87
|
+
_context.p = 4;
|
|
88
|
+
_t = _context.v;
|
|
89
|
+
if (current === generation && valid()) {
|
|
90
|
+
controller.audioFocus.cancel('paused');
|
|
91
|
+
console.error(_t);
|
|
92
|
+
}
|
|
93
|
+
return _context.a(2);
|
|
94
|
+
case 5:
|
|
95
|
+
if (!(current !== generation || !valid())) {
|
|
96
|
+
_context.n = 6;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
return _context.a(2);
|
|
100
|
+
case 6:
|
|
101
|
+
ref.current.enable();
|
|
102
|
+
timeoutRef.current = setTimeout(function () {
|
|
103
|
+
var _ref$current2;
|
|
104
|
+
return (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.disable();
|
|
105
|
+
}, end - start);
|
|
106
|
+
case 7:
|
|
107
|
+
return _context.a(2);
|
|
72
108
|
}
|
|
73
|
-
}, _callee);
|
|
109
|
+
}, _callee, null, [[2, 4]]);
|
|
74
110
|
}));
|
|
75
111
|
return function callback(_x) {
|
|
76
112
|
return _ref.apply(this, arguments);
|
|
@@ -78,6 +114,11 @@ export function ModelVideo() {
|
|
|
78
114
|
}();
|
|
79
115
|
controller.on(VreoKeyframeEnum.ModelVideo, callback);
|
|
80
116
|
return function () {
|
|
117
|
+
var _ref$current3;
|
|
118
|
+
stop();
|
|
119
|
+
remove();
|
|
120
|
+
(_ref$current3 = ref.current) === null || _ref$current3 === void 0 || _ref$current3.dispose();
|
|
121
|
+
ref.current = undefined;
|
|
81
122
|
controller.off(VreoKeyframeEnum.ModelVideo, callback);
|
|
82
123
|
if (timeoutRef.current) {
|
|
83
124
|
clearTimeout(timeoutRef.current);
|
|
@@ -86,7 +86,7 @@ export function PanoTag() {
|
|
|
86
86
|
tag.state.unfolded = false;
|
|
87
87
|
panoTagPlugin.current.updateRenderAllTags();
|
|
88
88
|
}
|
|
89
|
-
(_tag$hooks = tag.hooks) === null || _tag$hooks === void 0
|
|
89
|
+
(_tag$hooks = tag.hooks) === null || _tag$hooks === void 0 || _tag$hooks.on('folded', function () {
|
|
90
90
|
setTimeout(function () {
|
|
91
91
|
if (tag.state) {
|
|
92
92
|
tag.state.visible = false;
|
|
@@ -90,11 +90,11 @@ export function PanoTextLabel() {
|
|
|
90
90
|
// 将获取的mesh进行旋转操作,根据欧拉角去进行mesh的变换
|
|
91
91
|
if (data.quaternion) {
|
|
92
92
|
var quaternion = new Quaternion(data.quaternion.x, data.quaternion.y, data.quaternion.z, data.quaternion.w);
|
|
93
|
-
css3DObject === null || css3DObject === void 0
|
|
93
|
+
css3DObject === null || css3DObject === void 0 || css3DObject.quaternion.copy(quaternion);
|
|
94
94
|
}
|
|
95
95
|
if (container !== null && container !== void 0 && container.container) {
|
|
96
96
|
var root = createRoot(container.container);
|
|
97
|
-
root.render(
|
|
97
|
+
root.render(/*#__PURE__*/React.createElement("div", {
|
|
98
98
|
className: "PanoTextLabel PanoTextLabel--notHidden"
|
|
99
99
|
}, /*#__PURE__*/React.createElement("div", {
|
|
100
100
|
className: "PanoTextLabel-wrapper"
|
|
@@ -107,7 +107,7 @@ export function PanoTextLabel() {
|
|
|
107
107
|
}
|
|
108
108
|
timeoutRef.current = setTimeout(function () {
|
|
109
109
|
var _ref$current;
|
|
110
|
-
(_ref$current = ref.current) === null || _ref$current === void 0
|
|
110
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.disposeAll();
|
|
111
111
|
}, end - start);
|
|
112
112
|
};
|
|
113
113
|
controller.on(VreoKeyframeEnum.PanoTextLabel, callback);
|
|
@@ -38,8 +38,8 @@ export function UpdateVRPanorama() {
|
|
|
38
38
|
}, []);
|
|
39
39
|
React.useEffect(function () {
|
|
40
40
|
var callback = function callback(keyframe) {
|
|
41
|
-
var _five$work, _five$
|
|
42
|
-
if (!deafultWorkRef.current && (_five$work = five.work) !== null && _five$work !== void 0 && (_five$work
|
|
41
|
+
var _five$work, _five$work2;
|
|
42
|
+
if (!deafultWorkRef.current && (_five$work = five.work) !== null && _five$work !== void 0 && (_five$work = _five$work.raw) !== null && _five$work !== void 0 && _five$work.works) {
|
|
43
43
|
deafultWorkRef.current = five.work.raw.works;
|
|
44
44
|
}
|
|
45
45
|
var data = keyframe.data;
|
|
@@ -50,7 +50,7 @@ export function UpdateVRPanorama() {
|
|
|
50
50
|
five.load(updateWorkRef.current);
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
var lastRawWork = (_five$work2 = five.work) === null || _five$work2 === void 0
|
|
53
|
+
var lastRawWork = (_five$work2 = five.work) === null || _five$work2 === void 0 || (_five$work2 = _five$work2.raw) === null || _five$work2 === void 0 || (_five$work2 = _five$work2.works) === null || _five$work2 === void 0 ? void 0 : _five$work2[0];
|
|
54
54
|
if (!lastRawWork) {
|
|
55
55
|
console.warn('UpdateVRPanorama: 没有可用的 work 数据');
|
|
56
56
|
return;
|