Hi all
i have a streaming media application that i am building and i would like to display the postition in (0:00) format but for some reason mp.Position is not supported in MediaPlayerStream but it is in MediaPlayer.
Code
B4X:
Sub timer1_Tick
If mp.IsPlaying Then
lblPosition.Text = ConvertToTimeFormat(mp.Position) & " / " & ConvertToTimeFormat(mp.Duration)
End If
End Sub
'converts milliseconds to m:ss format.
Sub ConvertToTimeFormat(ms As Int) As String
Dim seconds, minutes As Int
seconds = Round(ms / 1000)
minutes = Floor(seconds / 60)
seconds = seconds Mod 60
Return NumberFormat(minutes, 1, 0) & ":" & NumberFormat(seconds, 2, 0) 'ex: 3:05
End Sub