How does “My Radio 2” sync the metadata to the audio stream?
The metadata may be obtained in various ways, e.g. by running scripts, from the actual stream or by parsing an html page. Most sources will obtain metadata from the stream. This is realtime information and “My Radio 2” has been designed in such a way that the metadata and the audio is 100 percent syncronized. This is done by marking the exact position in the downloaded stream, when the metadata is updated. By calculating the difference (in milliseconds) from the actual dowload of the stream to the played back position of the stream, the latency for the metadata can be calculated. In this calculation, it is also taken into account that metadata arrives at regular intervals in the stream and thus the specific metainterval for the particular source is used to calculate the exact time to update the display with new information. If the metadata comes from a non-realtime source, such as a html-page parsing, the application will poll the metadata a regular intervals to see if it has changed.