Fetch Datas

Playlist and preset datas from a database.

Overview

In the previous code examples, the datas for the playlists and presets was hardcoded. However, this is not always the desired way. The data can also be loaded from a database or another file, such as JSON, and then passed to the player.

The principle here is the same. It is important that the structure of the datas for the playlist and the presets is as described.

The following code is exemplary and shows how to implement this with PHP and the JavaScript fetch API. The code based on a MySQL database connection. Customize the code according to your requirements.

With PHP

The PHP file


The file with the HTML


The JavaScript file

With the JavaScript fetch API

The file with HTML


The JavaScript file


The PHP file

Next step

Enjoy the FrissBee Audio Player.