@realsee/vreo 0.2.0-alpha.7 → 0.2.0-alpha.8
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 +27 -0
- 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.VreoKeyframeEnum.html +12 -12
- package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
- package/docs/enums/fivePlugins.Rotation.html +1 -1
- package/docs/index.html +20 -0
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
- package/docs/interfaces/Player.PlayerConfigs.html +3 -3
- 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 +13 -13
- package/docs/modules/custom.html +1 -1
- package/docs/modules/fivePlugins.html +2 -2
- package/docs/modules/react.html +1 -1
- package/lib/PlayController/createHTMLAudioElement.d.ts +1 -0
- package/lib/PlayController/createHTMLAudioElement.js +47 -0
- package/lib/PlayController/index.d.ts +38 -0
- package/lib/PlayController/index.js +300 -0
- package/lib/Player/custom/SpatialScenePanel/index.js +0 -1
- package/lib/Player/index.d.ts +1 -1
- package/lib/Player/index.js +68 -9
- package/lib/Player/modules/keyframes/CameraMovement/index.js +41 -5
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +23 -15
- package/lib/Player/typings.d.ts +4 -0
- package/lib/fivePlugins/CameraMovementPlugin/index.js +101 -90
- package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +3 -2
- package/lib/typings/VreoUnit.d.ts +4 -3
- package/package.json +1 -1
- package/resources/PlayController/createHTMLAudioElement.ts +53 -0
- package/resources/PlayController/index.ts +167 -0
- package/resources/Player/custom/SpatialScenePanel/index.tsx +0 -1
- package/resources/Player/index.tsx +34 -2
- package/resources/Player/modules/keyframes/CameraMovement/index.tsx +7 -3
- package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +20 -15
- package/resources/Player/typings.ts +2 -0
- package/resources/fivePlugins/CameraMovementPlugin/index.ts +55 -47
- package/resources/fivePlugins/CameraMovementPlugin/typings.ts +2 -1
- package/resources/typings/VreoUnit.ts +5 -4
|
@@ -50,65 +50,73 @@ function progressNumber(from: number, to: number, pst: number) {
|
|
|
50
50
|
export const CameraMovementPlugin: FivePlugin<CameraMovementPluginParameterType, CameraMovementPluginExportType> = (
|
|
51
51
|
five: Five,
|
|
52
52
|
) => {
|
|
53
|
-
const move =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
const move = (args: Partial<MoveArgs>, duration: number, opts: MoveOpts = { preload: true }) => {
|
|
54
|
+
return new Promise<boolean>(async (resolve, reject) => {
|
|
55
|
+
|
|
56
|
+
if (opts.asyncStartCallback) {
|
|
57
|
+
opts.asyncStartCallback()
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (five.panoIndex === undefined) {
|
|
61
|
+
return reject(false)
|
|
62
|
+
}
|
|
57
63
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
if (args.mode && args.mode !== five.currentMode) {
|
|
65
|
+
await new Promise((resolve) => {
|
|
66
|
+
if (!args.mode) return
|
|
67
|
+
five.once('modeChange', (mode) => {
|
|
68
|
+
five.once('initAnimationEnded', () => {
|
|
69
|
+
if (mode === args.mode) {
|
|
70
|
+
resolve(true)
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
five.changeMode(args.mode, {
|
|
75
|
+
fov: args.fov || undefined,
|
|
76
|
+
latitude: args.latitude || undefined,
|
|
77
|
+
longitude: args.longitude || undefined,
|
|
78
|
+
panoIndex: args.panoIndex || undefined,
|
|
66
79
|
})
|
|
67
80
|
})
|
|
68
|
-
|
|
69
|
-
fov: args.fov || undefined,
|
|
70
|
-
latitude: args.latitude || undefined,
|
|
71
|
-
longitude: args.longitude || undefined,
|
|
72
|
-
panoIndex: args.panoIndex || undefined,
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
-
}
|
|
81
|
+
}
|
|
76
82
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
if (args.mode === Five.Mode.Floorplan) {
|
|
84
|
+
return resolve(true)
|
|
85
|
+
}
|
|
80
86
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
if (opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex) {
|
|
88
|
+
await five.preloadPano(args.panoIndex)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (opts.asyncEndCallback) {
|
|
92
|
+
opts.asyncEndCallback()
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (
|
|
96
|
+
args.panoIndex === undefined &&
|
|
97
|
+
args.fov === undefined &&
|
|
98
|
+
args.latitude === undefined &&
|
|
99
|
+
args.longitude === undefined
|
|
100
|
+
) {
|
|
101
|
+
return resolve(true)
|
|
102
|
+
}
|
|
84
103
|
|
|
85
|
-
if (opts.asyncEndCallback) {
|
|
86
|
-
opts.asyncEndCallback()
|
|
87
|
-
}
|
|
88
104
|
|
|
89
|
-
if (
|
|
90
|
-
args.panoIndex === undefined &&
|
|
91
|
-
args.fov === undefined &&
|
|
92
|
-
args.latitude === undefined &&
|
|
93
|
-
args.longitude === undefined
|
|
94
|
-
) {
|
|
95
|
-
return true
|
|
96
|
-
}
|
|
97
|
-
return await new Promise<boolean>((resolve, reject) => {
|
|
98
105
|
const panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex
|
|
106
|
+
|
|
99
107
|
if (panoIndex !== undefined) {
|
|
100
|
-
const movePanoOptions: MovePanoOptions = {
|
|
108
|
+
const movePanoOptions: MovePanoOptions = Object.assign(args, {
|
|
101
109
|
duration, // 移动耗时
|
|
102
110
|
moveEndCallback: () => resolve(true), // 移动结束
|
|
103
|
-
moveCancelCallback: () =>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
111
|
+
moveCancelCallback: () => {
|
|
112
|
+
resolve(true)
|
|
113
|
+
}, // 移动开始
|
|
114
|
+
// effect: args.transEffect || 'fade',
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
await five.moveToPano(
|
|
107
118
|
panoIndex,
|
|
108
|
-
|
|
109
|
-
movePanoOptions,
|
|
110
|
-
args,
|
|
111
|
-
),
|
|
119
|
+
movePanoOptions,
|
|
112
120
|
)
|
|
113
121
|
} else {
|
|
114
122
|
reject(false)
|
|
@@ -39,7 +39,8 @@ export interface CameraMovementOptsCallback {
|
|
|
39
39
|
export type MoveArgs = {
|
|
40
40
|
mode: Mode
|
|
41
41
|
panoIndex: number
|
|
42
|
-
|
|
42
|
+
transEffect?: "fly" | "fade" | "instant"
|
|
43
|
+
} & Pose
|
|
43
44
|
|
|
44
45
|
export type MoveOpts = {
|
|
45
46
|
preload?: boolean
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mode, Pose } from '@realsee/five'
|
|
1
|
+
import { Mode, MovePanoOptions, Pose } from '@realsee/five'
|
|
2
2
|
import { CameraMovementEffect, Rotation } from '../fivePlugins/CameraMovementPlugin/typings'
|
|
3
3
|
|
|
4
4
|
export enum VreoKeyframeEnum {
|
|
@@ -65,7 +65,7 @@ export type VreoKeyframeConfigMap = {
|
|
|
65
65
|
* 剧本关键帧
|
|
66
66
|
*/
|
|
67
67
|
export interface VreoKeyframe {
|
|
68
|
-
uuid
|
|
68
|
+
uuid?: string
|
|
69
69
|
type: VreoKeyframeEnum
|
|
70
70
|
start: number
|
|
71
71
|
end: number
|
|
@@ -104,7 +104,7 @@ export type VreoKeyframeEvent = { [key in VreoKeyframeEnum]: (keyframe: VreoKeyf
|
|
|
104
104
|
// 新数据载入完成
|
|
105
105
|
loaded: (vreoUnit: VreoUnit) => void
|
|
106
106
|
// 语音状态 播放 -> 暂停
|
|
107
|
-
paused: () => void
|
|
107
|
+
paused: (ended?: boolean) => void
|
|
108
108
|
// 语音状态 暂停 -> 播放
|
|
109
109
|
playing: () => void
|
|
110
110
|
// 未知的 剧本帧类型
|
|
@@ -115,7 +115,8 @@ export type VreoKeyframeEvent = { [key in VreoKeyframeEnum]: (keyframe: VreoKeyf
|
|
|
115
115
|
* 相机运动
|
|
116
116
|
*/
|
|
117
117
|
export type CameraMovementData = {
|
|
118
|
-
effect
|
|
118
|
+
effect?: CameraMovementEffect
|
|
119
|
+
transEffect?: "fly" | "fade" | "instant"
|
|
119
120
|
mode: Mode
|
|
120
121
|
panoIndex: number
|
|
121
122
|
loop?: boolean
|