@realsee/vreo 1.0.0-alpha.2 → 1.0.0-alpha.21

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.
Files changed (127) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +46 -36
  3. package/lib/PlayController/index.js +1 -1
  4. package/lib/Player/Controller.d.ts +4 -4
  5. package/lib/Player/Controller.js +30 -17
  6. package/lib/Player/index.js +4 -1
  7. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +2 -2
  8. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +3 -3
  9. package/lib/Player/modules/VideoAgent/index.js +1 -1
  10. package/lib/Player/modules/Wave/index.js +174 -25
  11. package/lib/Player/modules/keyframes/BgMusic/index.js +54 -35
  12. package/lib/Player/modules/keyframes/PanoTag/index.js +3 -3
  13. package/lib/shared-utils/{AduioLike.d.ts → AudioLike.d.ts} +0 -0
  14. package/lib/shared-utils/{AduioLike.js → AudioLike.js} +4 -6
  15. package/lib/typings/VreoUnit.d.ts +6 -6
  16. package/package.json +2 -4
  17. package/stylesheets/default.css +11 -4
  18. package/docs/.nojekyll +0 -1
  19. package/docs/assets/custom.css +0 -78
  20. package/docs/assets/highlight.css +0 -127
  21. package/docs/assets/icons.css +0 -1043
  22. package/docs/assets/icons.png +0 -0
  23. package/docs/assets/icons@2x.png +0 -0
  24. package/docs/assets/main.js +0 -52
  25. package/docs/assets/search.js +0 -1
  26. package/docs/assets/style.css +0 -1414
  27. package/docs/assets/widgets.png +0 -0
  28. package/docs/assets/widgets@2x.png +0 -0
  29. package/docs/classes/Player.AudioLike.html +0 -52
  30. package/docs/classes/Player.Controller.html +0 -54
  31. package/docs/classes/Player.Player-1.html +0 -50
  32. package/docs/classes/Player.VideoAgentMesh.html +0 -142
  33. package/docs/classes/Player.VideoAgentScene.html +0 -1
  34. package/docs/demo/assets/AppReact.d0ee843a.js +0 -1
  35. package/docs/demo/assets/default.63925584.js +0 -3984
  36. package/docs/demo/assets/default.f3f3ca8c.css +0 -1
  37. package/docs/demo/assets/dynamic.76506c2c.js +0 -1
  38. package/docs/demo/assets/examples.3d8323db.js +0 -25
  39. package/docs/demo/assets/examples.dac4a6fe.css +0 -1
  40. package/docs/demo/assets/index.7e31122c.js +0 -1
  41. package/docs/demo/assets/index.9331038f.css +0 -1
  42. package/docs/demo/assets/main.79b11b9d.js +0 -1
  43. package/docs/demo/assets/react.2ee8565f.css +0 -1
  44. package/docs/demo/assets/react.c1c07c14.js +0 -25
  45. package/docs/demo/assets/znRoyv06SZQeqA7m.0057e8ae.js +0 -1
  46. package/docs/demo/examples.html +0 -17
  47. package/docs/demo/index-react-dynamic.html +0 -20
  48. package/docs/demo/index-react.html +0 -20
  49. package/docs/demo/index.html +0 -19
  50. package/docs/enums/Player.InfoPanelStyleEnum.html +0 -1
  51. package/docs/enums/Player.InfoPanelTypeEnum.html +0 -3
  52. package/docs/enums/Player.PanoEffectEnum.html +0 -5
  53. package/docs/enums/Player.PanoTagEnum.html +0 -3
  54. package/docs/enums/Player.PanoTagStyleEnum.html +0 -7
  55. package/docs/enums/Player.VreoKeyframeEnum.html +0 -25
  56. package/docs/enums/fivePlugins.CameraMovementEffect.html +0 -1
  57. package/docs/enums/fivePlugins.Rotation.html +0 -1
  58. package/docs/index.html +0 -245
  59. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +0 -1
  60. package/docs/interfaces/Player.PlayerConfigs.html +0 -7
  61. package/docs/interfaces/Player.Vertex.html +0 -3
  62. package/docs/interfaces/Player.VideoAgentMeshOptions.html +0 -8
  63. package/docs/interfaces/Player.VreoKeyframe.html +0 -3
  64. package/docs/interfaces/Player.VreoUnit.html +0 -3
  65. package/docs/interfaces/Player.VreoVideo.html +0 -3
  66. package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +0 -4
  67. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +0 -1
  68. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +0 -7
  69. package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +0 -1
  70. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +0 -1
  71. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +0 -1
  72. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +0 -1
  73. package/docs/interfaces/fivePlugins.Vector3Position.html +0 -3
  74. package/docs/interfaces/react.VreoActionCallbacks.html +0 -23
  75. package/docs/interfaces/react.VreoProviderProps.html +0 -1
  76. package/docs/modules/Player.html +0 -37
  77. package/docs/modules/custom.html +0 -3
  78. package/docs/modules/fivePlugins.html +0 -6
  79. package/docs/modules/react.html +0 -1
  80. package/docs/modules.html +0 -1
  81. package/resources/PlayController/createHTMLAudioElement.ts +0 -53
  82. package/resources/PlayController/index.ts +0 -154
  83. package/resources/Player/App.tsx +0 -66
  84. package/resources/Player/Controller.ts +0 -297
  85. package/resources/Player/custom/SpatialScenePanel/index.tsx +0 -264
  86. package/resources/Player/hooks.ts +0 -26
  87. package/resources/Player/index.tsx +0 -225
  88. package/resources/Player/modules/Drawer/index.tsx +0 -40
  89. package/resources/Player/modules/PopUp/index.tsx +0 -26
  90. package/resources/Player/modules/ResizeObserver/index.tsx +0 -23
  91. package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +0 -302
  92. package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +0 -56
  93. package/resources/Player/modules/VideoAgent/index.tsx +0 -53
  94. package/resources/Player/modules/Wave/index.tsx +0 -18
  95. package/resources/Player/modules/keyframes/BgMusic/index.tsx +0 -66
  96. package/resources/Player/modules/keyframes/CameraMovement/index.tsx +0 -37
  97. package/resources/Player/modules/keyframes/InfoPanel/index.tsx +0 -165
  98. package/resources/Player/modules/keyframes/ModelVideo/index.tsx +0 -77
  99. package/resources/Player/modules/keyframes/PanoEffect/index.tsx +0 -99
  100. package/resources/Player/modules/keyframes/PanoEffect/lineAnime.ts +0 -31
  101. package/resources/Player/modules/keyframes/PanoTag/index.tsx +0 -83
  102. package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +0 -117
  103. package/resources/Player/modules/keyframes/Prompter/index.tsx +0 -56
  104. package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +0 -99
  105. package/resources/Player/modules/keyframes/VideoEffect/index.tsx +0 -115
  106. package/resources/Player/typings.ts +0 -49
  107. package/resources/fivePlugins/CSS3DRenderPlugin/centerPoint.ts +0 -5
  108. package/resources/fivePlugins/CSS3DRenderPlugin/createResizeObserver.ts +0 -17
  109. package/resources/fivePlugins/CSS3DRenderPlugin/evenNumber.ts +0 -4
  110. package/resources/fivePlugins/CSS3DRenderPlugin/index.ts +0 -254
  111. package/resources/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.ts +0 -5
  112. package/resources/fivePlugins/CameraMovementPlugin/index.ts +0 -226
  113. package/resources/fivePlugins/CameraMovementPlugin/typings.ts +0 -59
  114. package/resources/fivePlugins/ModelTVVideoPlugin/index.ts +0 -278
  115. package/resources/index.ts +0 -1
  116. package/resources/react/index.tsx +0 -121
  117. package/resources/shared-utils/AduioLike.ts +0 -109
  118. package/resources/shared-utils/Preloader.ts +0 -35
  119. package/resources/shared-utils/addResizeListener.ts +0 -46
  120. package/resources/shared-utils/animationFrame/BetterTween.ts +0 -33
  121. package/resources/shared-utils/animationFrame/index.ts +0 -48
  122. package/resources/shared-utils/animationFrame/tween.ts +0 -51
  123. package/resources/shared-utils/createTransMatrix.ts +0 -12
  124. package/resources/shared-utils/getFileExpandedName.ts +0 -6
  125. package/resources/shared-utils/getMediaInfo.ts +0 -52
  126. package/resources/shared-utils/setElementDataset.ts +0 -18
  127. package/resources/typings/VreoUnit.ts +0 -314
