Hosting the video online is not possible nor is using an SD card a realistic solution to my issue... Due to several factors such as the likely hood that the SD cards would disappear.
So I found this, and this says it's possible: https://stackoverflow.com/a/5475436/584994
But I can't seem to get the FileInputStream correct... Under the package explorer my file is located under AppName->res->drawable->overview_animatic.mp4
and the string I am passing to FileInputStream is "/res/drawable/overview_animatic.mp4" am I doing this incorrectly?
Does the solution in the above link no longer work?
Is there a better way to play an internal video?
See the top answer for How to play videos in android from assets folder or raw folder? for an explanation of how to play a video from an application resource.
Related
Hello so I am trying to make online videos download on the android export app from unity and then play it back in the same app. so far I have used a plugin EasyMovieTexure asset for streaming online videos but cannot find a way to download videos and play them. I have searched and found that I can download the video with Android Application.persistentDataPath but I don't know how to use it and save the video file to a location on android.
Help is much appreciated.
the easiest way will be using System.IO.File.WriteAllBytes () to save all byte data from the WWW object. But this method actually need RAM to hold the whole file for a while. It doesn't work if the file is too big. if the file size is too big, you probably need another way to do the downloading and saving
I have lots of images and video, so I cannot store in internal storage.
I want to store it in external storage and I don't want to show this images and video to user. It can not be copy when it connected to USB.
I already tried to encrypt a video and images, but it takes to much time to decrypt a video and it is not played directly. This solution is told by so many people on stack overflow but it is not feasible for me.
I tried this solution,
so please give me the another solution if it is possible.
Thanks in advance.
Include an empty file named .nomedia in your external files directory (note the dot prefix in the filename). This will prevent Android's media scanner from reading your media files and including them in apps like Gallery or Music. for example , you store your images and video in sdcard/yourappname/
then put .nomedia file in sdcard/yourappname/.nomedia
And then other application can not read your media files
i am developing one android application. it download videos from server and store it in mobile.
i want to store those video in secure manner.(deny the user from copying. or deny them from viewing the video directly from sdcard)
i found two ways to solve the problem.
1)Store the video's inside the application.
2)Encrypt the entire video
but facing some problem in implementing solution
i)first solution found suitable. but i am fearing that. if we store too much video inside the application .it would become bulkier.and fore the user to uninstall.
ii)but in second solution. i did not find any correct way to do so.
so please help me to solve the problem.
This is kind of suggestion :
To store the videos you must have created some folder on SDCARD, so you can hide the folder by putting the "." in front of the name while creating it. on top of this you can encrypt the video file using AES algorithm so it can not be viewed, if copied outside the android it will not be view able. but from your application you can decry-pt the file and view it.
Definitively, you must encrypt the media and that's quite simple. What is more difficult is to play the media, because MediaPlayer only accepts clear contents. A basic way would be to convert an encrypted file to a decrypted one, just for the time of the playing session. A better approach is to build a stream from the file, decrypt that stream and feed it to the player. The hard point is to have a local http server to serve the stream.
I'd like my Android application to download an mp3 file from the internet and play it like a stream while downloading it. Is this even possible? How would I go about doing it?
Essentially I want the user to be able to listen to the file instantly, but have it keep downloading to the SD Card even if he stops listening, so the whole mp3 file will end up on the SD Card either way.
I don't believe android provides the functionality you're asking for. But there's one workaround I know of that might work.
http://code.google.com/p/android/issues/detail?id=739 is an open ticket with a lot of discussion that relates to what you're describing. In the 5th comment seeingwithsound says
However, as a workaround I next stream my synthesized data to temporary files much like you consider streaming your HTTP streams to files, for subsequent playback of these files via MediaPlayer. [...] It looks though like your problem might be served by more control over MediaPlayer's buffering, because you are essentially concatenating streams through some cache mechanism (buffer) ...
To be honest I haven't played with MediaPlayer too much, so I can't give you too many details on how to "control MediaPlayer's buffering". But assuming you can get that to work, I suggest that you download your .mp3 file to (a) temporary file(s) which you can then point MediaPlayer to.
Sorry this answer is so vague, but you're entering territory that few others have before attempted. Good luck.
For Android devices 2.3 and earlier, you need to remove the Content-Disposition response header altogether. This will cause the browser to invoke the audio player of the user's preference.
Try it here: http://declinefm.com/archives select an archive of your choice, and tap the download link.
For modern Android devices, you can dispense with the removal of the CD header.
I have a tutorial here that I wrote inspired on your post:
http://rudd-o.com/linux-and-free-software/how-to-properly-stream-audio-from-your-plone-varnish-site
Enjoy!
RTSP or HTTP? If HTTP you can try and remove the Content-Length header which on some mobile devices will allow for immediate invocation of the player. It sounds as though you're pumping the data through a local app. How are you playing the file now?
1.how do we build our own video player in android,it will be helpful if ull can give me some code related to it.
other than the sd card where else can we place a video file and paly it.
thank you.
I tried to play a video from internal storage (i.e. /data/data/com.yourapp/files) as well but failed; I looked for this question before as well.
But it should work when using a FileDescriptor.
See the following links and discussions:
http://groups.google.com/group/android-developers/browse_thread/thread/a01d415c8e48e0d3
and a solution with code sample here:
http://www.anddev.org/multimedia-problems-f28/videoview-cannot-play-video-from-internal-storage-t16636.html#p52373