Buffer/Pre buffer a video prior to playing

PFlores81

Active Member
Licensed User
Longtime User
In one of my apps I have it set as a hidden link where you click it and it will play the video. Is there a way when this link is clicked it will buffer prior to playing. I have timeouts on 3g/4g data but WiFi will play just fine.
 

PFlores81

Active Member
Licensed User
Longtime User
How are you playing the video? MediaPlayerStream?

I am sure there are easier or more logical ways to to stream it..



B4X:
Sub ImageView1_Click
i.Initialize(i.ACTION_VIEW, "webaddy")
i.SetType("video/*")
i.Flags = 0x10000000
i.SetComponent("com.sec.android.app.videoplayer")
StartActivity(i)
 
Last edited:
Upvote 0

PFlores81

Active Member
Licensed User
Longtime User
If you need the web address I will PM it. I do not want it publicly distributed

B4X:
Sub Process_Globals
    Dim mps As MediaPlayerStream
End Sub

Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
        mps.Initialize("mps")
    End If
    mps.Load("Web Addy")
End Sub

Sub ImageView1_Click
mps.Play
End Sub
Sub mps_StreamReady
    Log("buffer complete")
    ToastMessageShow("Video Ready", True)
End Sub
Sub mps_StreamError (ErrorCode As String, ExtraData As Int)
    Log("Error: " & ErrorCode & ", " & ExtraData)
    ToastMessageShow("Error: " & ErrorCode & ", " & ExtraData, True)
End Sub
Sub mps_StreamBuffer(Percentage As Int)
    Log(Percentage)
End Sub
 
Last edited:
Upvote 0

PFlores81

Active Member
Licensed User
Longtime User
Ah well. I'll get it figured out. Thanks again Erel. I appreciate you taking the time to help.

HTC = Hate The Consumer
 
Upvote 0
Top