Ich überlasse Ihnen diesen Code, um einen einfachen Audioplayer zu erhalten, der für das Hören von Webradio, Audio- und Videodateien nützlich ist, mit möglicher Anzeige von Metadaten und einem einfachen Spektroskop, das auf den Ressourcen des 'GStreamer'-Audiosystems basiert.
Es ist daher notwendig, die Komponente "gb.media" zu aktivieren. gambas code
Private TextArea1 As TextArea Private DrawingArea1 As DrawingArea Private ToggleButton1 As ToggleButton Private mp As MediaPlayer Private Meta As New Collection Private ss As New String[] Public Sub Form_Open() Me.Resize(Screen.AvailableWidth * 0.33, Screen.AvailableHeight * 0.73) With TextArea1 = New TextArea(Me) .X = Me.W * 0.02 .Y = Me.H * 0.02 .W = Me.W * 0.96 .H = Me.H * 0.4 End With With DrawingArea1 = New DrawingArea(Me) .X = Me.W * 0.02 .Y = Me.H * 0.43 .W = Me.W * 0.96 .H = Me.H * 0.46 End With With ToggleButton1 = New ToggleButton(Me) As "ToggleButton1" .W = Me.W * 0.3 .X = (Me.W * 0.5) - (.W / 2) .Y = Me.H * 0.9 .H = Me.H * 0.08 .Foreground = Color.Green .Text = "Start" End With End Public Sub ToggleButton1_Click() If ToggleButton1.Value Then Dim plugVis As MediaControl Dim tipoPlug As String[] = ["goom", "monoscope", "spacescope", "spectrascope", "synaescope", "wavescope"] TextArea1.Clear With mp = New MediaPlayer As "MediaPlayer1" plugVis = New MediaControl(mp, tipoPlug[3]) .SetWindow(DrawingArea1) ' Hören wir uns ein Webradio an.... .URL = "https://icy.unitedradio.it/VirginRock70.mp3" ' Wenn wir eine Audio- oder Videodatei abspielen wollen, müssen wir die vorherige Zeile durch diese ersetzen: ' .URL = Media.URL("/Pfad/zur/Audio/oder/Videodatei") .Play .Video.Visualisation = plugVis End With ToggleButton1.Foreground = Color.Red ToggleButton1.Text = "Stop" Else mp.Stop mp.Close ToggleButton1.Foreground = Color.Green ToggleButton1.Text = "Start" Endif End Public Sub MediaPlayer1_Tag(tagList As MediaTagList) For Each tag As String In tagList.Tags If Not Meta.Exist(tag) Then Meta[tag] = tagList[tag] ss.Push(tag) ss.Push(tagList[tag]) Else ss[ss.Find(tag) + 1] = tagList[tag] Endif Next TextArea1.Clear For c As Short = 0 To ss.Max Step 2 TextArea1.Text &= ss[c] & ": " & ss[c + 1] & gb.NewLine Next End Public Sub MediaPlayer1_Position() Me.Title = Str(Time(0, 0, 0, mp.Pos * 1000)) End Public Sub MediaPlayer1_End() ToggleButton1.Value = False End