5

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 advance

ligi
  • 39,001
  • 44
  • 144
  • 244
a.bertucci
  • 12,142
  • 2
  • 31
  • 32
  • Hello, did you find the way to fix this bug? I had the same error. And right now, I'm on stuck. – Huy Tower Oct 25 '13 at 09:25
  • Finally We find out the reason as the solution. [In here](http://stackoverflow.com/questions/19587880/sorry-this-video-is-not-valid-for-streaming-to-this-device-in-http-streaming-an) Thanks, – Huy Tower Oct 28 '13 at 11:06

2 Answers2

2

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/

Byron Whitlock
  • 52,691
  • 28
  • 123
  • 168
  • Hello, did you find the way to fix this bug? I had the same error. And right now, I'm on stuck. Would you like to give me some ways to finish this task, streaming video with progressive download. p/s: I can encode the video to .h264, upload it to website, and i believe my code is well too. Device : Samsung Galaxy 7" 2.2.1 – Huy Tower Oct 25 '13 at 09:31
1

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

Shash316
  • 2,218
  • 18
  • 19
  • Yes, the problem affects the different media frameworks under the `MediaPlayer` (and so under `VideoView`). Downloading the video via a `DownloadManager` can't do the trick (I already use that), because the issue is related to the way the video buffer is handled by the underlying media framework. Thanks anyway. – a.bertucci Jul 21 '11 at 08:29