@@ -2561,9 +2561,27 @@ export class BloomPlayerCore extends React.Component<IProps, IPlayerState> {
25612561 setCurrentNarrationPage ( bloomPage ) ;
25622562 // State must be set before calling HandlePageVisible() and related methods.
25632563 if ( BloomPlayerCore . currentPageHasVideo ) {
2564+ const handleVideoAndMusic = ( ) => {
2565+ this . video . HandlePageVisible (
2566+ bloomPage ,
2567+ ( ) => this . props . paused ,
2568+ ) ;
2569+ this . music . pause ( ) ; // in case we have audio from previous page
2570+ } ;
25642571 setCurrentPlaybackMode ( PlaybackMode . VideoPlaying ) ;
2565- this . video . HandlePageVisible ( bloomPage , ( ) => this . props . paused ) ;
2566- this . music . pause ( ) ; // in case we have audio from previous page
2572+ if ( ! this . sentBloomNotification ) {
2573+ this . sentBloomNotification = true ; // actually we may not, but if we don't, we never want to
2574+ if ( this . props . shouldReportSoundLog ) {
2575+ // This notification allows Bloom to start recording video at the optimum moment,
2576+ // when the first page is rendered enough for us to start playing its video.
2577+ sendStringToBloomApi (
2578+ "/publish/av/startRecording" ,
2579+ this . videoList ,
2580+ ) . then ( handleVideoAndMusic ) ;
2581+ return ; // don't call handleVideoAndMusic until the post returns
2582+ }
2583+ }
2584+ handleVideoAndMusic ( ) ; // if we decided not to post to bloom api
25672585 } else {
25682586 this . playAudioAndAnimation ( bloomPage ) ;
25692587 }
0 commit comments