@realsee/vreo 2.6.4-alpha.1 → 2.6.4-alpha.3
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/Controller.d.ts +7 -1
- package/lib/Player/Controller.js +112 -75
- package/lib/Player/PlaybackLifecycle.d.ts +25 -0
- package/lib/Player/PlaybackLifecycle.js +117 -0
- package/lib/Player/custom/SpatialScenePanel/index.js +34 -11
- package/lib/Player/index.d.ts +7 -2
- package/lib/Player/index.js +198 -126
- package/lib/Player/modules/Drawer/index.js +1 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +13 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +209 -204
- 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 +50 -74
- package/lib/Player/modules/keyframes/CameraMovement/index.js +43 -45
- package/lib/Player/modules/keyframes/InfoPanel/index.js +45 -35
- package/lib/Player/modules/keyframes/ModelVideo/index.js +95 -57
- package/lib/Player/modules/keyframes/PanoTag/index.js +4 -2
- 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 +93 -79
- package/lib/Player/playback-types.d.ts +21 -0
- package/lib/Player/playback-types.js +1 -0
- package/lib/Player/typings.d.ts +3 -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 +3 -0
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +182 -75
- package/lib/index.d.ts +1 -0
- package/lib/react/index.js +1 -1
- package/lib/shared-utils/Audio.js +55 -57
- 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,24 +1,12 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
|
|
3
|
+
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 }; })(); }
|
|
4
|
+
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); }
|
|
4
5
|
import classNames from 'classnames';
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
// import { Preloader } from '../../../../shared-utils/Preloader'
|
|
7
8
|
import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
|
|
8
|
-
import { useController, useFiveInstance } from "../../../hooks.js";
|
|
9
|
-
var inlinePlay = function inlinePlay(videoInstance) {
|
|
10
|
-
if (!videoInstance) return;
|
|
11
|
-
var canplaythrough = function canplaythrough() {
|
|
12
|
-
videoInstance.removeEventListener('canplaythrough', canplaythrough);
|
|
13
|
-
try {
|
|
14
|
-
videoInstance.play();
|
|
15
|
-
} catch (error) {}
|
|
16
|
-
};
|
|
17
|
-
videoInstance.addEventListener('canplaythrough', canplaythrough);
|
|
18
|
-
videoInstance.load();
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// const emptyVideo = '//vr-static.realsee-cdn.cn/release/web/leisure.69fd3522.mov'
|
|
9
|
+
import { useController, useFiveInstance } from "../../../hooks.js"; // const emptyVideo = '//vr-static.realsee-cdn.cn/release/web/leisure.69fd3522.mov'
|
|
22
10
|
var PI = Math.PI;
|
|
23
11
|
var PI_2 = PI * 2;
|
|
24
12
|
export function VideoEffect() {
|
|
@@ -31,51 +19,78 @@ export function VideoEffect() {
|
|
|
31
19
|
visible = _React$useState2[0],
|
|
32
20
|
setVisible = _React$useState2[1];
|
|
33
21
|
var five = useFiveInstance();
|
|
34
|
-
var setBlobSrc = function setBlobSrc(blob) {
|
|
35
|
-
if (!videoRef.current) return;
|
|
36
|
-
videoRef.current.src = blob;
|
|
37
|
-
};
|
|
38
22
|
React.useEffect(function () {
|
|
23
|
+
var output;
|
|
24
|
+
var generation = 0;
|
|
25
|
+
var removeCanPlay;
|
|
39
26
|
var callback = /*#__PURE__*/function () {
|
|
40
|
-
var _ref = _asyncToGenerator(
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
27
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(keyframe) {
|
|
28
|
+
var _removeCanPlay;
|
|
29
|
+
var start, end, _ref2, videoSrc, fov, direction, panoIndex, vector, _ref3, _ref4, longitude, latitude, currentGeneration, run, active, valid, video, media, play;
|
|
30
|
+
return _regenerator().w(function (_context) {
|
|
31
|
+
while (1) switch (_context.n) {
|
|
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 || _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.n = 1;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
return _context.a(2);
|
|
69
|
+
case 1:
|
|
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 || _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);
|
|
51
82
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
longitude: longitude,
|
|
64
|
-
latitude: latitude
|
|
65
|
-
}, true);
|
|
66
|
-
setBlobSrc(videoSrc);
|
|
67
|
-
inlinePlay(videoRef.current);
|
|
68
|
-
setVisible(true);
|
|
69
|
-
timeoutRef.current = setTimeout(function () {
|
|
70
|
-
var _videoRef$current;
|
|
71
|
-
(_videoRef$current = videoRef.current) === null || _videoRef$current === void 0 ? void 0 : _videoRef$current.pause();
|
|
72
|
-
setVisible(false);
|
|
73
|
-
setBlobSrc('');
|
|
74
|
-
}, end - start);
|
|
75
|
-
case 8:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context.stop();
|
|
78
|
-
}
|
|
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 2:
|
|
93
|
+
return _context.a(2);
|
|
79
94
|
}
|
|
80
95
|
}, _callee);
|
|
81
96
|
}));
|
|
@@ -85,21 +100,24 @@ export function VideoEffect() {
|
|
|
85
100
|
}();
|
|
86
101
|
controller.on(VreoKeyframeEnum.VideoEffect, callback);
|
|
87
102
|
var destroy = function destroy() {
|
|
88
|
-
var
|
|
103
|
+
var _removeCanPlay3;
|
|
104
|
+
++generation;
|
|
89
105
|
if (timeoutRef.current) {
|
|
90
106
|
clearTimeout(timeoutRef.current);
|
|
91
107
|
}
|
|
92
|
-
(
|
|
108
|
+
(_removeCanPlay3 = removeCanPlay) === null || _removeCanPlay3 === void 0 || _removeCanPlay3();
|
|
109
|
+
if (output) {
|
|
110
|
+
output.muted = true;
|
|
111
|
+
output.pause();
|
|
112
|
+
output.src = '';
|
|
113
|
+
}
|
|
114
|
+
output = undefined;
|
|
93
115
|
setVisible(false);
|
|
94
|
-
setBlobSrc('');
|
|
95
116
|
};
|
|
96
|
-
controller.
|
|
97
|
-
return destroy();
|
|
98
|
-
});
|
|
99
|
-
controller.on('ended', function () {
|
|
100
|
-
return destroy();
|
|
101
|
-
});
|
|
117
|
+
var remove = controller.playback.add(destroy);
|
|
102
118
|
return function () {
|
|
119
|
+
destroy();
|
|
120
|
+
remove();
|
|
103
121
|
controller.off(VreoKeyframeEnum.VideoEffect, callback);
|
|
104
122
|
if (timeoutRef.current) {
|
|
105
123
|
clearTimeout(timeoutRef.current);
|
|
@@ -107,27 +125,23 @@ export function VideoEffect() {
|
|
|
107
125
|
};
|
|
108
126
|
}, [controller]);
|
|
109
127
|
React.useEffect(function () {
|
|
110
|
-
var _controller$configs
|
|
128
|
+
var _controller$configs;
|
|
111
129
|
if (!ref.current) return;
|
|
112
|
-
var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0
|
|
130
|
+
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.videoEffect) || document.createElement('video');
|
|
113
131
|
// <video playsInline key="VideoEffect-video" className="VideoEffect-video" src={blobSrc} />
|
|
114
132
|
video.setAttribute('playsinline', 'true');
|
|
115
133
|
video.setAttribute('webkit-playsinline', 'true');
|
|
116
|
-
video.
|
|
134
|
+
video.autoplay = false;
|
|
135
|
+
video.muted = true;
|
|
117
136
|
video.setAttribute('key', 'VideoEffect-video');
|
|
118
137
|
video.setAttribute('class', 'VideoEffect-video');
|
|
119
138
|
videoRef.current = video;
|
|
120
139
|
ref.current.append(videoRef.current);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
// const asyncfunc = async () => {
|
|
127
|
-
// setBlobSrc(await URL.createObjectURL(await Preloader.blob(emptyVideo)))
|
|
128
|
-
// inlinePlay(videoRef.current)
|
|
129
|
-
// }
|
|
130
|
-
// asyncfunc()
|
|
140
|
+
return function () {
|
|
141
|
+
video.muted = true;
|
|
142
|
+
video.pause();
|
|
143
|
+
video.remove();
|
|
144
|
+
};
|
|
131
145
|
}, []);
|
|
132
146
|
return /*#__PURE__*/React.createElement("div", {
|
|
133
147
|
ref: ref,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface PlaybackManager {
|
|
2
|
+
createController(options: {
|
|
3
|
+
label: string;
|
|
4
|
+
onCancel(): void;
|
|
5
|
+
}): PlaybackController;
|
|
6
|
+
}
|
|
7
|
+
export interface PlaybackController {
|
|
8
|
+
begin(request: {
|
|
9
|
+
userAction: boolean;
|
|
10
|
+
audible: boolean;
|
|
11
|
+
}): PlaybackSession | null;
|
|
12
|
+
cancel(): void;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
}
|
|
15
|
+
export interface PlaybackSession {
|
|
16
|
+
readonly signal: AbortSignal;
|
|
17
|
+
readonly mediaManager: PlaybackManager;
|
|
18
|
+
bind(element: HTMLMediaElement): MediaOperations;
|
|
19
|
+
finish(): void;
|
|
20
|
+
}
|
|
21
|
+
export type MediaOperations = Pick<HTMLMediaElement, 'play' | 'pause' | 'load' | 'src' | 'currentTime' | 'muted' | 'volume' | 'loop'>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/Player/typings.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { PlaybackManager } from './playback-types';
|
|
1
2
|
import React, { ReactNode } from 'react';
|
|
2
3
|
import { Subscribe, Five } from '@realsee/five';
|
|
3
4
|
import { VreoKeyframe, VreoKeyframeConfigMap, VreoKeyframeEvent } from '../typings/VreoUnit';
|
|
4
5
|
import { VideoAgentMeshOptions } from './modules/VideoAgent/VideoAgentMesh';
|
|
5
6
|
export interface PlayerConfigs {
|
|
7
|
+
mediaManager?: PlaybackManager;
|
|
6
8
|
/**
|
|
7
9
|
* @deprecated rename to container
|
|
8
10
|
*/
|
|
@@ -52,6 +54,7 @@ export interface Appearance {
|
|
|
52
54
|
}
|
|
53
55
|
export type VreoSubscribe = Pick<Subscribe<VreoKeyframeEvent>, 'on' | 'once' | 'off'>;
|
|
54
56
|
export interface CustomVreoKeyframeProps {
|
|
57
|
+
getMediaManager(): PlaybackManager | undefined;
|
|
55
58
|
subscribe: Pick<Subscribe<{
|
|
56
59
|
[key: string]: (data: VreoKeyframe, currentTime: number) => any;
|
|
57
60
|
}>, 'on' | 'once' | 'off'>;
|
|
@@ -28,7 +28,7 @@ export var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
|
|
|
28
28
|
});
|
|
29
29
|
var config = params[1];
|
|
30
30
|
if ((points === null || points === void 0 ? void 0 : points.length) < 4) return console.error('points must be equal or greater than than 4');
|
|
31
|
-
if (!(five !== null && five !== void 0 && (_five$model = five.model) !== null && _five$model !== void 0 && _five$model.loaded)) return console.error('five.model.loaded is: ', five === null || five === void 0
|
|
31
|
+
if (!(five !== null && five !== void 0 && (_five$model = five.model) !== null && _five$model !== void 0 && _five$model.loaded)) return console.error('five.model.loaded is: ', five === null || five === void 0 || (_five$model2 = five.model) === null || _five$model2 === void 0 ? void 0 : _five$model2.loaded);
|
|
32
32
|
var fiveElement = five.getElement();
|
|
33
33
|
if (!fiveElement) return console.error('five.getElement() is ' + fiveElement);
|
|
34
34
|
var disposers = [];
|
|
@@ -92,16 +92,16 @@ export var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
|
|
|
92
92
|
css3DRenderer.domElement.style.top = '0';
|
|
93
93
|
css3DRenderer.domElement.style.userSelect = 'none';
|
|
94
94
|
css3DRenderer.domElement.style.pointerEvents = 'none';
|
|
95
|
-
var
|
|
95
|
+
var _renderEveryFrame = function renderEveryFrame() {
|
|
96
96
|
if (stopRenderFlag) return;
|
|
97
|
-
requestAnimationFrameId = requestAnimationFrame(
|
|
97
|
+
requestAnimationFrameId = requestAnimationFrame(_renderEveryFrame);
|
|
98
98
|
css3DRenderer.render(scene, five.camera);
|
|
99
99
|
};
|
|
100
100
|
return function () {
|
|
101
101
|
var _resizeObserver, _resizeObserver$obser;
|
|
102
102
|
scene.add(css3DObject);
|
|
103
|
-
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0
|
|
104
|
-
|
|
103
|
+
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 || (_resizeObserver$obser = _resizeObserver.observe) === null || _resizeObserver$obser === void 0 || _resizeObserver$obser.call(_resizeObserver);
|
|
104
|
+
_renderEveryFrame();
|
|
105
105
|
if (mode === 'behind' && mesh) {
|
|
106
106
|
five.scene.add(mesh);
|
|
107
107
|
disposers.push(function () {
|
|
@@ -138,7 +138,7 @@ export var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
|
|
|
138
138
|
if (mode === 'behind') state.behindMode = undefined;
|
|
139
139
|
if (!state.behindMode && !state.frontMode) {
|
|
140
140
|
var _resizeObserver2, _resizeObserver2$unob;
|
|
141
|
-
(_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0
|
|
141
|
+
(_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 || (_resizeObserver2$unob = _resizeObserver2.unobserve) === null || _resizeObserver2$unob === void 0 || _resizeObserver2$unob.call(_resizeObserver2);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
return true;
|