Play Music is a mouse-driven audio player built into CookieOS that streams DFPWM-encoded tracks from a remote API directly to a CC:TweakedDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/PrinceOfCookies/CookieOS/llms.txt
Use this file to discover all available pages before exploring further.
speaker peripheral. It supports a live search interface, a playback queue, loop mode, and skip controls — all accessible without a keyboard once a search has been submitted.
Prerequisites
A CC:Tweakedspeaker peripheral must be physically attached to the computer before launching Play Music. If no speaker is detected, the program exits immediately with an error. In the Programs menu, the “Play Music” entry is shown in red text when no speaker peripheral is present.
API Backend
Play Music communicates with a hosted audio service at:| Operation | Endpoint |
|---|---|
| Search for tracks | ?search=<url-encoded query> |
| Download a track | ?id=<trackId> |
http.request(). Track downloads use http.request() with binary = true. The raw binary response is decoded on the fly using cc.audio.dfpwm.make_decoder() and fed to speaker.playAudio() in 16 KB chunks.
Interface
The player UI is split into two tabs, switchable by clicking the left or right half of the top bar.Now Playing Tab
Displays the current track name (white text) and artist (light-grey text). When nothing is loaded, the label reads “Not playing”. Below the track info, three buttons appear on the same row:| Button | Behaviour |
|---|---|
| Play / Stop | Starts playback of the current track or stops and resets the decoder. Greyed out when no track or queue is present. |
| Skip | Advances to the next track in the queue. If the queue is empty and no track is playing, it clears now_playing. |
| Loop | Toggles loop mode. When active, the button is displayed with a white background and black text to indicate it is on. When loop is on, the current track restarts instead of advancing the queue. |
Search Tab
Contains a search bar (rows 3–5) and a results list below it.Open the search bar
Click anywhere in the light-grey search bar area. The bar turns white and a standard
read() prompt appears.Type your query and press Enter
The query is URL-encoded and sent to the API. The bar reverts to showing the last search term and a “Searching…” label appears while the HTTP request is in flight.
Browse results
Results appear as a list of song name / artist pairs. Click either line of a result to open the song options screen.
Choose an action
A full-screen options overlay replaces the search view with four choices:
| Option | Effect |
|---|---|
| Play now | Sets the song as now_playing and starts playback immediately. |
| Play next | Inserts the song at the front of the queue (table.insert(queue, 1, ...)). |
| Add to queue | Appends the song to the end of the queue. |
| Cancel | Dismisses the overlay and returns to search results. |
Playback Controls Summary
All controls are mouse-driven. Keyboard input is only used when typing a search query.| Control | Location |
|---|---|
| Switch tab | Click left half (Now Playing) or right half (Search) of the top bar |
| Play / Stop | Click the Play or Stop button on the Now Playing tab |
| Skip | Click the Skip button on the Now Playing tab |
| Loop toggle | Click the Loop button on the Now Playing tab |
| Open search | Click the search bar on the Search tab |
| Select a result | Click the song name or artist row in the results list |
Queue Behaviour
Songs in the queue are stored in a Lua table and played in order. When the current track’s DFPWM stream reaches its end:- If loop mode is on,
playing_idis set tonil, causing the same track to be re-downloaded and restarted. - If loop mode is off and the queue has entries, the first entry becomes
now_playingand is removed from the queue. - If loop mode is off and the queue is empty,
now_playingis cleared and playback stops.
The Programs menu displays “Play Music” in red text if no
speaker peripheral is detected at launch time. Attaching a speaker and re-opening the Programs menu will restore the normal white text.