Android Question Play URL Video

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
High everyone;
What is the code that plays a remote url video in the device stock video player ?
PhoneIntents.PlayVideo is good for local video file, but how to play remote streaming video without saving it?
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
Using Audio library
B4X:
    Dim v As VideoView
    v.Initialize("vv")

    Activity.AddView(v,0,0,100%x,100%y)
    v.LoadVideo( "http","http://yourlinktovideofile")
    v.Play
 
Upvote 0

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
but it gives me message says (you have to install vitamio plugin to play this video and i need it to be played directly
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
You're probably using the old and deprecated vitamio-wrapper which indeed required an "extra" install.
Unless you have codec-problems, try to use VideoVideo included in the standard Audio-library.
 
Upvote 0

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
Hi
I use this code successfully :

B4X:
Sub playVideo(vid As String)
  
   Dim In As Intent
   In.Initialize(In.ACTION_VIEW,vid)
   In.SetType("video/*")
   If In.IsInitialized Then StartActivity(In)
   StartActivity(In)
  
End Sub

Then call it as:
B4X:
playVideo("url address of video file")

It is great; but i want it to play the video directly inside the android stock video player ...
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
Unsure if you want to use an external player or use a videoview embedded in your app??

If you want to use videoview embedded in your app, then use the code suggested by @somed3v3loper in one of the earlier posts
Make sure to tick the audio-library in the library pane on th right in the ide.
 
Upvote 0

Kwame Twum

Active Member
Licensed User
Longtime User
Hi all, I'm trying to play a video from a url in the format: http://videa.hu/player?v=Aqy6ZFCwn4EADpPH.
Here's my code on Activity_Create:
B4X:
Dim vi as VideoView
vi.initialize("vi")
Activity.AddView(vi,0,0,100%x,200dip)
vi.LoadVideo("http","http://videa.hu/player?v=Aqy6ZFCwn4EADpPH")

After running this piece, I get a dialog sayinh "Can't play this video".
I've verified the video link is active.

Thanks in advance.
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
Then probably the video-codec in use is not supported natively by Android.
You can probably resolve by using one of the alternative VideoView wrappers available here in the forum (Search for Vitamio5, vlcb4a, FFmpeg_b4a)
 
Upvote 0
Top