Hi!
I want to play the Audiostream "https://s10.streamingcloud.online:13192/mobil" and like to use MediaPlayerStream.
It works only once. Now I got the COMPLETE Event after start and nothing runs.
Other Option is to use EXOPlayer, but I want to avoid then effort.
Thanks for any ideas ?
Martin
Here my Testcode:
I want to play the Audiostream "https://s10.streamingcloud.online:13192/mobil" and like to use MediaPlayerStream.
It works only once. Now I got the COMPLETE Event after start and nothing runs.
Other Option is to use EXOPlayer, but I want to avoid then effort.
Thanks for any ideas ?
Martin
Here my Testcode:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private myStream As MediaPlayerStream
Private isPlayingStream As Boolean = False
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
Public streamURL As String = "https://s10.streamingcloud.online:13192/mobil"
Dim myButton As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime = True Then
myButton.Initialize ("myButton")
Activity.AddView(myButton, 0, 0, 100%x, 40dip)
myButton.Visible = True
End If
End Sub
Sub myButton_click
myStream.Initialize("myStream")
If isPlayingStream = False Then
PlayStream
Else
Log("Stream läuft bereits.")
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub myStream_Complete
Log("Stream wurde unterbrochen.")
'myStream.Stop
' StopStream
' Sleep (500) ' Optional: Stream neu starten oder stoppen
' PlayStream
End Sub
Sub myStream_Error (ErrorCode As Int, Extra As Int) As Boolean
Log($"Fehler im MediaPlayerStream: ErrorCode=${ErrorCode}, Extra=${Extra}"$)
isPlayingStream = False
DoEvents
PlayStream
Return True
End Sub
Sub PlayStream
Try
myStream.Load(streamURL)
myStream.Play
isPlayingStream = True
Log("Stream gestartet: " & streamURL)
Catch
Log("Fehler beim Starten des Streams")
isPlayingStream = False
End Try
End Sub
Sub StopStream
If myStream.IsPlaying Then
myStream.Stop
End If
isPlayingStream = False
Log("Stream gestoppt.")
End Sub
Last edited: