VideoView and Progressive download
In my application I need to provide the user with a preview on a progressive download (video file).
In order to achieve this, I'm using VideoView
component to show the content of the video (.mp4, .3gpp) which is being downloaded.
The problem is that I can't access remote media via http://
or rtsp://
protocol, so I'm forced to use VideoView.setVideoPath
to play local copy of the video while downloading.
Unfortunately it seems like on Android devices that can't use StageFright
framework (so OpenCore
and some Tegra2-based
devices in my experience), the VideoView
can't handle progressive download correctly: it can play only the portion of the video recognized during the component initialization.
So to be clear: if the user press "play" when only 5% of the video has been downloaded, VideoView will show only that 5% of video, no matter if more video content ha been downloaded in the meantime.
In my experience this issue doesn't affect devices using StageFright
framework (e.g.: Nexus One 2.2, Nexus One 2.3.4).
Can anyone point me to a possible solution ? Thanks in advan开发者_StackOverflow中文版ce
If you are trying to play .h264, You need to move the MOV atoms to the front of the file. These tell the codec the length of the movie among other things.
try qtfaststart
http://ffmpeg.zeranoe.com/builds/
VideoView is a ready to use class in Android Application Framework for video playback use case. It internally uses MediaPlayer class to achieve playback. MediaPlayer uses media frameworks available internally based on certain criteria like file format , origin of content etc.
So the limitation is from underlying framework and not VideoView. If you are still suspecting VideoView then write your own video player activity using media player. You will see the same result.
Also not all versions of Android (read as stagefright) support progressive download.
May be you can use DownloadManager class for downloading content from http server and provide the path to media player / video view for a quick preview.
Shash316
精彩评论