@realsee/vreo 0.2.0-alpha.11 → 0.2.0-alpha.12
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 +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Player.Controller.html +3 -3
- package/docs/classes/Player.Player-1.html +3 -3
- package/docs/classes/Player.VideoAgentMesh.html +11 -11
- package/docs/classes/Player.VideoAgentScene.html +1 -1
- package/docs/enums/Player.InfoPanelStyleEnum.html +1 -1
- package/docs/enums/Player.InfoPanelTypeEnum.html +1 -1
- package/docs/enums/Player.PanoEffectEnum.html +1 -1
- package/docs/enums/Player.PanoTagEnum.html +1 -1
- package/docs/enums/Player.PanoTagStyleEnum.html +7 -0
- package/docs/enums/Player.VreoKeyframeEnum.html +12 -12
- package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
- package/docs/enums/fivePlugins.Rotation.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
- package/docs/interfaces/Player.PlayerConfigs.html +2 -2
- package/docs/interfaces/Player.Vertex.html +1 -1
- package/docs/interfaces/Player.VideoAgentMeshOptions.html +1 -1
- package/docs/interfaces/Player.VreoKeyframe.html +1 -1
- package/docs/interfaces/Player.VreoUnit.html +1 -1
- package/docs/interfaces/Player.VreoVideo.html +1 -1
- package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
- package/docs/interfaces/react.VreoActionCallbacks.html +6 -6
- package/docs/interfaces/react.VreoProviderProps.html +1 -1
- package/docs/modules/Player.html +14 -14
- package/docs/modules/custom.html +1 -1
- package/docs/modules/fivePlugins.html +2 -2
- package/docs/modules/react.html +1 -1
- package/lib/Player/index.d.ts +1 -1
- package/lib/Player/index.js +8 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +1 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +21 -19
- package/lib/Player/modules/keyframes/PanoTag/index.js +19 -6
- package/lib/react/index.d.ts +2 -2
- package/lib/react/index.js +2 -2
- package/lib/typings/VreoUnit.d.ts +14 -0
- package/lib/typings/VreoUnit.js +13 -1
- package/package.json +3 -3
- package/resources/Player/index.tsx +6 -2
- package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +3 -3
- package/resources/Player/modules/keyframes/PanoTag/index.tsx +31 -12
- package/resources/react/index.tsx +2 -2
- package/resources/typings/VreoUnit.ts +15 -0
- package/stylesheets/default.css +25 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@realsee/vreo",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.12",
|
|
4
4
|
"description": "Vreo (VR Video 缩写) 是基于如视三维渲染引擎 Five 和 用户界面构建库 React 实现的如视 3D 空间剧本播放器。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"realsee",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@realsee/five": "^5.0.0-alpha.103",
|
|
29
|
-
"react": "^
|
|
30
|
-
"react-dom": "^
|
|
29
|
+
"react": "^17.0.0",
|
|
30
|
+
"react-dom": "^17.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/cli": "^7.16.0",
|
|
@@ -129,7 +129,7 @@ export class Player extends Subscribe<VreoKeyframeEvent> {
|
|
|
129
129
|
if (this.controller.videoAgentScene?.videoAgentMesh.videoInstance) {
|
|
130
130
|
this.controller.videoAgentScene.videoAgentMesh.videoInstance.currentTime = currentTime / 1000
|
|
131
131
|
}
|
|
132
|
-
await this.controller.videoAgentScene?.videoAgentMesh.play(vreoUnit.video.url)
|
|
132
|
+
await this.controller.videoAgentScene?.videoAgentMesh.play(vreoUnit.video.url, currentTime / 1000)
|
|
133
133
|
this.play()
|
|
134
134
|
}
|
|
135
135
|
this.controller.run((type, keyframe) => this.emit(type, keyframe))
|
|
@@ -140,8 +140,12 @@ export class Player extends Subscribe<VreoKeyframeEvent> {
|
|
|
140
140
|
return !this.controller.playing
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
play() {
|
|
143
|
+
play(currentTime?: number) {
|
|
144
144
|
if (this.controller.playing) return true
|
|
145
|
+
if (currentTime && this.controller.videoInstance) {
|
|
146
|
+
// Object.assign(window, {$vreoController: this.controller})
|
|
147
|
+
this.controller.videoInstance.currentTime = currentTime / 1000
|
|
148
|
+
}
|
|
145
149
|
this.controller.setPlaying(true)
|
|
146
150
|
return true
|
|
147
151
|
}
|
|
@@ -196,7 +196,7 @@ export class VideoAgentMesh extends THREE.Mesh {
|
|
|
196
196
|
this.videoInstance.addEventListener('timeupdate', onStart, false)
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
async play(videoUrl = '') {
|
|
199
|
+
async play(videoUrl = '', currentTime = 0) {
|
|
200
200
|
videoUrl = videoUrl || ''
|
|
201
201
|
if (!videoUrl) {
|
|
202
202
|
if (this.videoUrl) await this.videoInstance.play()
|
|
@@ -205,7 +205,7 @@ export class VideoAgentMesh extends THREE.Mesh {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
if (videoUrl === this.videoUrl) {
|
|
208
|
-
this.videoInstance.currentTime =
|
|
208
|
+
this.videoInstance.currentTime = currentTime
|
|
209
209
|
await this.videoInstance.play()
|
|
210
210
|
return true
|
|
211
211
|
}
|
|
@@ -216,7 +216,7 @@ export class VideoAgentMesh extends THREE.Mesh {
|
|
|
216
216
|
|
|
217
217
|
return await new Promise((resolve) =>
|
|
218
218
|
setTimeout(async () => {
|
|
219
|
-
this.videoInstance.currentTime =
|
|
219
|
+
this.videoInstance.currentTime = currentTime
|
|
220
220
|
await this.videoInstance.play()
|
|
221
221
|
resolve(true)
|
|
222
222
|
}, 20),
|
|
@@ -2,13 +2,21 @@ import classNames from 'classnames'
|
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
import { Vector3 } from 'three'
|
|
4
4
|
import { useController, useFiveInstance, useFiveProject2d } from '../../../hooks'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
PanoTagData,
|
|
7
|
+
PanoTagEnum,
|
|
8
|
+
PanoTagStyleEnum,
|
|
9
|
+
Vertex,
|
|
10
|
+
VreoKeyframe,
|
|
11
|
+
VreoKeyframeEnum,
|
|
12
|
+
} from '../../../../typings/VreoUnit'
|
|
6
13
|
|
|
7
14
|
export function PanoTag() {
|
|
8
15
|
const [state, setState] = React.useState<{
|
|
9
16
|
vertex: Vertex
|
|
10
17
|
text?: string
|
|
11
18
|
type: PanoTagEnum
|
|
19
|
+
style?: PanoTagStyleEnum
|
|
12
20
|
imgUrl?: string
|
|
13
21
|
} | null>(null)
|
|
14
22
|
|
|
@@ -30,6 +38,7 @@ export function PanoTag() {
|
|
|
30
38
|
const vertex = panoTagData.vertex
|
|
31
39
|
const { x, y, z } = panoTagData.vertex
|
|
32
40
|
const res = project2d(new Vector3(x, y, z))
|
|
41
|
+
|
|
33
42
|
if (!res) return
|
|
34
43
|
const { x: left, y: top } = res
|
|
35
44
|
setState({
|
|
@@ -37,6 +46,7 @@ export function PanoTag() {
|
|
|
37
46
|
text: panoTagData.text || PanoTagEnum.Text,
|
|
38
47
|
type: panoTagData.type,
|
|
39
48
|
imgUrl: panoTagData.imgUrl,
|
|
49
|
+
style: panoTagData.style || PanoTagStyleEnum.Growth,
|
|
40
50
|
})
|
|
41
51
|
setPos({ left, top })
|
|
42
52
|
timeoutRef.current = setTimeout(() => {
|
|
@@ -92,6 +102,25 @@ export function PanoTag() {
|
|
|
92
102
|
return undefined
|
|
93
103
|
})()
|
|
94
104
|
|
|
105
|
+
if (state?.style === PanoTagStyleEnum.Expand) {
|
|
106
|
+
return (
|
|
107
|
+
<>
|
|
108
|
+
<div
|
|
109
|
+
className={classNames('PanoTag', {
|
|
110
|
+
'PanoTag--expand': true,
|
|
111
|
+
'PanoTag--notHidden': state,
|
|
112
|
+
})}
|
|
113
|
+
style={{
|
|
114
|
+
left: (pos?.left || 0) + 'px',
|
|
115
|
+
top: (pos?.top || 0) + 'px',
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
<div className={'PanoTag-box PanoTag-box--' + (state?.type || '')}>{boxContent}</div>
|
|
119
|
+
<div className="PanoTag-guideline"></div>
|
|
120
|
+
</div>
|
|
121
|
+
</>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
95
124
|
return (
|
|
96
125
|
<>
|
|
97
126
|
<div
|
|
@@ -109,17 +138,7 @@ export function PanoTag() {
|
|
|
109
138
|
<span className="PanoTag-slashline"></span>
|
|
110
139
|
<span className="PanoTag-straightline"></span>
|
|
111
140
|
</span>
|
|
112
|
-
<div
|
|
113
|
-
onClick={() => {
|
|
114
|
-
if (state?.imgUrl) {
|
|
115
|
-
// @TODO
|
|
116
|
-
// setDrawerVisible(true)
|
|
117
|
-
}
|
|
118
|
-
}}
|
|
119
|
-
className={'PanoTag-box PanoTag-box--' + (state?.type || '')}
|
|
120
|
-
>
|
|
121
|
-
{boxContent}
|
|
122
|
-
</div>
|
|
141
|
+
<div className={'PanoTag-box PanoTag-box--' + (state?.type || '')}>{boxContent}</div>
|
|
123
142
|
</div>
|
|
124
143
|
</div>
|
|
125
144
|
</>
|
|
@@ -54,7 +54,7 @@ export interface VreoActionCallbacks {
|
|
|
54
54
|
/**
|
|
55
55
|
* 播放。
|
|
56
56
|
*/
|
|
57
|
-
play: () => void
|
|
57
|
+
play: (currentTime?: number) => void
|
|
58
58
|
/**
|
|
59
59
|
* 暂停。
|
|
60
60
|
*/
|
|
@@ -81,7 +81,7 @@ export function useVreoAction() {
|
|
|
81
81
|
[player]
|
|
82
82
|
)
|
|
83
83
|
|
|
84
|
-
const play = React.useCallback(() => player.play(), [player])
|
|
84
|
+
const play = React.useCallback((currentTime?: number) => player.play(currentTime || 0), [player])
|
|
85
85
|
const pause = React.useCallback(() => player.pause(), [player])
|
|
86
86
|
const show = React.useCallback(() => player.show(), [player])
|
|
87
87
|
const hide = React.useCallback(() => player.hide(), [player])
|
|
@@ -208,8 +208,23 @@ export enum PanoTagEnum {
|
|
|
208
208
|
Image = 'Image',
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
/**
|
|
212
|
+
* 标签样式种类
|
|
213
|
+
*/
|
|
214
|
+
export enum PanoTagStyleEnum {
|
|
215
|
+
/**
|
|
216
|
+
* 生长动画:默认值
|
|
217
|
+
*/
|
|
218
|
+
Growth = 'Growth',
|
|
219
|
+
/**
|
|
220
|
+
* 展开动画
|
|
221
|
+
*/
|
|
222
|
+
Expand = 'Expand',
|
|
223
|
+
}
|
|
224
|
+
|
|
211
225
|
export type PanoTagData = {
|
|
212
226
|
type: PanoTagEnum
|
|
227
|
+
style: PanoTagStyleEnum
|
|
213
228
|
text: string
|
|
214
229
|
vertex: Vertex
|
|
215
230
|
imgUrl?: string
|
package/stylesheets/default.css
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
position: fixed;
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
5
|
-
width:
|
|
6
|
-
height:
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
7
|
pointer-events: none;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
position: fixed;
|
|
32
32
|
bottom: 0;
|
|
33
33
|
left: 0;
|
|
34
|
-
width:
|
|
34
|
+
width: 100%;
|
|
35
35
|
height: 150px;
|
|
36
36
|
color: white;
|
|
37
37
|
transition: transform 0.5s;
|
|
@@ -195,6 +195,27 @@
|
|
|
195
195
|
opacity: 0;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
.PanoTag--expand {
|
|
199
|
+
transform: translate(-50%, -50%);
|
|
200
|
+
color: white;
|
|
201
|
+
min-width: 150px;
|
|
202
|
+
max-width: 200px;
|
|
203
|
+
margin-top: 4px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.PanoTag--expand .PanoTag-box.PanoTag-box--Text {
|
|
207
|
+
display: flex;
|
|
208
|
+
justify-content: center;
|
|
209
|
+
align-items: center;
|
|
210
|
+
padding-bottom: 4px;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.PanoTag-guideline {
|
|
214
|
+
width: 100%;
|
|
215
|
+
background: linear-gradient(45deg, transparent 20% ,white, transparent 80%);
|
|
216
|
+
height: 3px;
|
|
217
|
+
}
|
|
218
|
+
|
|
198
219
|
.PanoTag--notHidden {
|
|
199
220
|
opacity: 1;
|
|
200
221
|
}
|
|
@@ -582,7 +603,7 @@
|
|
|
582
603
|
position: relative;
|
|
583
604
|
}
|
|
584
605
|
|
|
585
|
-
@media only screen and (min-width:
|
|
606
|
+
@media only screen and (min-width: 1080px) {
|
|
586
607
|
.vreo-PopUp-inner {
|
|
587
608
|
width: 678px;
|
|
588
609
|
height: 620px;
|