hi all i have this code and i try to run my mp3 from my server but i get this error
list.php works but the program stops i cannot understand why the code and php out put is below
please help
list.php works but the program stops i cannot understand why the code and php out put is below
please help
[{"rdstream":"http:\/\/www.mydomainname.com\/1.mp3","rdname":"song1","rdimage":"1.jpg"},{"rdstream":"http:\/\/www.mydomainname.com\/2.mp3","rdname":"song2","rdimage":"2.jpg"},{"rdstream":"http:\/\/www.mydomainname.com\/3.mp3","rdname":"song3","rdimage":"3.jpg"},{"rdstream":"http:\/\/www.mydomainname.com\/4.mp3","rdname":"song4","rdimage":"4.jpg"}]
B4X:
#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.
Dim mp As MediaPlayerStream
Type radiopar (First As String, Second As String ,third As String )
End Sub
Sub Globals
Private BannerAd As AdView
Private IAd As InterstitialAd
Dim Label1 As Label
Dim State As Int
Dim Url As String
Dim ListView1 As ListView
Dim Station As String
Dim UrlDefiner As Int
Dim Button1 As Button
Dim Button2 As Button
Dim Button3 As Button
Dim N As Int = (Rnd (0,1) +1)
Dim L As List
Dim Stream(5) As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("mysongs")
ListView1.SingleLineLayout.Label.TextSize = "14"
If FirstTime Then
mp.Initialize("mp")
End If
Label1.Text = "Click to Listen"
setupmystream
End Sub
Sub setupradiostream As Int
Dim jobadd As HttpJob
jobadd.Initialize("mylist", Me)
jobadd.Download("http://www.mydomain.com/list.php")
ProgressDialogShow("Downloading Radio List")
End Sub
Sub JobDone (Job As HttpJob)
ProgressDialogHide
If Job.Success = True Then
Dim strReturn As String = Job.GetString
Dim parser As JSONParser
parser.Initialize(strReturn)
If Job.JobName = "mylist" Then
Dim radiolist As List
radiolist = parser.NextArray 'returns a list with maps
For i = 0 To radiolist.Size - 1
Dim m As Map
Log(i)
m = radiolist.Get(i)
Dim Stream(i) As String
Dim TL As radiopar 'TwoLines
TL.First = m.Get("rdstream")
TL.Second = m.Get("rdname")
TL.third=m.Get ("rdimage")
Stream(i)=TL.First
ListView1.AddSingleLine(TL.Second)
'Exit
Next
Else If Job.JobName = "LogOut" Then
Dim act As String = parser.NextValue
If act = "LoggedOut" Then
ToastMessageShow("Logout successful", True)
StartActivity(Main)
Activity.Finish
End If
Else
ToastMessageShow("Error: Invalid Value", True)
End If
Else
'Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
Sub IAD_AdClosed
IAd.LoadAd 'prepare a new ad
End Sub
Sub mp_StreamReady
Log("starts playing")
mp.Play
Label1.Text = "Playing - " & Station
End Sub
Sub mp_StreamError (ErrorCode As String, ExtraData As Int)
Log("Error: " & ErrorCode & ", " & ExtraData)
ToastMessageShow("Error: " & ErrorCode & ", " & ExtraData, True)
End Sub
Sub mp_StreamBuffer(Percentage As Int)
Log(Percentage)
End Sub
Sub Stop_Click
Log("stop playing")
mp.Stop
State = 2
Label1.Text = "Click a Station to Listen"
If IAd.Ready Then IAd.Show
End Sub
Sub ListView1_ItemClick (Position As Int, Value As Object)
Station = Value
UrlDefiner = Position + 1
If State = 1 Then Stop_Click
Url = Stream(UrlDefiner)
mp.Load(Url)
State = 1
Label1.Text = "Buffering"
End Sub
Sub Button1_Click
If State = 1 Then Stop_Click
End Sub