B4A Library FFmpeg_b4a - a FFmpeg library for b4a (decoding/streaming)

victormedranop

Well-Known Member
Licensed User
Longtime User
Hi everyone, interesting case. and working apk with ffmpeg. really nice, but when i change the orientation
stop playing.

any ideas?

Victor
 

victormedranop

Well-Known Member
Licensed User
Longtime User
Is so frustrating, I cant control the application when buffer is equal to 0.
Some help please, will go for coffee.
B4X:
Sub FFMpegVideoView1_Prepared
Log("FFMpegVideoView1_Prepared")
Log("PLAYING")
Log("Buffer" & FFMpegVideoView1.GetBufferPercentage)
If FFMpegVideoView1.GetBufferPercentage = 0 Or FFMpegVideoView1.GetBufferPercentage < 0 Then
         ToastMessageShow("Invalid Connection to internet prepared",True)
          FFMpegVideoView1.Invalidate
         FFMpegVideoView1.Visible = False
         ListView1.Visible = True
          Return
End If

End Sub

Thanks,

Victor
 

moster67

Expert
Licensed User
Longtime User
I don't have B4A available now but if I remember correctly, when the Prepared event triggers, buffering has already ended.
Try to do something in the Info-event. Take a look the sample code I posted here although it was meant for the standard VideoView. Maybe you can adapt it and get it to work? It really depends on if FFmpeg sends the same "what" info....
 

victormedranop

Well-Known Member
Licensed User
Longtime User
i think is the network delay, but how can i handle the start video with buffer 50 or something like that.
yes, sample app too.

Victor
 

moster67

Expert
Licensed User
Longtime User
I tried it with the sample app and the video stops indeed when changing orientation but then it restarts (at least for me). This is normal since the Activity is recreated. You could try checking if video is playing like this in the Activity_Create sub:
B4X:
If FFMpegVideoView1.IsPlaying = False Then
        FFMpegVideoView1.SetVideoPath("http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8")
End If

However, the best solution would be to implement the solution I posted here.

If you have network delay, then it is not easy for me to simulate. However, you can use the below code to detect when buffering is starting and when it has finished.

B4X:
Sub FFMpegVideoView1_Info(What As Int, Extra As Int) As Boolean
    If What = 701 Then 'buffering starting
        Log("we are buffering")
        'show and start a progressbar with spinning circle or do what you want.....
    Else if What = 702 Then 'buffering finished
        Log("Buffering has finished")
        'stop and hide progressbar
    End If
    Return False
End Sub
 

moster67

Expert
Licensed User
Longtime User
@victormedranop
There are FFmpeg-frameworks for iOS as well but my knowledge of Objective C is very limited. Even with the new version of B4i which should support Swift and if there was a framework in Swift, I still would need to wrap it in Objective C. So for now, I doubt I will do it.
 

Almora

Well-Known Member
Licensed User
Longtime User
This video is not playing..

FFMpegVideoView1_Error -10000
 
Last edited:

Almora

Well-Known Member
Licensed User
Longtime User
I think the decoder problem ..
 

Attachments

  • log.txt
    438.4 KB · Views: 323

Almora

Well-Known Member
Licensed User
Longtime User
message_loop
FFP_MSG_FLUSH:
ijkmp_prepare_async()=0
SDL_RunThread: [27963] ff_read
Protocol not found
FFP_MSG_ERROR: 0
netId is 0
 
Last edited:

moster67

Expert
Licensed User
Longtime User
Yes, probably a protocol or codec issue (or both) for that URL/stream. Maybe it works with VLC or Vitamio?
 

Almora

Well-Known Member
Licensed User
Longtime User
Yes, probably a protocol or codec issue (or both) for that URL/stream. Maybe it works with VLC or Vitamio?
exo : no working
vlc : no working
vitamio 5.0.2 : its working..
 
Last edited:

Swissmade

Well-Known Member
Licensed User
Longtime User
Hi Guys somebody know to use this in B4J with JavaFX?

Thanks for help
 

moster67

Expert
Licensed User
Longtime User
This is for b4a.
For b4j, you could let the user install ffmpeg and then you use a shell and ffplay.
 

Swissmade

Well-Known Member
Licensed User
Longtime User
a shell and ffplay

Yes this is possible but I never have find the way to get the output to a B4J app.
Maybe somebody know how.
Thanks monster67
 

victormedranop

Well-Known Member
Licensed User
Longtime User
It's possible to made an playlist without using
FFMpegVideoView1_Complete function ?


Thanks

victor
 

moster67

Expert
Licensed User
Longtime User
Yes this is possible but I never have find the way to get the output to a B4J app.
Maybe somebody know how.
Thanks monster67
You could try the VLC wrapper I wrote for B4J...
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…