[Gambas-user] Icecast catching metadata using gambas

vuott at tutanota.com vuott at tutanota.com
Wed Nov 8 18:31:25 CET 2023


About MediaPlayer, you have to use its "__Tag()" Event.
Example with a web-radio:

[code]
Private mp As MediaPlayer


Public Sub ToggleButton1_Click()

  If ToggleButton1.Value Then
    TextArea1.Clear
    With mp = New MediaPlayer As "MediaPlayer1"
      .URL = "https://live.ideastream.org/wksu3.mp3.128"
      .Play
    End With 
    While mp.Pos < 0.1
      Wait 0.01
    Wend
    While mp.State == Media.Playing
     Me.Title = Str(Time(0, 0, 0, mp.Pos * 1000))      Wait 0.1
    Wend
  Else
    mp.Stop
    mp.Close
  Endif

End

Public Sub MediaPlayer1_Tag(tagList As MediaTagList)
 
Dim tag As String

For Each tag In tagList.Tags
   TextArea1.Text &= tag & " -> " & tagList[tag] & gb.NewLine
Next

End
[/code]







8 nov 2023, 15:36 da mbelmonte at belmotek.net:

> Hi,
>
> I try to get metadata from a stream source with
>
> $ curl -H "Icy-MetaData:1" -v "https://stream.io/thestream.mp3" >/dev/null
>
> Then I get this:
>
> ...
>
>> Icy-MetaData:1
>>
>
> < icy-br:192
> < icy-description: Description of the stream
> < icy-genre:Radio
> < icy-name:Name of the stream
> < icy-pub:1
> < icy-url:http://stream.io
> < icy-metaint:16000
>
> ...
>
> But i want to know the tag "StreamTitle" but it is not present. Ii I use mpg123 for the same stream URL I get the info:
>
> $ mpg123 https://stream.io/thestream.mp3
> ...
>
> ICY-NAME: xxxxxx
> ICY-URL: http://stream.io
> MPEG 1.0 L III cbr192 48000 j-s
> ICY-META: StreamTitle='This is the title';
>
> So it is possible to access to all the metadata of the stream in gambas? Gstramer maybe?
>
> I try to get some info from MediaPlayer class without success.
>
> Sample:
>
> $Media = New MediaPlayer As "Player"
> $Media.URL = "http://ec3.yesstreaming.net:4500/stream"
>
> Thanks.
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231108/5abde9d2/attachment.htm>


More information about the User mailing list