File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ export default class SimpleExample extends React.Component {
99 videoId = "bQQVybyIk5E"
1010 width = "560"
1111 height = "315"
12- onVolumeChange = { ( v ) => console . log ( v ) }
1312 > </ YouTubeVideo >
1413 </ div >
1514 )
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export default class YouTubeVideo extends Component {
3131 return this . player . getCurrentTime ( ) * 1000 ;
3232 }
3333
34- startVideoStateObserver = ( t ) => {
34+ callChangeHandlers ( ) {
3535 const currentPosition = this . getCurrentTimeInMs ( ) ;
3636 const currentVolume = this . player . isMuted ( ) ? 0 : this . player . getVolume ( ) ;
3737 if ( this . lastSentVolume != currentVolume ) {
@@ -42,6 +42,10 @@ export default class YouTubeVideo extends Component {
4242 this . lastSentPosition = currentPosition ;
4343 this . props . onProgress ( currentPosition ) ;
4444 }
45+ }
46+
47+ startVideoStateObserver = ( t ) => {
48+ if ( this . player ) this . callChangeHandlers ( ) ;
4549 window . requestAnimationFrame ( this . startVideoStateObserver ) ;
4650 }
4751
@@ -152,7 +156,7 @@ export default class YouTubeVideo extends Component {
152156 }
153157 }
154158
155- if ( ! isNaN ( this . props . volume ) && prevProps . volume !== this . props . volume ) {
159+ if ( prevProps . volume !== this . props . volume ) {
156160 this . setPlayerVolume ( this . props . volume ) ;
157161 }
158162
You can’t perform that action at this time.
0 commit comments