Android Question Read video stream from B4A application

dim

Member
Licensed User
Longtime User
Hello,
I have written an application in Lazarus/Freepascal that uses DSPack library and generates ASF video streaming over network. Is it possible to read this stream from a B4A application?
Please note that I don't want to play a specific video file over network but to connect a B4A application to an existing video stream.
For example, I can connect to that video stream using VLC media player, using http://192.168.1.15 (my development system's IP address) and see the video stream.
Please describe which library should I use to implement this ?
Thank you in advance.
 

dim

Member
Licensed User
Longtime User
Thank you Erel. I use B4A version 3.82 but cannot find Videoview in libs. How can I add it ?
Also where can I find some help or examples about using it ?
Thanks !
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

dim

Member
Licensed User
Longtime User
Thank you DonManfred - I still did not understand how to use Videoview library.
I cannot declare "Dim vv As Videoview" because Videoview us unknown and it does not display in avalibale libraries.
Any suggestion for that ?

Also, from what I see (https://www.b4x.com/android/help/audio.html#videoview) the second parameter is a filename of a video file - but what I want to implement is connect to a streaming source, so I would expect to set only the first parameter. Is it possible to do that ?

Thank you and sorry if I don't understand something or need more explanation.
 
Upvote 0

dim

Member
Licensed User
Longtime User
OK now I got it - I must use Audio library in order to use Videoview...
I will try it - Thank you all.
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
1) Enable the Audio-library in the library-pane

Example code:
B4X:
Sub Globals
  Dim vv As VideoView
End Sub
Sub Activity_Create(FirstTime As Boolean)
  vv.Initialize("vv")
  Activity.AddView(vv, 10dip, 10dip, 250dip, 250dip)
  vv.LoadVideo("http", "http://192.168.5.100") 'URI
  vv.Play
End Sub
Sub vv_Complete
  Log("Playing completed")
End Sub

I don't remember if the library already enables INTERNET permission otherwise you may need to add the INTERNET permission in your Android-manifest. Just search the forum for this.
 
Last edited:
Upvote 0

dim

Member
Licensed User
Longtime User
Thank you moster67, but the problem is that with streaming there would be no filename like "myvideofile.mp4".
Now I have an application that generates ASF video streaming and I can connect on it with VLC or Windows Media player, by setting just the URL of the system where the streaming generator ir sunning, like "http://192.168.5.100". No filename. How is that possible with Videoview ?
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
See the modified code example above.

B4X:
vv.LoadVideo("http", "http://192.168.5.100) 'URI

You really should search the forum. If you search for VideoView you will find many examples.
 
Upvote 0

dim

Member
Licensed User
Longtime User
Thanks moster67, I have already tried this but with no success.
I search the forum for many days and but cannot find something on this, that's why I ask here.
What I search for, is an answer that this kind of stream reading is possible to be implemented on a B4A application (NOT using a video filename but a stream URL)
If someone can give some more clues, please post.
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
What error message do you get? Maybe it is a codec issue?
Can't you give the stream a filename in your program which generates/transcodes the original stream? Maybe you can change the codec?

Otherwise try some of the alternative video streaming libraries such as Vitamio, b4a_FFMpeg, b4aVLC which work and behave very much as the VideoView but which have more codec support. Just search for them in the forum.
 
Upvote 0

dim

Member
Licensed User
Longtime User
Thank you moster67. The error message is "Can't play this video".
I will try the other libraries too and return if still can't manage it.
Thank you very much for your help.
 
Upvote 0

somed3v3loper

Well-Known Member
Licensed User
Longtime User
Thank you moster67. The error message is "Can't play this video".
I will try the other libraries too and return if still can't manage it.
Thank you very much for your help.
I got the same message when trying to play a local .mp4 video but when playing .3gp video it works fine .
 
Upvote 0

dim

Member
Licensed User
Longtime User
No. After reading what you wrote; maybe my brain is bitching me
Sorry to hear that. On the other hand, I read many different things here, so I thought it would be better to clarify and be sure before experimenting with some library - that's why I asked.
 
Upvote 0

dim

Member
Licensed User
Longtime User
Is there someone who managed to read from an rtsp or asf stream ? If yes, using which B4A lib ? Thanks.
 
Upvote 0
Top