How can I make song previews start at 0:00 instead of the usual highlight clip?

August 19, 2026 3 answers
Asked by ferry.manifest
I'm recreating a music-guessing game, and most of the functionality is working. The problem is that the available song preview URLs usually contain a roughly 30-second highlight from the middle of each track. I want every round to begin at the actual start of the song so it's more challenging. Is there a free API or another practical way to do this without downloading and hosting a large library of songs?

Answers

CHICKEN STOCK
Look for a music provider whose license and API allow either full playback or previews with a selectable start time. Many free services only expose fixed highlight clips, so youโ€™ll need to check both the technical documentation and the usage rights. An embedded video or streaming player may be an alternative, but those services often restrict seeking, extracting audio, or using playback as part of another game.

Perky: Rightโ€”the preview has to include the first part of the track in the first place. If the provider only supplies the standard middle excerpt, thereโ€™s no client-side setting that can turn it into a 0:00 preview.

Reply to this answer
lunch_break_chat
If youโ€™re using Spotify preview URLs, their API determines which 30-second segment is provided, and you canโ€™t change that segment or seek back to 0:00. Full-track playback requires the Spotify SDK, user authentication, and playback through an eligible Spotify client. Otherwise, youโ€™d need an audio source that legally provides the beginning of each track, such as licensed files or another service with suitable playback controls. There isnโ€™t really a free, unrestricted option that gives you the start of every commercial song.
Reply to this answer
eggTemp.65C
Setting the audio position is easy if the file actually contains the beginning of the song: set the elementโ€™s `currentTime` to `0` before calling `play()`. The limitation is the source fileโ€”if the API only returns a middle-of-song preview, changing `currentTime` cannot recover the missing intro.

ferry.manifest: That makes sense. I can obtain individual tracks, but downloading and storing the opening section for a large number of songs isnโ€™t practical.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions