Android Question StreamBuffer Percent Error

shashkiranr

Active Member
Licensed User
Longtime User
Hi,

Im using MediaPlayerStream to stream an audio from internet. Everything works but the percentage buffered retrieved in the sub
B4X:
Sub Audio_Stream_StreamBuffer(Percentage As Int)
    Log(Percentage)
End Sub
is always 0... i tried with different mp3 files and still it shows 0 but the audio streams properly.

I tried the same links using a sample project obtained from internet in eclipse and i get the proper stream percentage.

Is this a bug in B4A ?

Regards,
SK
 

shashkiranr

Active Member
Licensed User
Longtime User
Here is the code Erel

B4X:
Sub Process_Globals
End Sub

Sub Globals
      Dim audio As MediaPlayerStream
   
End Sub

Sub Activity_Create(FirstTime As Boolean)
    audio.Initialize("audio")
        audio.Load("http://www.rekard.com/abhyas/tracks/sriguruguha/with_click/Srigiruguha_C_80_With_Click.mp3")
End Sub

Sub Activity_Resume
 
End Sub

Sub Activity_Pause (UserClosed As Boolean)
 
End Sub

Sub audio_StreamReady
    Log("starts playing") 
    audio.Play
End Sub

Sub audio_StreamError (ErrorCode As String, ExtraData As Int)
    Log("Error: " & ErrorCode & ", " & ExtraData)
    ToastMessageShow("Error: " & ErrorCode & ", " & ExtraData, True)
End Sub

Sub audio_StreamBuffer(Percentage As Int)
Log(Percentage)
End Sub

Sub audio_Complete
    audio.Stop
End Sub
 
Upvote 0

shashkiranr

Active Member
Licensed User
Longtime User
That was the mistake !! I declared in Process_Globals and it worked :) . Thank you Erel. I wanted to use the media streamer with seekbar hence needed the percentage of buffered stream.
 
Upvote 0
Top