11'use client' ;
22
3- import type * as alphaTab from '@coderline/alphatab' ;
4- import React , { useEffect , useState } from 'react' ;
3+ import * as alphaTab from '@coderline/alphatab' ;
4+ import React , { useState } from 'react' ;
55import { useAlphaTab , useAlphaTabEvent } from '@site/src/hooks' ;
66import styles from './styles.module.scss' ;
77import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
88import * as solid from '@fortawesome/free-solid-svg-icons' ;
99import { openFile } from '@site/src/utils' ;
10- import { PlayerControlsGroup , SidePanel } from './player-controls-group' ;
10+ import { BottomPanel , PlayerControlsGroup , SidePanel } from './player-controls-group' ;
1111import { PlaygroundSettings } from './playground-settings' ;
1212import { Tooltip } from 'react-tooltip' ;
1313import { PlaygroundTrackSelector } from './track-selector' ;
14+ import { MediaSyncEditor } from './media-sync-editor' ;
1415
1516interface AlphaTabPlaygroundProps {
1617 settings ?: alphaTab . json . SettingsJson ;
@@ -20,12 +21,13 @@ export const AlphaTabPlayground: React.FC<AlphaTabPlaygroundProps> = ({ settings
2021 const viewPortRef = React . createRef < HTMLDivElement > ( ) ;
2122 const [ isLoading , setLoading ] = useState ( true ) ;
2223 const [ sidePanel , setSidePanel ] = useState ( SidePanel . None ) ;
24+ const [ bottomPanel , setBottomPanel ] = useState ( BottomPanel . None ) ;
2325
2426 const [ api , element ] = useAlphaTab ( s => {
2527 s . core . engine = 'svg' ;
2628 s . player . scrollElement = viewPortRef . current ! ;
2729 s . player . scrollOffsetY = - 10 ;
28- s . player . enablePlayer = true ;
30+ s . player . playerMode = alphaTab . PlayerMode . EnabledAutomatic ;
2931 if ( settings ) {
3032 s . fillFromJson ( settings ) ;
3133 }
@@ -88,7 +90,18 @@ export const AlphaTabPlayground: React.FC<AlphaTabPlaygroundProps> = ({ settings
8890 </ div >
8991
9092 < div className = { styles [ 'at-footer' ] } >
91- { api && < PlayerControlsGroup api = { api } sidePanel = { sidePanel } onSidePanelChange = { setSidePanel } /> }
93+ { api && api ?. score && bottomPanel === BottomPanel . MediaSyncEditor && (
94+ < MediaSyncEditor api = { api } score = { api ! . score } />
95+ ) }
96+ { api && (
97+ < PlayerControlsGroup
98+ api = { api }
99+ sidePanel = { sidePanel }
100+ onSidePanelChange = { setSidePanel }
101+ bottomPanel = { bottomPanel }
102+ onBottomPanelChange = { setBottomPanel }
103+ />
104+ ) }
92105 </ div >
93106 </ div >
94107 < Tooltip anchorSelect = "[data-tooltip-content]" id = "tooltip-playground" style = { { zIndex : 1200 } } />
0 commit comments