VideoView and Progressive download - android

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

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

Related

ExoPlayer playing currently recording media files

Let me refraise my question, I wrote it in a hurry.
Current situation:
I have set up a digital video recorder to record broadcasts provided via DVB-C. It is running on a raspberry 3B using TVHeadend and jetty/cling to provide UPnP and other possibilities to access media files. For watching recordings, I wrote an android player app using IJKPlayer, which runs on smartphones, FireTV and AndroidTV.
One hassle when playing media files which are currently beeing recorded is, that IJKPlayer doesn not support timeshifting. Means, when I start playing a currently recording file, I can only watch the length which is known by the player at that moment. Anything which is recorded afterwards can not be played. I need to exit the player activity and start it again. I have resolved that issue by "simulating" a completed recoding using a custom servlet implementation. Since the complete length of the recording is already known, I can use ffmpeg to accomplish this.
Future situation:
I plan to move away from IJKPlayer to ExoPlayer, because it supports hardware playback and is much faster when playing h.264 media. I can of course use the same solution like above, but as far as I have found out yet, ExoPlayer can support media files which are currently being recorded by using the Timeline class. However, I don't seem to find neither a usefull documentation nor any good example. Hence, I would appreciate any help with the timeline object.
Regards
Harry
Looks like my approach won't work. At least, I didn't find a solution. Problem is, that the server returns the stream size as it is during player-start-time. I didn't find a method to update the media duration for "regular" files.
However, I can solve the problem by changing the server side. Instead of accessing a regular file, I convert the file to m3u8 in realtime, using ffmpeg. I then throw the m3u8 URI onto the player and it updates the duration of the stream (while playing) without the need to create any additional code on the client side.

Android - Force VideoView to Intent.action_view [embeded videos via external player]

I have a few app to watch live streams and video clips.
The applications use embeded android video player.
After a search, i recongnized that these apps using VideoView class.
But i want to choice an external player to watch videos which triggered from this apps. (like MX Player or GP Player.)
I think i have to override the videoview class in android. Is this possible?
Or are there any other way to implement this?
Thanks.
May be i can override the Android source files. Is this possible?
No.
Moreover, it would not necessarily work, as there is no requirement that the video be available for viewing in a third-party app. Just because an app can play a video itself does not mean that the same video is accessible by other apps.

Android and video streaming - How can do it?

This is my problem. I have on my hosting an avi video file and I want that the user of my android application can display it in streaming on your smartphone.
There are two way.
1) Convert this file in mp4 format and visual it into my application with MediaPlayer
2) Control that on user's device there is Rockplayer and then to use it for display this avi file.
What the good way ?
Please look at this link. It is very good example for Android Media Streaming.
Media streaming on Android devices using the VideoView object available in the android.widget package. This widget allows audio or video playback local or global resources.
Choose option 1. You don't want to "sponsor" third-party applications such as RockPlayer when building your own app. What if the user doesn't have internet connection by the time he's trying to use your app? And he hasn't downloaded RockPlayer previously? As much as possible you want your app to be independent of other market apps, especially those you do not own.

Play video in full screen on Android with native video player

I am trying to design a video website compatible with Android. A good example of what I'm trying to achieve is vimeo.com. They show a thumbnail of a video. When you tap it, the native Android player comes up in full screen:
Currently, I have an anchor to an FLV containing an h.264 encoded video:
click here to watch
When you tap the anchor on Android, it downloads the video rather than plays it. That's not what I want. How do I get it to play full screen in the native player like Vimeo? But unlike Vimeo, I would like the video to expand so that there's not so much black empty space around the actual video.
Ahh I see what you mean, clicking a Vimeo video opens the Android dialog of selecting which app should respond to that request (in my case just the browser (which downloads the file) or video player (which opens and plays it as you wanted)). This is normal Android behavior- if you have not defined which app should respond to a given request, it will ask you to select from among the supporting applications.
Have you even tried embedding a video in the way suggested through the link I gave you? You may find that it will have the exact effect the Vimeo video does. HTML5 <video> element on Android
EDIT: Actually I think your real problem is probably just that the file format you're using (.flv) is not among the core media formats supported by Android. http://developer.android.com/guide/appendix/media-formats.html
if you have the correct codec installed to play the video and doesn't work, check and make sure you have the correct mime types configured and that something in the registry or a file isn't overwriting.
use the old standard of defining mp4 and falling back to flash.
In mobile Safari and Android webkit there are javascript methods and events defined on the Video object that can help with this. There is another StackOverflow question dealing with this topic (for iPad, but I have used this on Android phones as well).
Web App - iPad webkitEnterFullscreen - Programatically going full-screen video
Mobile Safari documentation: http://developer.apple.com/library/safari/#documentation/AudioVideo/Reference/HTMLVideoElementClassReference/HTMLVideoElement/HTMLVideoElement.html

Android VideoView streaming

I have a project with a VideoView in it I am streaming a video from online using this method:
mVideoView.setVideoURI(Uri.parse("http://db.tt/ij7w1Nw"));
My videos are mp4 files downloaded from Youtube. I then upload them to my dropbox, that is where the url comes from. This works fine if I download the video and do not make any changes to it, and upload it straight to dropbox. However if I try to make any changes to it for instance convert from .flv to .mp4, or change the size, then I upload it to dropbox it no longer plays in the VideoView. I get a dialog that says 'Unable to play video. Invalid streaming data'. If I take this same exact video and put it on the SD card either manually or even by having my app download it from the url then play it off of the SD card using
mVideoView.setVideoPath(path);
it works fine. I am using Wondershare Video Converter Platinum to do the conversions and size changes.
Is there some sort of specific encoding that is required to stream an mp4 file rather than play it from a local copy? Am I getting this because of some sort of bug/error with wondershare? Has anyone else experienced this type of problem, if so how did you end up fixing it.
Thank you.
The media format guide may help you see what's available. In my experience wrapping a H.264 AVC or MPEG 4-encoded video in a 3GPP container provides the easiest integration. Android is very fickle with both audio and video streaming.

Categories

Resources