How to save streaming videos in Android by saving to SDcard?
I need to stream videos from an URL and then i wa开发者_开发知识库nt to save the video to SDcard.
For video streaming take a look at the following example/projects:
Audio and Video on Android- Official Documentation
Vidtry an Open Source Project by Mark Murphy
Video Streaming Example by Davanum(this might be out of date)
Saving to SDcard: I am not very sure, but once you have the video stream(abstracted as InputStream) in your code you should be able to save it on SD card using normal File I/O operations.
Be careful when you prepare your videos for streaming. The documentation on the MediaPlayer class says it is accepting video streaming over HTTP only if the following 2 conditions are true:
- The 'moov' atom has to be before the 'mdat' atom.
- The clip has to be reasonably interleaved.
While the first condition is quite straightforward, about the 2nd one I couldn't find a definitive answer on what does it mean for a clip to be "reasonably interleaved".
精彩评论