Skip to content

Streaming tracks

A playlist can contain "streaming" tracks, where the audio is streamed from a URL when the track is played.

This is useful if you want to create dynamic content that changes all the time, like weather updates.

How to create a streaming track

The trackUrl property should be set to the URL that hosts the audio, as well as the following parameters:

In the track object:

  • the isNew property should be added to the track object
  • the type property should be set to stream
  • the format property should be set to the format of the stream, for example mp3 or aac

In the content object:

  • the transcodeAudioUploads property should be added to an editSettings

Here is an example of a complete JSON object containing a streaming track:

js
const chapters = [
  {
    key: "01",
    title: "Your card title",
    overlayLabel: "1",
    tracks: [
      {
        key: "01",
        type: "stream",
        format: "mp3",
        title: "Your track title",
        trackUrl: "https://your-audio-stream-url.com/stream.mp3",
        isNew: true,
        display: {
          icon16x16: "yoto:#ZuVmuvnoFiI4el6pBPvq0ofcgQ18HjrCmdPEE7GCnP8",
        },
      },
    ],
    duration: 0,
    hasStreams: true,
    fileSize: 0,
    display: {
      icon16x16: "yoto:#ZuVmuvnoFiI4el6pBPvq0ofcgQ18HjrCmdPEE7GCnP8",
    },
  },
];

const playlist = {
  // Only set the card id if you want to update an existing card
  cardId: "your-card-id",
  content: { chapters, editSettings: { transcodeAudioUploads: true } },
  metadata: { description: "Your card description" },
  title: "Your card title",
};