Streaming Radio Player, that never stops (Itoo)

We are going to create a streaming radio player that never stops unless we press "Stop", taking advantage of the possibilities offered by the Itoo Extension

For this we will use the following components

componentes

When you start the app with Web1.Get, it will download a radio list in m3u8 format, from which we will extract the title data of the radio station and its link (in this case it is a list of Spanish streaming radios).

You can see the process of extracting data and presenting it in a Listview in the .aia file since the purpose of this tutorial is how to use the service so that streaming playback does not stop.

Part of the activity

play

  • When you press the Play button, check that a station has previously been selected in the listview
  • It is verified that the service is stopped
  • Later we create the shared variable "radio", where we store the link of the station
  • The service starts with the notification with the title "Play Radio" and subtitle the name of the station, the "radia" procedure starts.

Pause

By pressing the Pause button it is checked whether it is already active or not, if it is active we create the shared variable "resume" as true, if it is not active we create the shared variable "pause" as true

Stop

By pressing the button, do the following:

  • Shared variable "pause" to false
  • Shared variable "resume" to false
  • Shared variable "stop" to true

Part of the service

radia

  • We initialize the Clock1 and Player1 components
  • Player source, the one indicated in the shared variable "radio"
  • We start the player
  • We register the Clock1.Timer eventor with the "data" procedure

data

  • If the shared variable "pause" is true, we pause the player and declare the shared variable "pause" to false
  • If the shared variable "resume" is true, we set the player to start and declare the shared variable "resume" to false
  • If the shared variable "stop" is true, we stop the player, we declare the shared variable "stop" to false, we stop the clock and the service.

Don't forget if your mobile is a Xiaomi or Samsung, set the battery saving to "No Restrictions"

Un saludo

radioweb.aia (79,5 KB)

5 Likes

It's simply wonderful what you are able to do with Itoo

4 Likes

Users may wish to know the source of the music feeds:
appears to be : https://www.tdtchannels.com . I imagine other feeds are possible.
Thanks for the example.

The list used is completely free and can be used by anyone, as indicated by the creator of the list on their website.

I suppose any list in m3u8 format would do, adapting the parsing a little

Sure, here's a simple example of a list in M3U8 format:

#EXTM3U
#EXTINF:-1 tvg-id="channel1" tvg-name="Channel 1" tvg-logo="channel1.png" group-title="Entertainment",Channel 1
http://example.com/channel1_stream

#EXTINF:-1 tvg-id="channel2" tvg-name="Channel 2" tvg-logo="channel2.png" group-title="Entertainment",Channel 2
http://example.com/channel2_stream

#EXTINF:-1 tvg-id="channel3" tvg-name="Channel 3" tvg-logo="channel3.png" group-title="News",Channel 3
http://example.com/channel3_stream

This is a basic example of an M3U8 playlist containing three channels. Each channel has a name (Channel 1, Channel 2, Channel 3), a logo specified by tvg-logo, and a stream URL. You can save this text in a file with a .m3u8 extension, and it should be compatible with any M3U8 player.

Remember to replace http://example.com/channelX_stream with the actual stream URLs. The tvg-logo attribute specifies the URL or path to the logo image for each channel. You can replace channel1.png, channel2.png, etc., with the appropriate image filenames or URLs.