Android VideoView streaming - android

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.

Related

How to play a flv stream in android Application

I'm trying to play a video from the Internet in my app, but the video with a definition higher than 360p returned an .flv url. I have no idea to play it. Can someone suggest me some ways or a library?
PS: I need to set some headers to get the stream

Set cover image while record audio in android

Hello I am recording audio using MediaRecorder and save it in MP4 format. and upload to the server. as well record video as MP4 using camera and upload to server.
So while I am receive my uploaded item from server as uploaded url list. and I am playing all it in VideoView. video and audio play good. now here is the thing while I am playing video it's display video frame on video view but while playing audio it's black. basically audio and video file extension are MP4 so I can't make different while adding it in to VideoView other wise I'll add imageview and display some default image and hide VideoView.
so is there any way to record audio with cover image so while I am playing it in Video view so it display that cover image...
I know that using ffmpeg we can do this but I got lots of error while compiling it in my windows pc. so is there any way to add cover image while record audio with pure android api? sorry for bad english.
I google everything but I can't find any solution for convert audio file to video file with using image. So I have to go with FFMPEG.
So I add WritingMinds java FFMPEG in my project using gradle dependency. Then convert MP4 audio with cover image into the MP4 video.
There are some limitation in this precompile library. like it not work in android 24 and some commands like -speed, cpu-used, -deadline which are most important for all the operation(But still we can perform other operation). there are some disadvantage also like slow speed, and some features which required for specific operation are not include in the compile library. (So I gave advice to compile your own ffmpeg library for android project in linux or mac pc(windowns have lots of issues)).
I hope this will help someone who's this type of scenario :)

Additional .mp4 decoders for VideoView

I am building an app that downloads .mp4 files from the Internet and plays them.
It seems there are no decoders for this particular video type, and I only get audio, no picture. The same thing happens with the standalone player, so it is not a problem with the program or file.
Is it possible to use a user library for the decoding and plug it into VideView?
The .mp4 in question can be found here: https://www.coursera.org/modelthinking/lecture/preview_view?lecture_id=17
Thanks in advance.

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 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

How to convert 3GP video for Android to view?

I'm creating 3GP videos with the Android - however, when the 3GP files are posted on a site, the same Android phone cannot view it back. (The file works on the iPhone).
What is right way to encode/resize the 3GP video so that the video player on Android can play it back?
Thanks
Solved this by converting it to MP4 and then recompiling the Nginx server to have the MP4 streaming module. By default, Nginx mimetype was set to [application/octet-stream] instead of [video/mp4].
This seemingly was resolved on Froyo handsets - at least, when a 3gp file is opened in a browser window using http, and not rtsp, the video plays fine. On 2.1 it doesn't.
To make mp4 video streamable, you should change it's 'atom' byte order.
I'm using qt-faststart tool from ffmpeg package for this.
This tool changes the order of some meta-data inside mp4 container and as result allows to perform video "streaming" over HTTP.

Categories

Resources