You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/audio-video-sync.mdx
+178-3Lines changed: 178 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,6 @@
2
2
title: Audio & Video Sync
3
3
---
4
4
5
-
> [!WARNING]
6
-
> This guide is still incomplete and is currently being extended.
7
-
8
5
alphaTab can be synchronized with an external audio or video backing track. You can either use Guitar Pro 8 files with an audio track or synchronize alphaTab with an external media using the
9
6
[Media Sync Editor in the Playground](/docs/playground/playground.mdx).
10
7
@@ -34,6 +31,15 @@ Beside that you can load Guitar Pro 8 files and directly benefit from the enhanc
34
31
### Custom External Media Player
35
32
36
33
alphaTab can be integrated with any external media system but it requires some implementation on the integrator side. To properly synchronize alphaTab and an external media source (audio or video) the `alphaTab.synth.IExternalMediaHandler` interface has to be implemented and provided to alphaTab.
34
+
Beside that, alphaTab has to be informed about the time updates on the external media (e.g. during playback and seeking). This update should happen at a rate smaller than two subsequent notes. 50ms updates have shown to work well on even fast songs, but to save power and battery you might want to handle this dynamically.
35
+
36
+
The following example illustrates a full integration with a HTML Media Element like `<audio />` or `<video />`. This should be a good reference on how to implement the related sync with your media player.
37
+
Most things should be quite obvious like syncing volume, playback speed and providing the time and duration.
@@ -46,3 +52,172 @@ Some key reasons behind this is:
46
52
47
53
Nevertheless we want to give you some guidance on how to link alphaTab to YouTube. The following steps show how to use the [YouTube Player API Reference for iframe Embeds](https://developers.google.com/youtube/iframe_api_reference) together with alphaTab.
48
54
55
+
56
+
```js
57
+
// assuming a <div id="youtube"></div> somewhere
58
+
59
+
60
+
//
61
+
// 1. load the YouTube IFrame API. we use promises to have a bit better control over the initialization sequence
> > Seeks to a specified time in the video. If the player is paused when the function is called, it will remain paused. If the function is called from another state (playing, video cued, etc.), the player will play the video.
180
+
>
181
+
> alphaTab might initially do some seeking to the start position. This can cause the video to directly start playing which you might not want.
182
+
> To workaround this problem you could adjust the handler to check the player state and react accordingly.
0 commit comments