How to Create an Audio Player Playlist from an XML File

Plugin:

Wonder Audio Player Version 12.2 or later

Tutorial:

This tutorial will guide you on how to create an audio player from an XML file using the Wonder Audio Player plugin.

Step 1 - Create an XML file

Using XML allows you to define an audio player playlist directly from URLs. For example, if your MP3 files are hosted on Amazon S3, you can use an XML file to define the MP3 URLs and add them to the audio player.

An XML file is simply a text file that can be edited using a text editor or an XML editor, such as Microsoft's free and open-source XML Notepad.

The format of the XML file for the Wonder Audio Player plugin is as follows:

<list>
  <track>
    <mp3>https://www.wonderplugin.com/media/prideandprejudice_01.mp3</mp3>
    <title>Pride and Prejudice Chapter 1</title>
  </track>
  <track>
    <mp3>https://www.wonderplugin.com/media/prideandprejudice_02.mp3</mp3>
    <title>Pride and Prejudice Chapter 2</title>
  </track>
  <track>
    <mp3>https://www.wonderplugin.com/media/prideandprejudice_03.mp3</mp3>
    <title>Pride and Prejudice Chapter 3</title>
  </track>
  <track>
    <mp3>https://www.wonderplugin.com/media/prideandprejudice_04.mp3</mp3>
    <title>Pride and Prejudice Chapter 4</title>
  </track>
  <track>
    <mp3>https://www.wonderplugin.com/media/prideandprejudice_05.mp3</mp3>
    <title>Pride and Prejudice Chapter 5</title>
  </track>
</list>

The above XML adds five tracks to the player. The available XML keys are as follows:

Key Description
mp3 The mp3 URL
title Title
image The image of the audio
artist Artist
album Album
info Extra information
duration Duration in seconds

Step 2 - Upload the XML file to your web server and add the XML file to the plugin

After you have created the XML file, upload it to your web server using FTP or another method, and get the URL address.

Please note that while the MP3 URLs can be hosted on different domains, the XML file must be uploaded to the same web server as your WordPress site. The domain in the XML file URL needs to be exactly the same as the WordPress site domain, including the same protocol and prefix. For example, http://www.wonderplugin.com, https://www.wonderplugin.com and https://wonderplugin.com are all different domains.

After you get the XML URL address, you can open it in your web browser to ensure the URL is working and the XML output is correct.

Once you have confirmed that the XML URL is correct, in the Wonder Audio Player plugin, edit an existing audio player or create a new one. Navigate to Step 3, the Options tab, then to the Advanced Options tab, and add the following code into the Data Options input box:

data-xml="https://www.wonderplugin.com/test/audio-playlist.xml"

Please make sure to replace the XML URL with your own. And as mentioned above, the XML file must be uploaded to your own WordPress website.

An online demo created with the XML file above is as follows: