Android Question Playing a video fil

Ajay Kakar

Member
Licensed User
Longtime User
Hi,

I have been struggling to play a video file on my App. I am trying to play an AVI file and a MP4 file from my APP. The files are sitting on my server. The MP4 file plays on my phone when I transferred it to the phone by bluetooth. But when I am running it from the APP and accessing the file from my server it does not play. I have been using the videoview object to run the files. I have also given the INTERNET permission in the manifest file.

Is there any way that i can use the media player on the smartphone to play the video files.

Ajay
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
I am currently playing with something similar. How are you accessing your files on the server? Is it a simple SMB share or do you have XBMC, MediaTomb or some other UPNP/DNLA software installed?
If using a simple SMB share then I think that you need to download the file to the device before attempting to play it. If using UPNP or DNLA then you can browse the media and request the URI to enable streaming the content direct into a VideoView.

Regards,
RandomCoder
 
Upvote 0

Ajay Kakar

Member
Licensed User
Longtime User
Thanks for responses. Erel this is the code

Dim video1 As VideoView
Private videobutton1 As Button
Private videobutton2 As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("videoalbum")
video1.Initialize("video1")
Activity.AddView(video1,25dip,135dip,300dip,200dip)
videobutton1.Text = "Play Video One"
videobutton2.Text = "Play Video Two"

Sub videobutton1_Click
video1.LoadVideo("http","http://www.bitein.com/mempic/[email protected]/video1.mp4")
video1.Play
End Sub
Sub videobutton2_Click
video1.LoadVideo("http","http://www.bitein.com/mempic/"& Main.mainemail&"/video2.avi")
video1.Play
End Sub

I am testing with a video file called "video1.mp4" which is a file from my smartphone. It plays perfectly on the smartphone. I transferred it by Bluetooth to my laptop and then with FTP to my server. It works fine on my laptop as well. Would appreciate it a lot if you could help.

Ajay
 
Upvote 0

Ajay Kakar

Member
Licensed User
Longtime User
Hi Randomcoder,

Thanks for your reply. I have no clue as to what is SMB or XBMC or Meditomb etc. I am using the Http download with the videoview object. I put the code in my previous post.
 
Upvote 0

Ajay Kakar

Member
Licensed User
Longtime User
Thanks Erel. I have tried out 10 different files and following formats avi, mp5, wmv and asf formats. None of them have worked. I thought it is a bit improbable that so many file formats do not work. Any help would be highly appreciated.
 
Upvote 0

RandomCoder

Well-Known Member
Licensed User
Longtime User
Hi Ajay,

Please try the attached test app. It works on my Galaxy S3. I've also discovered that it doesn't matter if I encode the URL or not, maybe Erel can comment on this?
I believe that the formats supported vary from device to device. My S3 will play mp4, xvid, avi and mpg but not mov. I've not got any mp5, wmv or asf formats to try.

I've also found this post Videoview, Cannot play video which suggests that using spaces in filenames will cause it to fail. Can't say that I've experienced this though but maybe something to try?
I've only recently started to use the VideoView and so I'm probably not much help. I'm also passing mine a URL that was supplied by a UPNP server.

Kind regards,
RandomCoder
 

Attachments

  • vvTest.zip
    6.5 KB · Views: 233
Upvote 0

Ajay Kakar

Member
Licensed User
Longtime User
Thanks Randomcoder.. I will try it out and let you know if my problem got solved. I am fine even if any one file format works for me. MP4 would be ideal. Even AVI would be very good. Lets see what i come up with. My file name and in fact my entire file path has no spaces.

Ajay
 
Upvote 0

Ajay Kakar

Member
Licensed User
Longtime User
Hi Erel, Randomcoader and others,

This is a real weird situation. I am trying to test if the MP4 files on my server are being recognized. (I already tested my app with the file link provided in the sample given by radomcoader - even though the file location is incomprehensible - example attached - it works fine on my app .. so the videoview is working ok now). I just tried to play the MP4 file on my browser in an HTML file using the <Video> tag and it gives me a message that says "file not found". I know the file is there. I used FTP to upload. I am wondering if the MP4 files are actually stored on the server with some different name than what we see. My file is names video1.mp4 I just renamed an MP4 file I downloaded. I even tried using the original name. Same issue. It just is not able to locate the file. Its weird. Maybe thats why Videoview is not able to play it. Can anyone give me any sample video file for testing with my APP.

Ajay
 
Upvote 0

RandomCoder

Well-Known Member
Licensed User
Longtime User
Hi Ajay,

First of all, the video link was just a youtube video of something to do with Basic4Android, the first mp4 I found.
Can I suggest installing ES-File Explorer from the play store. It's free (and very good, I use it all the time :D). With it you'll be able to navigate to your files on the server and try and run them to test if they work. You'll also be able to copy the path.

On a side note, I've just installed my UPNP control point app on a Nexus 7 2013 and the only files it will play are .mp4 and none of the other files that work ok on my Galaxy S3. It appears to be a problem with the version of Android that I am running, see post here https://code.google.com/p/android/issues/detail?id=58451#c11
Does anyone have a possible solution for this?

Regards,
RandomCoder
 
Upvote 0
Top