@realsee/vreo 2.6.4 → 3.0.0-webgpu.9
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/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 +51 -71
- 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,456 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
7
|
-
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
10
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
15
|
-
import * as THREE from 'three';
|
|
16
|
-
import { Preloader } from "../../../shared-utils/Preloader.js";
|
|
17
|
-
import { makeObservable, observable, runInAction } from 'mobx';
|
|
18
|
-
import AudioLike from "../../../shared-utils/AudioLike.js";
|
|
19
|
-
import { getMediaType } from "../../../shared-utils/getMediaInfo.js";
|
|
20
|
-
var vertexShader = "\nvarying vec2 vUv;\nvarying vec2 vColorUv;\nvarying vec2 vMaskUv;\nvoid main(){\n vUv = uv;\n vColorUv = vec2(uv.x / 2.0, uv.y);\n vMaskUv = vec2(0.5 + uv.x / 2.0, uv.y);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";
|
|
21
|
-
var fragmentShaderTpl = function fragmentShaderTpl() {
|
|
22
|
-
return "\nuniform int enable;\nuniform sampler2D map;\nvarying vec2 vUv;\nvarying vec2 vColorUv;\nvarying vec2 vMaskUv;\n\nvec3 hsv2rgb(vec3 c) {\n const vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\nvec3 rgb2hsv(vec3 c) {\n const vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n\n float d = q.x - min(q.w, q.y);\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + 0.001)), d / (q.x + 0.001), q.x);\n}\n\nvoid main(void) {\n vec3 color = texture2D(map, vUv).xyz;\n float amask = 1.0;\n\n float ref = color.r;\n if (ref < color.b) ref = color.b;\n amask = color.g - ref + 0.1;\n amask = smoothstep(0.1, 0.3, amask);\n amask = 1.0 - amask;\n\n vec3 target = rgb2hsv(vec3(0.0 / 255.0, 255.0 / 255.0, 0.0 / 255.0));\n vec3 hsv = rgb2hsv(color);\n float distance = abs(hsv.x - target.x);\n if (distance < 0.15) {\n hsv.y = 0.0;\n }\n color = hsv2rgb(hsv);\n\n gl_FragColor = vec4(color.rgb, amask * float(enable));\n}\n";
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* 视频经纪人贴片的配置选项
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* 视频经纪人贴片类
|
|
31
|
-
*
|
|
32
|
-
* 基于 THREE.js 的网格对象,作为 VR 视频播放的核心媒体管理组件。
|
|
33
|
-
* 负责视频和音频的播放控制、时间同步、绿幕抠图渲染等功能。
|
|
34
|
-
*
|
|
35
|
-
* 主要特性:
|
|
36
|
-
* - 支持绿幕抠图渲染(ChromaKey)
|
|
37
|
-
* - 音视频同步播放管理
|
|
38
|
-
* - 媒体预载优化策略
|
|
39
|
-
* - 跨平台播放兼容性
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
* const videoMesh = new VideoAgentMesh(1920, 1080, 32, 18, {
|
|
44
|
-
* preload: true,
|
|
45
|
-
* videoInstance: customVideoElement
|
|
46
|
-
* })
|
|
47
|
-
*
|
|
48
|
-
* // 播放视频
|
|
49
|
-
* await videoMesh.play('https://example.com/video.mp4', 0, 60)
|
|
50
|
-
*
|
|
51
|
-
* // 获取当前时间
|
|
52
|
-
* console.log(videoMesh.currentTime)
|
|
53
|
-
*
|
|
54
|
-
* // 销毁资源
|
|
55
|
-
* videoMesh.dispose()
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
59
|
-
_inherits(VideoAgentMesh, _THREE$Mesh);
|
|
60
|
-
var _super = _createSuper(VideoAgentMesh);
|
|
61
|
-
/**
|
|
62
|
-
* 创建视频经纪人贴片实例
|
|
63
|
-
*
|
|
64
|
-
* @param width - 网格宽度
|
|
65
|
-
* @param height - 网格高度
|
|
66
|
-
* @param widthSegments - 宽度方向分段数
|
|
67
|
-
* @param heightSegments - 高度方向分段数
|
|
68
|
-
* @param options - 配置选项
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* ```typescript
|
|
72
|
-
* const mesh = new VideoAgentMesh(1920, 1080, 32, 18, {
|
|
73
|
-
* preload: true,
|
|
74
|
-
* videoInstance: document.getElementById('video')
|
|
75
|
-
* })
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
function VideoAgentMesh(width, height, widthSegments, heightSegments) {
|
|
79
|
-
var _this$options$videoIn, _this$options$videoIn2;
|
|
80
|
-
var _this;
|
|
81
|
-
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
82
|
-
preload: true
|
|
83
|
-
};
|
|
84
|
-
_classCallCheck(this, VideoAgentMesh);
|
|
85
|
-
var ownsVideo = !options.videoInstance;
|
|
86
|
-
if (!options.videoInstance) {
|
|
87
|
-
var videoInstance = document.createElement('video');
|
|
88
|
-
videoInstance.style.display = 'none';
|
|
89
|
-
videoInstance.playsInline = true;
|
|
90
|
-
videoInstance.muted = true;
|
|
91
|
-
document.body.append(videoInstance);
|
|
92
|
-
options.videoInstance = videoInstance;
|
|
93
|
-
}
|
|
94
|
-
var geometry = new THREE.PlaneGeometry(width, height, widthSegments, heightSegments);
|
|
95
|
-
var videoTexture = new THREE.VideoTexture(options.videoInstance);
|
|
96
|
-
var material = new THREE.ShaderMaterial({
|
|
97
|
-
uniforms: {
|
|
98
|
-
map: {
|
|
99
|
-
value: videoTexture
|
|
100
|
-
},
|
|
101
|
-
enable: {
|
|
102
|
-
value: 0
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
vertexShader: vertexShader,
|
|
106
|
-
fragmentShader: fragmentShaderTpl(),
|
|
107
|
-
transparent: true
|
|
108
|
-
});
|
|
109
|
-
_this = _super.call(this, geometry, material);
|
|
110
|
-
_defineProperty(_assertThisInitialized(_this), "outputs", new Map());
|
|
111
|
-
_defineProperty(_assertThisInitialized(_this), "ownsVideo", false);
|
|
112
|
-
_defineProperty(_assertThisInitialized(_this), "ownsAudio", false);
|
|
113
|
-
_defineProperty(_assertThisInitialized(_this), "generation", 0);
|
|
114
|
-
_this.ownsVideo = ownsVideo;
|
|
115
|
-
_this.ownsAudio = !options.audioInstance;
|
|
116
|
-
_this.options = options;
|
|
117
|
-
_this.freeze = false;
|
|
118
|
-
_this.paused = true;
|
|
119
|
-
if (!options.audioInstance) {
|
|
120
|
-
_this.audioInstance = document.createElement('audio');
|
|
121
|
-
_this.audioInstance.crossOrigin = '';
|
|
122
|
-
_this.audioInstance.muted = true;
|
|
123
|
-
_this.audioInstance.autoplay = false;
|
|
124
|
-
} else {
|
|
125
|
-
_this.audioInstance = options.audioInstance;
|
|
126
|
-
}
|
|
127
|
-
_this.audioLikeInstance = new AudioLike();
|
|
128
|
-
makeObservable(_assertThisInitialized(_this), {
|
|
129
|
-
paused: observable
|
|
130
|
-
});
|
|
131
|
-
var updatePaused = function updatePaused(paused) {
|
|
132
|
-
return runInAction(function () {
|
|
133
|
-
return _this.paused = paused;
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
var onPause = function onPause() {
|
|
137
|
-
return updatePaused(true);
|
|
138
|
-
};
|
|
139
|
-
var onPlay = function onPlay() {
|
|
140
|
-
return updatePaused(false);
|
|
141
|
-
};
|
|
142
|
-
_this.audioInstance.addEventListener('pause', onPause);
|
|
143
|
-
_this.audioInstance.addEventListener('play', onPlay);
|
|
144
|
-
(_this$options$videoIn = _this.options.videoInstance) === null || _this$options$videoIn === void 0 ? void 0 : _this$options$videoIn.addEventListener('pause', onPause);
|
|
145
|
-
(_this$options$videoIn2 = _this.options.videoInstance) === null || _this$options$videoIn2 === void 0 ? void 0 : _this$options$videoIn2.addEventListener('play', onPlay);
|
|
146
|
-
_this.audioLikeInstance.addEventListener('pause', onPause);
|
|
147
|
-
_this.audioLikeInstance.addEventListener('play', onPlay);
|
|
148
|
-
_this.$removeEventListener = function () {
|
|
149
|
-
var _this$options$videoIn3, _this$options$videoIn4;
|
|
150
|
-
_this.audioInstance.removeEventListener('pause', onPause);
|
|
151
|
-
_this.audioInstance.removeEventListener('play', onPlay);
|
|
152
|
-
(_this$options$videoIn3 = _this.options.videoInstance) === null || _this$options$videoIn3 === void 0 ? void 0 : _this$options$videoIn3.removeEventListener('pause', onPause);
|
|
153
|
-
(_this$options$videoIn4 = _this.options.videoInstance) === null || _this$options$videoIn4 === void 0 ? void 0 : _this$options$videoIn4.removeEventListener('play', onPlay);
|
|
154
|
-
_this.audioLikeInstance.removeEventListener('pause', onPause);
|
|
155
|
-
_this.audioLikeInstance.removeEventListener('play', onPlay);
|
|
156
|
-
};
|
|
157
|
-
return _this;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* 更新媒体资源
|
|
162
|
-
*
|
|
163
|
-
* 内部方法,负责加载新的视频/音频资源,处理预载逻辑和着色器设置
|
|
164
|
-
* @param videoUrl - 媒体文件URL
|
|
165
|
-
* @private
|
|
166
|
-
*/
|
|
167
|
-
_createClass(VideoAgentMesh, [{
|
|
168
|
-
key: "operations",
|
|
169
|
-
value: /** 配置选项 */
|
|
170
|
-
|
|
171
|
-
/** 当前视频URL */
|
|
172
|
-
|
|
173
|
-
/** 是否冻结状态 */
|
|
174
|
-
|
|
175
|
-
/** 是否暂停状态 */
|
|
176
|
-
|
|
177
|
-
/** 音频实例 */
|
|
178
|
-
|
|
179
|
-
function operations(run, element) {
|
|
180
|
-
var operations = run ? run.bind(element) : element;
|
|
181
|
-
this.outputs.set(element, operations);
|
|
182
|
-
return operations;
|
|
183
|
-
}
|
|
184
|
-
}, {
|
|
185
|
-
key: "mediaInstance",
|
|
186
|
-
get:
|
|
187
|
-
/**
|
|
188
|
-
* 获取当前的媒体实例
|
|
189
|
-
*
|
|
190
|
-
* 根据媒体类型自动返回对应的播放实例:
|
|
191
|
-
* - 无媒体时返回 AudioLike 实例
|
|
192
|
-
* - 音频文件返回 HTMLAudioElement
|
|
193
|
-
* - 视频文件返回 HTMLVideoElement
|
|
194
|
-
*
|
|
195
|
-
* @returns 当前活跃的媒体播放实例
|
|
196
|
-
*/
|
|
197
|
-
function get() {
|
|
198
|
-
if (!this.videoUrl) {
|
|
199
|
-
return this.audioLikeInstance;
|
|
200
|
-
}
|
|
201
|
-
if (getMediaType(this.videoUrl) === 'audio') {
|
|
202
|
-
return this.audioInstance;
|
|
203
|
-
}
|
|
204
|
-
var uniforms = this.material.uniforms;
|
|
205
|
-
var videoInstance = uniforms.map.value.image;
|
|
206
|
-
return videoInstance;
|
|
207
|
-
}
|
|
208
|
-
}, {
|
|
209
|
-
key: "update",
|
|
210
|
-
value: function () {
|
|
211
|
-
var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(videoUrl, valid, run) {
|
|
212
|
-
var _this2 = this;
|
|
213
|
-
var element, media, src, onStart;
|
|
214
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
215
|
-
while (1) {
|
|
216
|
-
switch (_context.prev = _context.next) {
|
|
217
|
-
case 0:
|
|
218
|
-
if (!(this.videoUrl === videoUrl)) {
|
|
219
|
-
_context.next = 2;
|
|
220
|
-
break;
|
|
221
|
-
}
|
|
222
|
-
return _context.abrupt("return");
|
|
223
|
-
case 2:
|
|
224
|
-
this.stop();
|
|
225
|
-
this.freeze = true;
|
|
226
|
-
element = getMediaType(videoUrl) === 'audio' ? this.audioInstance : this.options.videoInstance;
|
|
227
|
-
media = this.operations(run, element);
|
|
228
|
-
media.muted = true;
|
|
229
|
-
if (!(this.options.preload !== false || getMediaType(videoUrl) === 'video')) {
|
|
230
|
-
_context.next = 15;
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
_context.t1 = URL;
|
|
234
|
-
_context.next = 11;
|
|
235
|
-
return Preloader.blob(videoUrl);
|
|
236
|
-
case 11:
|
|
237
|
-
_context.t2 = _context.sent;
|
|
238
|
-
_context.t0 = _context.t1.createObjectURL.call(_context.t1, _context.t2);
|
|
239
|
-
_context.next = 16;
|
|
240
|
-
break;
|
|
241
|
-
case 15:
|
|
242
|
-
_context.t0 = videoUrl;
|
|
243
|
-
case 16:
|
|
244
|
-
src = _context.t0;
|
|
245
|
-
if (valid()) {
|
|
246
|
-
_context.next = 20;
|
|
247
|
-
break;
|
|
248
|
-
}
|
|
249
|
-
if (src !== videoUrl) URL.revokeObjectURL(src);
|
|
250
|
-
return _context.abrupt("return");
|
|
251
|
-
case 20:
|
|
252
|
-
this.videoUrl = videoUrl;
|
|
253
|
-
if (this.objectURL) URL.revokeObjectURL(this.objectURL);
|
|
254
|
-
this.objectURL = src !== videoUrl ? src : undefined;
|
|
255
|
-
media.src = src;
|
|
256
|
-
element.setAttribute('data-src', videoUrl);
|
|
257
|
-
onStart = function onStart() {
|
|
258
|
-
var _this2$removeStart;
|
|
259
|
-
if (!valid() || media.currentTime === 0) return;
|
|
260
|
-
_this2.freeze = false;
|
|
261
|
-
media.muted = false;
|
|
262
|
-
_this2.material.uniforms.enable.value = getMediaType(videoUrl) ? 1 : 0;
|
|
263
|
-
(_this2$removeStart = _this2.removeStart) === null || _this2$removeStart === void 0 ? void 0 : _this2$removeStart.call(_this2);
|
|
264
|
-
};
|
|
265
|
-
this.removeStart = function () {
|
|
266
|
-
return element.removeEventListener('timeupdate', onStart);
|
|
267
|
-
};
|
|
268
|
-
element.addEventListener('timeupdate', onStart);
|
|
269
|
-
case 28:
|
|
270
|
-
case "end":
|
|
271
|
-
return _context.stop();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}, _callee, this);
|
|
275
|
-
}));
|
|
276
|
-
function update(_x, _x2, _x3) {
|
|
277
|
-
return _update.apply(this, arguments);
|
|
278
|
-
}
|
|
279
|
-
return update;
|
|
280
|
-
}()
|
|
281
|
-
/**
|
|
282
|
-
* 播放媒体内容
|
|
283
|
-
*
|
|
284
|
-
* 支持多种播放模式:
|
|
285
|
-
* - 播放指定视频/音频文件
|
|
286
|
-
* - 仅设置时长(无媒体文件)
|
|
287
|
-
* - 继续播放当前媒体
|
|
288
|
-
*
|
|
289
|
-
* @param videoUrl - 媒体文件URL,默认为空字符串
|
|
290
|
-
* @param currentTime - 播放起始时间(秒),默认为 0
|
|
291
|
-
* @param duration - 媒体总时长(秒),可选
|
|
292
|
-
* @returns Promise<boolean> 播放是否成功
|
|
293
|
-
*
|
|
294
|
-
* @example
|
|
295
|
-
* ```typescript
|
|
296
|
-
* // 播放视频文件
|
|
297
|
-
* await mesh.play('video.mp4', 10, 120)
|
|
298
|
-
*
|
|
299
|
-
* // 仅设置时长(音频跟踪)
|
|
300
|
-
* await mesh.play('', 0, 60)
|
|
301
|
-
*
|
|
302
|
-
* // 继续播放当前媒体
|
|
303
|
-
* await mesh.play()
|
|
304
|
-
* ```
|
|
305
|
-
*/
|
|
306
|
-
}, {
|
|
307
|
-
key: "play",
|
|
308
|
-
value: function () {
|
|
309
|
-
var _play = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
310
|
-
var _this$options$getPlay,
|
|
311
|
-
_this$options,
|
|
312
|
-
_this3 = this;
|
|
313
|
-
var videoUrl,
|
|
314
|
-
currentTime,
|
|
315
|
-
duration,
|
|
316
|
-
run,
|
|
317
|
-
generation,
|
|
318
|
-
valid,
|
|
319
|
-
media,
|
|
320
|
-
_args2 = arguments;
|
|
321
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
322
|
-
while (1) {
|
|
323
|
-
switch (_context2.prev = _context2.next) {
|
|
324
|
-
case 0:
|
|
325
|
-
videoUrl = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : '';
|
|
326
|
-
currentTime = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : 0;
|
|
327
|
-
duration = _args2.length > 2 ? _args2[2] : undefined;
|
|
328
|
-
run = (_this$options$getPlay = (_this$options = this.options).getPlayback) === null || _this$options$getPlay === void 0 ? void 0 : _this$options$getPlay.call(_this$options);
|
|
329
|
-
if (!(this.options.getPlayback && !(run !== null && run !== void 0 && run.valid()))) {
|
|
330
|
-
_context2.next = 6;
|
|
331
|
-
break;
|
|
332
|
-
}
|
|
333
|
-
return _context2.abrupt("return", false);
|
|
334
|
-
case 6:
|
|
335
|
-
// stop() invalidates all earlier loads before the new generation is captured.
|
|
336
|
-
if (videoUrl && videoUrl !== this.videoUrl) this.stop();
|
|
337
|
-
generation = this.generation;
|
|
338
|
-
valid = function valid() {
|
|
339
|
-
return generation === _this3.generation && (!_this3.options.getPlayback || !!(run !== null && run !== void 0 && run.valid()));
|
|
340
|
-
};
|
|
341
|
-
if (!(videoUrl && videoUrl !== this.videoUrl)) {
|
|
342
|
-
_context2.next = 13;
|
|
343
|
-
break;
|
|
344
|
-
}
|
|
345
|
-
// update's synchronous stop is accounted for before awaiting its load.
|
|
346
|
-
generation++;
|
|
347
|
-
_context2.next = 13;
|
|
348
|
-
return this.update(videoUrl, valid, run);
|
|
349
|
-
case 13:
|
|
350
|
-
if (valid()) {
|
|
351
|
-
_context2.next = 15;
|
|
352
|
-
break;
|
|
353
|
-
}
|
|
354
|
-
return _context2.abrupt("return", false);
|
|
355
|
-
case 15:
|
|
356
|
-
if (duration && !videoUrl) {
|
|
357
|
-
this.videoUrl = '';
|
|
358
|
-
this.audioLikeInstance.duration = duration;
|
|
359
|
-
}
|
|
360
|
-
media = this.videoUrl ? this.operations(run, this.mediaInstance) : this.audioLikeInstance;
|
|
361
|
-
if (videoUrl || duration) media.currentTime = currentTime;
|
|
362
|
-
media.muted = true;
|
|
363
|
-
_context2.next = 21;
|
|
364
|
-
return media.play();
|
|
365
|
-
case 21:
|
|
366
|
-
if (valid()) {
|
|
367
|
-
_context2.next = 23;
|
|
368
|
-
break;
|
|
369
|
-
}
|
|
370
|
-
return _context2.abrupt("return", false);
|
|
371
|
-
case 23:
|
|
372
|
-
media.muted = false;
|
|
373
|
-
return _context2.abrupt("return", true);
|
|
374
|
-
case 25:
|
|
375
|
-
case "end":
|
|
376
|
-
return _context2.stop();
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}, _callee2, this);
|
|
380
|
-
}));
|
|
381
|
-
function play() {
|
|
382
|
-
return _play.apply(this, arguments);
|
|
383
|
-
}
|
|
384
|
-
return play;
|
|
385
|
-
}()
|
|
386
|
-
}, {
|
|
387
|
-
key: "mediaOperations",
|
|
388
|
-
get: function get() {
|
|
389
|
-
var _this$options$getPlay2, _this$options2;
|
|
390
|
-
var run = (_this$options$getPlay2 = (_this$options2 = this.options).getPlayback) === null || _this$options$getPlay2 === void 0 ? void 0 : _this$options$getPlay2.call(_this$options2);
|
|
391
|
-
if (this.options.getPlayback && !(run !== null && run !== void 0 && run.valid())) return undefined;
|
|
392
|
-
return this.videoUrl ? this.operations(run, this.mediaInstance) : this.audioLikeInstance;
|
|
393
|
-
}
|
|
394
|
-
}, {
|
|
395
|
-
key: "stop",
|
|
396
|
-
value: function stop() {
|
|
397
|
-
var _this$removeStart;
|
|
398
|
-
++this.generation;
|
|
399
|
-
(_this$removeStart = this.removeStart) === null || _this$removeStart === void 0 ? void 0 : _this$removeStart.call(this);
|
|
400
|
-
this.removeStart = undefined;
|
|
401
|
-
var _iterator = _createForOfIteratorHelper(this.outputs.values()),
|
|
402
|
-
_step;
|
|
403
|
-
try {
|
|
404
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
405
|
-
var output = _step.value;
|
|
406
|
-
output.muted = true;
|
|
407
|
-
output.pause();
|
|
408
|
-
}
|
|
409
|
-
} catch (err) {
|
|
410
|
-
_iterator.e(err);
|
|
411
|
-
} finally {
|
|
412
|
-
_iterator.f();
|
|
413
|
-
}
|
|
414
|
-
this.outputs.clear();
|
|
415
|
-
this.audioLikeInstance.pause();
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* 获取当前播放时间(毫秒)
|
|
420
|
-
*
|
|
421
|
-
* 将媒体实例的秒级时间转换为毫秒,提供更高精度的时间控制
|
|
422
|
-
* @returns 当前播放时间戳(毫秒)
|
|
423
|
-
*/
|
|
424
|
-
}, {
|
|
425
|
-
key: "currentTime",
|
|
426
|
-
get: function get() {
|
|
427
|
-
return this.mediaInstance.currentTime * 1000;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* 销毁视频经纪人贴片实例
|
|
432
|
-
*
|
|
433
|
-
* 清理所有事件监听器、DOM元素和缓存实例,释放内存资源
|
|
434
|
-
*
|
|
435
|
-
* @example
|
|
436
|
-
* ```typescript
|
|
437
|
-
* // 在组件卸载时调用
|
|
438
|
-
* videoMesh.dispose()
|
|
439
|
-
* ```
|
|
440
|
-
*/
|
|
441
|
-
}, {
|
|
442
|
-
key: "dispose",
|
|
443
|
-
value: function dispose() {
|
|
444
|
-
var _this$options$videoIn5;
|
|
445
|
-
this.stop();
|
|
446
|
-
this.$removeEventListener();
|
|
447
|
-
if (this.ownsVideo) (_this$options$videoIn5 = this.options.videoInstance) === null || _this$options$videoIn5 === void 0 ? void 0 : _this$options$videoIn5.remove();
|
|
448
|
-
if (this.ownsAudio) this.audioInstance.remove();
|
|
449
|
-
if (this.objectURL) URL.revokeObjectURL(this.objectURL);
|
|
450
|
-
this.geometry.dispose();
|
|
451
|
-
this.material.uniforms.map.value.dispose();
|
|
452
|
-
this.material.dispose();
|
|
453
|
-
}
|
|
454
|
-
}]);
|
|
455
|
-
return VideoAgentMesh;
|
|
456
|
-
}(THREE.Mesh);
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
-
import * as THREE from 'three';
|
|
5
|
-
import { addResizeListener } from "../../../shared-utils/addResizeListener.js";
|
|
6
|
-
import { VideoAgentMesh } from "./VideoAgentMesh.js";
|
|
7
|
-
export var VideoAgentScene = /*#__PURE__*/_createClass(function VideoAgentScene(container, options) {
|
|
8
|
-
var _this = this;
|
|
9
|
-
_classCallCheck(this, VideoAgentScene);
|
|
10
|
-
_defineProperty(this, "scene", new THREE.Scene());
|
|
11
|
-
_defineProperty(this, "camera", new THREE.OrthographicCamera(-240, 240, 135, -135));
|
|
12
|
-
_defineProperty(this, "renderer", new THREE.WebGLRenderer({
|
|
13
|
-
alpha: true
|
|
14
|
-
}));
|
|
15
|
-
_defineProperty(this, "frame", 0);
|
|
16
|
-
_defineProperty(this, "disposers", []);
|
|
17
|
-
_defineProperty(this, "run", function () {
|
|
18
|
-
// 视频开始 1s 不渲染:规避某些设备黑屏闪烁问题。视频前 2s 是最好是静默的。
|
|
19
|
-
if (!(_this.videoAgentMesh.paused || _this.videoAgentMesh.freeze) && _this.videoAgentMesh.currentTime > 1000) {
|
|
20
|
-
_this.renderer.render(_this.scene, _this.camera);
|
|
21
|
-
}
|
|
22
|
-
_this.frame = requestAnimationFrame(_this.run);
|
|
23
|
-
});
|
|
24
|
-
_defineProperty(this, "dispose", function () {
|
|
25
|
-
var _this$videoAgentMesh;
|
|
26
|
-
cancelAnimationFrame(_this.frame);
|
|
27
|
-
_this.renderer.dispose();
|
|
28
|
-
_this.renderer.domElement.remove();
|
|
29
|
-
(_this$videoAgentMesh = _this.videoAgentMesh) === null || _this$videoAgentMesh === void 0 ? void 0 : _this$videoAgentMesh.dispose();
|
|
30
|
-
_this.disposers.forEach(function (disposer) {
|
|
31
|
-
return disposer === null || disposer === void 0 ? void 0 : disposer();
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
this.videoAgentMesh = new VideoAgentMesh(480, 270, 1, 1, options);
|
|
35
|
-
|
|
36
|
-
// const needRender = getMediaType(this.videoAgentMesh.videoUrl) === 'video'
|
|
37
|
-
|
|
38
|
-
if (container) {
|
|
39
|
-
this.camera.position.set(0, 0, 10);
|
|
40
|
-
this.camera.lookAt(0, 0, 0);
|
|
41
|
-
var domElement = this.renderer.domElement;
|
|
42
|
-
domElement.classList.add('VideoAgent-canvas');
|
|
43
|
-
var dispose = addResizeListener(container, function (width, height) {
|
|
44
|
-
_this.renderer.setSize(width * window.devicePixelRatio, height * window.devicePixelRatio);
|
|
45
|
-
domElement.style.width = "".concat(width, "px");
|
|
46
|
-
domElement.style.height = "".concat(height, "px");
|
|
47
|
-
});
|
|
48
|
-
this.disposers.push(dispose);
|
|
49
|
-
container.append(domElement);
|
|
50
|
-
this.scene.add(this.videoAgentMesh);
|
|
51
|
-
this.run();
|
|
52
|
-
}
|
|
53
|
-
});
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { useController } from "../../hooks.js";
|
|
6
|
-
import { VideoAgentScene } from "./VideoAgentScene.js";
|
|
7
|
-
import classNames from 'classnames';
|
|
8
|
-
export function VideoAgent(props) {
|
|
9
|
-
var _controller$avatar2;
|
|
10
|
-
var ref = React.useRef(null);
|
|
11
|
-
var controller = useController();
|
|
12
|
-
var showAvatar = React.useMemo(function () {
|
|
13
|
-
var _controller$avatar;
|
|
14
|
-
return ((_controller$avatar = controller.avatar) === null || _controller$avatar === void 0 ? void 0 : _controller$avatar.url) && controller.avatar.force === true;
|
|
15
|
-
}, [controller.avatar]);
|
|
16
|
-
var showVideoAgent = React.useMemo(function () {
|
|
17
|
-
var _controller$videoAgen;
|
|
18
|
-
if (showAvatar) return false;
|
|
19
|
-
return ((_controller$videoAgen = controller.videoAgentScene) === null || _controller$videoAgen === void 0 ? void 0 : _controller$videoAgen.videoAgentMesh.mediaInstance) instanceof HTMLVideoElement;
|
|
20
|
-
}, [controller.videoAgentScene, showAvatar]);
|
|
21
|
-
React.useEffect(function () {
|
|
22
|
-
if (!ref.current) throw new Error('React 渲染异常,请稍后重试 ...');
|
|
23
|
-
if (controller.videoAgentScene) {
|
|
24
|
-
console.warn('VideoAgentScene" 重复初始化,已被过滤');
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
var videoAgentScene = new VideoAgentScene(ref.current, _objectSpread(_objectSpread({}, props.options), {}, {
|
|
28
|
-
getPlayback: function getPlayback() {
|
|
29
|
-
return controller.playback.capture();
|
|
30
|
-
}
|
|
31
|
-
}));
|
|
32
|
-
controller.videoAgentScene = videoAgentScene;
|
|
33
|
-
return function () {
|
|
34
|
-
var _controller$videoAgen2;
|
|
35
|
-
controller.dispose();
|
|
36
|
-
(_controller$videoAgen2 = controller.videoAgentScene) === null || _controller$videoAgen2 === void 0 ? void 0 : _controller$videoAgen2.dispose();
|
|
37
|
-
controller.videoAgentScene = undefined;
|
|
38
|
-
};
|
|
39
|
-
}, []);
|
|
40
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
41
|
-
className: "Avatar",
|
|
42
|
-
style: {
|
|
43
|
-
display: showAvatar ? 'block' : 'none'
|
|
44
|
-
}
|
|
45
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
46
|
-
className: "Avatar-wrapper ratio-1-1"
|
|
47
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
48
|
-
className: "Avatar-img",
|
|
49
|
-
src: (_controller$avatar2 = controller.avatar) === null || _controller$avatar2 === void 0 ? void 0 : _controller$avatar2.url,
|
|
50
|
-
onClick: function onClick() {
|
|
51
|
-
var _props$onClick;
|
|
52
|
-
return (_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props);
|
|
53
|
-
}
|
|
54
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
className: classNames('VideoAgent', {
|
|
56
|
-
hide: !showVideoAgent
|
|
57
|
-
})
|
|
58
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
59
|
-
className: "VideoAgent-container"
|
|
60
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
61
|
-
className: "VideoAgent-wrapper ratio-16-9"
|
|
62
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
63
|
-
className: "VideoAgent-inner",
|
|
64
|
-
ref: ref
|
|
65
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
66
|
-
className: "VideoAgent-play",
|
|
67
|
-
onClick: function onClick() {
|
|
68
|
-
var _props$onClick2;
|
|
69
|
-
return (_props$onClick2 = props.onClick) === null || _props$onClick2 === void 0 ? void 0 : _props$onClick2.call(props);
|
|
70
|
-
}
|
|
71
|
-
}))))));
|
|
72
|
-
}
|