@@ -1,154 +0,0 @@
1
- import { Subscribe } from '@realsee/five'
2
- import { requestAnimationFrameInterval } from '../shared-utils/animationFrame'
3
- import { VreoKeyframe, VreoKeyframeEvent, VreoUnit } from '../typings/VreoUnit'
4
- import { createHTMLAudioElement } from './createHTMLAudioElement'
5
-
6
- export interface PlayControllerConfig {
7
- audio?: HTMLAudioElement
8
- }
9
-
10
- const closures: Record<string, any> = {}
11
-
12
- export class PlayController extends Subscribe<VreoKeyframeEvent> {
13
-
14
- vreoUnit?: VreoUnit
15
-
16
- config: PlayControllerConfig = {}
17
- stopInterval: () => void
18
-
19
- get paused() {
20
- return this.audioInstance.paused
21
- }
22
-
23
- get audioInstance() {
24
- return this.config.audio!
25
- }
26
-
27
- get currentTime() {
28
- return this.audioInstance.currentTime * 1000
29
- }
30
-
31
- get currentKeyframes() {
32
- if (!this.vreoUnit) return []
33
- const keyframes = this.vreoUnit.keyframes
34
- // 没有被解析过且开始时间低于当前时间戳 100ms
35
- return keyframes.filter((keyframe: VreoKeyframe) => {
36
- if (keyframe.parsed) return false
37
- const dur = this.currentTime - keyframe.start
38
- return dur <= 100 && dur >= 0
39
- })
40
- }
41
-
42
- /**
43
- * 音频时长 不一定能获取得到,建议以 VreoUnit 配置的时长为准。
44
- */
45
- get duration() {
46
- return this.audioInstance.duration * 1000
47
- }
48
-
49
- constructor(config: PlayControllerConfig = {}) {
50
- super()
51
-
52
- if (!config.audio) {
53
- config.audio = createHTMLAudioElement()
54
- }
55
-
56
- this.config = Object.assign(this.config, config)
57
-
58
- closures.onPlaying = () => this.emit('playing')
59
- closures.onPaused = () => this.emit('paused')
60
- closures.onEnded = () => this.emit('paused', true)
61
-
62
- this.audioInstance.addEventListener('play', closures.onPlaying)
63
- this.audioInstance.addEventListener('pause', closures.onPaused)
64
- this.audioInstance.addEventListener('ended', closures.onEnded)
65
-
66
- this.stopInterval = requestAnimationFrameInterval(() => {
67
- if (this.audioInstance.paused) {
68
- return
69
- }
70
-
71
- if (!this.vreoUnit) {
72
- return
73
- }
74
-
75
- const keyframes = this.vreoUnit.keyframes
76
- const currentTime = this.currentTime
77
- // 没有被解析过且开始时间低于当前时间戳 100ms
78
- const currentKeyframes = keyframes.filter((keyframe: VreoKeyframe) => {
79
- if (keyframe.parsed) return false
80
-
81
- const dur = currentTime - keyframe.start
82
- return dur <= 60 && dur >= 0
83
- })
84
-
85
- currentKeyframes.forEach((keyframe) => {
86
- if (keyframe.parsed) return
87
- keyframe.parsed = true
88
- this.emit(keyframe.type, keyframe)
89
- })
90
- })
91
-
92
- }
93
-
94
-
95
-
96
- /**
97
- * 载入数据
98
- */
99
- async load(vreoUnit: VreoUnit): Promise<boolean> {
100
- this.vreoUnit = vreoUnit
101
-
102
- await this.pause()
103
- return await new Promise((resolve, reject) => {
104
- if (vreoUnit.video.url === this.audioInstance.src) {
105
- return resolve(true)
106
- }
107
-
108
- this.audioInstance.src = vreoUnit.video.url
109
- const canplaythrough = () => {
110
- resolve(true)
111
- this.audioInstance.removeEventListener('canplaythrough', canplaythrough)
112
- }
113
- const error = (err: any) => {
114
- reject(err)
115
- this.audioInstance.removeEventListener('error', error)
116
- }
117
- this.audioInstance.addEventListener('canplaythrough', canplaythrough)
118
- this.audioInstance.addEventListener('error', error)
119
- })
120
- }
121
-
122
- /**
123
- * 播放
124
- */
125
- async play() {
126
- closures.playPromise = this.audioInstance.play()
127
- }
128
-
129
- /**
130
- * 暂停
131
- */
132
- async pause() {
133
- if (closures.playPromise) {
134
- await closures.playPromise
135
- }
136
- this.audioInstance.pause()
137
- }
138
-
139
- /**
140
- * 销毁资源
141
- * @notice 一旦销毁,创建的实例将不可用:需重新创建实例。
142
- *
143
- * @deprecated **慎重执行**
144
- */
145
- dispose() {
146
- // 清理事件监听
147
- this.audioInstance.removeEventListener('play', closures.onPlaying)
148
- this.audioInstance.removeEventListener('pasue', closures.onPaused)
149
- this.audioInstance.removeEventListener('ended', closures.onEnded)
150
- if (this.stopInterval) {
151
- this.stopInterval()
152
- }
153
- }
154
- }
@@ -1,66 +0,0 @@
1
- import * as React from 'react'
2
- import classNames from 'classnames'
3
- import { observer } from 'mobx-react'
4
- import { Controller } from './Controller'
5
- import { useController } from './hooks'
6
- import { CameraMovement } from './modules/keyframes/CameraMovement'
7
- import { ResizeObserver } from './modules/ResizeObserver'
8
- import { InfoPanel } from './modules/keyframes/InfoPanel'
9
- import { ModelVideo } from './modules/keyframes/ModelVideo'
10
- import { PanoEffect } from './modules/keyframes/PanoEffect'
11
- import { PanoTag } from './modules/keyframes/PanoTag'
12
- import { PanoTextLabel } from './modules/keyframes/PanoTextLabel'
13
- import { Prompter } from './modules/keyframes/Prompter'
14
- import { UpdateVRPanorama } from './modules/keyframes/UpdateVRPanorama'
15
- import { VideoEffect } from './modules/keyframes/VideoEffect'
16
- import { VideoAgent } from './modules/VideoAgent'
17
- import { BgMusic } from './modules/keyframes/BgMusic'
18
- import { Wave } from './modules/Wave'
19
-
20
- const AppView = observer(({ controller }: { controller: Controller }) => {
21
-
22
- return (
23
- <div
24
- className={classNames('vreo-panel', {
25
- 'vreo-panel--hidden': !controller.visible,
26
- })}
27
- >
28
- <div className="vreo-panel-inner">
29
- {controller.waveAppearance && <Wave appearance={controller.waveAppearance}/>}
30
- <VideoAgent
31
- onClick={() => {
32
- if (controller.playing) {
33
- controller.setPlaying(false)
34
- } else {
35
- controller.setPlaying(true)
36
- }
37
- }}
38
- options={controller.configs?.videoAgentMeshOptions || {}}
39
- />
40
- <Prompter />
41
- {controller.configs?.customPanelChildren}
42
- </div>
43
- </div>
44
- )
45
- })
46
-
47
- export function App() {
48
- const controller = useController()
49
- return (
50
- <>
51
- <>
52
- <ResizeObserver />
53
- <CameraMovement />
54
- <ModelVideo />
55
- <UpdateVRPanorama />
56
- <VideoEffect />
57
- <PanoTag />
58
- <PanoTextLabel />
59
- <InfoPanel />
60
- <PanoEffect />
61
- <BgMusic />
62
- </>
63
- <AppView controller={controller} />
64
- </>
65
- )
66
- }
@@ -1,297 +0,0 @@
1
- import { Five, Subscribe } from '@realsee/five'
2
- import { action, computed, makeObservable, observable, reaction } from 'mobx'
3
- import * as React from 'react'
4
- import { requestAnimationFrameInterval } from '../shared-utils/animationFrame'
5
- import { VreoKeyframe, VreoKeyframeEnum, VreoKeyframeEvent, VreoUnit, VreoVideo } from '../typings/VreoUnit'
6
- import { VideoAgentScene } from './modules/VideoAgent/VideoAgentScene'
7
- import { Appearance, PlayerConfigs, WaveAppearance } from './typings'
8
- import setElementDataset from '../shared-utils/setElementDataset'
9
- import { getMediaType } from '../shared-utils/getMediaInfo'
10
-
11
- /**
12
- * 逻辑控制器:内部状态。
13
- */
14
- export class Controller extends Subscribe<VreoKeyframeEvent> {
15
-
16
- five: Five
17
- configs: PlayerConfigs
18
- videoAgentScene?: VideoAgentScene
19
- vreoUnit?: VreoUnit
20
- stopInterval?: () => void
21
- playing = false
22
- ended = false
23
- loading: boolean | null = false // null 表示加载失败
24
- containerSize?: {
25
- width: number
26
- height: number
27
- }
28
- appSize?: 'S' | 'M' | 'L' | 'XL'
29
- container: Element
30
- waveAppearance: WaveAppearance | null = null
31
- appearance: Appearance = {
32
- waveStyle: 'solid',
33
- }
34
- avatar?: VreoVideo['avatar']
35
-
36
-
37
- visible = false
38
-
39
- get agentType() {
40
- const type = getMediaType(this.videoAgentScene?.videoAgentMesh.videoUrl)
41
- if (this.avatar?.force) return 'avatar'
42
- if (type === 'video') return 'video'
43
- return 'none'
44
- }
45
-
46
- popUp: string | JSX.Element | null = null
47
-
48
- openPopUp(popUp: string | JSX.Element | false) {
49
- if (!popUp) {
50
- this.popUp = null
51
- return
52
- }
53
- this.popUp = popUp
54
- }
55
-
56
- setLoading(loading: boolean | null) {
57
- this.loading = loading
58
- }
59
-
60
- drawerConfig: {
61
- content: string | JSX.Element
62
- height?: number | string
63
- } | null = null
64
-
65
- setAvatar(avatar: VreoVideo['avatar']) {
66
- this.avatar = avatar
67
- }
68
-
69
- setContainerSize(width: number, height: number) {
70
- this.containerSize = { width, height }
71
- }
72
-
73
- setVisible(v: boolean) {
74
- this.visible = v
75
- }
76
-
77
- setPlaying(playing: boolean) {
78
- this.playing = playing
79
- }
80
-
81
- setEnded(ended: boolean) {
82
- this.ended = ended
83
- }
84
-
85
- setAppearance(appearance: Appearance) {
86
- this.appearance = { ...this.appearance, ...appearance }
87
- }
88
-
89
- openDrawer(drawerConfig?: false | { content: string | JSX.Element; height?: number | string }) {
90
- if (!drawerConfig) {
91
- this.drawerConfig = {
92
- content: '',
93
- height: this.drawerConfig?.height
94
- }
95
- return
96
- }
97
-
98
- this.drawerConfig = drawerConfig
99
- }
100
-
101
- constructor({five, container, configs}: { five: Five, container: Element, configs: PlayerConfigs }) {
102
- super()
103
-
104
- this.configs = configs
105
- this.container = container
106
- this.five = five
107
- this.appSize = configs.appSize
108
- this.appearance = { ...this.appearance, ...configs.appearance }
109
-
110
- makeObservable(this, {
111
- visible: observable,
112
- setVisible: action,
113
- playing: observable,
114
- setPlaying: action,
115
- loading: observable,
116
- setLoading: action,
117
- popUp: observable.ref,
118
- openPopUp: action,
119
- drawerConfig: observable.ref,
120
- openDrawer: action,
121
- ended: observable,
122
- waveAppearance: observable,
123
- avatar: observable,
124
- containerSize: observable,
125
- setContainerSize: action,
126
- appearance: observable,
127
- setAppearance: action,
128
- configs: observable.ref,
129
- setEnded: action,
130
- setAvatar: action,
131
- })
132
-
133
- reaction<[typeof this.appearance.waveStyle, boolean | null], boolean>(
134
- () => [this.appearance.waveStyle, this.loading],
135
- ([waveStyle, loading]) => {
136
- if (loading === null) {
137
- this.waveAppearance = null
138
- return
139
- }
140
- if (waveStyle === 'wave') {
141
- switch (loading) {
142
- case true:
143
- this.waveAppearance = 'double'
144
- break
145
- case false:
146
- this.waveAppearance = 'solid'
147
- break
148
- }
149
- } else if (waveStyle === 'solid') {
150
- switch (loading) {
151
- case true:
152
- this.waveAppearance = 'swap'
153
- break
154
- case false:
155
- this.waveAppearance = 'expand'
156
- break
157
- }
158
- }
159
- },
160
- { fireImmediately: true }
161
- )
162
-
163
- if (!this.appSize) {
164
- reaction(
165
- () => this.containerSize,
166
- (containerSize) => {
167
- if (!containerSize) return
168
- const width = containerSize.width
169
- const height = containerSize.height
170
- const size = (() => {
171
- if (width <= 500) return 'S'
172
- if (width <= 1024) return 'M'
173
- if (width <= 2048) return 'L'
174
- return 'XL'
175
- })()
176
- const orientation = (() => {
177
- if (height > width) return 'portrait'
178
- return 'landscape'
179
- })()
180
- setElementDataset(this.container, { size })
181
- setElementDataset(this.container, { orientation })
182
- },
183
- { fireImmediately: true }
184
- )
185
- } else {
186
- setElementDataset(this.container, { size: this.appSize })
187
- }
188
-
189
- // 监听播放情况:抛出触发时机
190
- reaction(
191
- () => this.ended,
192
- (ended) => {
193
- if (ended) {
194
- this.emit('paused', true)
195
- }
196
- }
197
- )
198
-
199
- reaction(
200
- () => this.playing,
201
- (playing) => {
202
- if (!this.ended) {
203
- this.emit(playing ? 'playing' : 'paused')
204
- }
205
- }
206
- )
207
-
208
- }
209
-
210
- get ready() {
211
- return !!this.videoAgentScene
212
- }
213
-
214
- get currentTime() {
215
- return this.videoAgentScene?.videoAgentMesh.currentTime || 0
216
- }
217
-
218
- get currentKeyframes() {
219
- if (!this.vreoUnit) return []
220
- const keyframes = this.vreoUnit.keyframes
221
- // 没有被解析过且开始时间低于当前时间戳 100ms
222
- return keyframes.filter((keyframe: VreoKeyframe) => {
223
- if (keyframe.parsed) return false
224
- const dur = this.currentTime - keyframe.start
225
- return dur <= 100 && dur >= 0
226
- })
227
- }
228
-
229
- get mediaInstance() {
230
- return this.videoAgentScene?.videoAgentMesh.mediaInstance
231
- }
232
-
233
- /**
234
- * 逐帧任务
235
- */
236
- requestAnimationFrameLoop(callback: (type: VreoKeyframeEnum, keyframe: VreoKeyframe) => void) {
237
- if (this.mediaInstance?.ended) {
238
- this.setEnded(true)
239
- this.setPlaying(false)
240
- this.mediaInstance.pause()
241
- return
242
- }
243
-
244
- if (!this.playing) {
245
- if (!this.mediaInstance?.paused) {
246
- this.mediaInstance?.pause()
247
- }
248
- return
249
- }
250
-
251
- if (this.mediaInstance?.paused && this.playing) {
252
- this.mediaInstance.play()
253
- }
254
-
255
- const currentKeyframes = this.currentKeyframes
256
-
257
- currentKeyframes.forEach((keyframe) => {
258
- if (keyframe.parsed) return
259
- keyframe.parsed = true
260
- this.emit(keyframe.type, keyframe)
261
- if (callback) {
262
- callback(keyframe.type, keyframe)
263
- }
264
- })
265
- }
266
-
267
- run(callback: (type: VreoKeyframeEnum, keyframe: VreoKeyframe) => void) {
268
- if (this.stopInterval) return
269
- this.stopInterval = requestAnimationFrameInterval(() => this.requestAnimationFrameLoop(callback))
270
- }
271
-
272
- dispose() {
273
- this.setPlaying(false)
274
-
275
- if (this.currentKeyframes) {
276
- this.currentKeyframes.forEach((keyframe) => (keyframe.parsed = false))
277
- }
278
-
279
- /**
280
- * 清理掉数据
281
- */
282
- this.vreoUnit = undefined
283
- if (this.mediaInstance) {
284
- this.mediaInstance.currentTime = 0
285
- }
286
-
287
- if (this.stopInterval) {
288
- this.stopInterval()
289
- this.stopInterval = undefined
290
- }
291
- }
292
- }
293
-
294
- const ControllerContext = React.createContext<Controller | null>(null)
295
-
296
- export { ControllerContext }
297
-