- First, you need to enable the "Audio" switch in "Settings" tab of the web portal
- Create a new app
- Upload the MP3 file as asset in the "Assets" tab (maximum file size: 3 MB)
- Include the "audio.h" file at "Code" tab
Code: Select all
#include "audio.h"
- Declare a global variable "AudioPlayer"
Code: Select all
AudioPlayer* __player;
- Implement the __show method as follows
Code: Select all
void __show() { __player = new AudioPlayer("/my_mp3.mp3"); __player->play(); }
- Implement the __hide method as follows
Code: Select all
void __hide() { __player->stop(); delete(__player); }
- Implement the __loop method as follows
Code: Select all
void __loop() { __player->loop(); }
The TWatchBuilder Team