File tree 3 files changed +14
-11
lines changed
3 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -220,7 +220,6 @@ export class Scene2D extends GeneratorScene<View2D> implements Inspectable {
220
220
221
221
for ( const media of mediaNodes ) {
222
222
media . setVolume ( media . getVolume ( ) * volumeScale ) ;
223
- console . log ( media . key ) ;
224
223
}
225
224
}
226
225
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ interface RevideoPlayerProps {
14
14
height ?: number ;
15
15
quality ?: number ;
16
16
fps ?: number ;
17
+ volume ?: number ;
17
18
}
18
19
19
20
declare global {
@@ -140,19 +141,18 @@ export function Player({
140
141
const handlePlayerResize = useCallback (
141
142
( entries : ResizeObserverEntry [ ] ) => {
142
143
const [ firstEntry ] = entries ;
143
- if ( ! firstEntry || ! wrapperRef . current ) {
144
+ if ( ! firstEntry || ! wrapperRef . current || ! lastRect . current ) {
144
145
return ;
145
146
}
146
147
147
148
const newRect = firstEntry . contentRect ;
148
- const sameWidth = newRect . width === lastRect . current . width ;
149
- const sameHeight = newRect . height === lastRect . current . height ;
150
- if ( lastRect . current && sameWidth && sameHeight ) {
151
- return ;
149
+ if (
150
+ newRect . width !== lastRect . current . width ||
151
+ newRect . height !== lastRect . current . height
152
+ ) {
153
+ lastRect . current = newRect ;
154
+ onPlayerResize ( newRect ) ;
152
155
}
153
-
154
- lastRect . current = newRect ;
155
- onPlayerResize ( newRect ) ;
156
156
} ,
157
157
[ onPlayerResize ] ,
158
158
) ;
@@ -234,6 +234,7 @@ export function Player({
234
234
height = { height }
235
235
quality = { quality }
236
236
fps = { fps }
237
+ volume = { volumeState }
237
238
/>
238
239
< div
239
240
className = { `p-absolute p-bottom-0 p-w-full p-transition-opacity p-duration-200 ${
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ class RevideoPlayer extends HTMLElement {
48
48
'quality' ,
49
49
'width' ,
50
50
'height' ,
51
+ 'volume' ,
51
52
] ;
52
53
}
53
54
@@ -99,7 +100,7 @@ class RevideoPlayer extends HTMLElement {
99
100
private duration : number = 0 ; // in frames
100
101
private looping = true ;
101
102
private volume = 1 ;
102
- private volumeChangeRequested = false ;
103
+ private volumeChangeRequested = true ;
103
104
104
105
public constructor ( ) {
105
106
super ( ) ;
@@ -110,7 +111,6 @@ class RevideoPlayer extends HTMLElement {
110
111
this . canvas = this . stage . finalBuffer ;
111
112
this . canvas . classList . add ( 'canvas' ) ;
112
113
this . root . prepend ( this . canvas ) ;
113
-
114
114
this . setState ( State . Initial ) ;
115
115
}
116
116
@@ -205,6 +205,9 @@ class RevideoPlayer extends HTMLElement {
205
205
case 'height' :
206
206
this . updateSettings ( ) ;
207
207
break ;
208
+ case 'volume' :
209
+ this . volume = newValue ;
210
+ this . volumeChangeRequested = true ;
208
211
}
209
212
}
210
213
You can’t perform that action at this time.
0 commit comments