Hi,

For streaming mp4, please see the post on "progressive streaming content"
above and make sure that your file is progressive streaming content.

If you are trying local mp4 file, you should place your file in /sdcard and
sample code for it is included in the files section of this group. You
cannot play mp4 files from res/raw folder at this time.

Thanks,
Megha

On Mon, Mar 31, 2008 at 1:34 AM, Ank <[EMAIL PROTECTED]> wrote:

>
> Hi Megha,
>
> Actually i developed Android application for playing Audio and Video
> but the prob is tht ki my application didnt support mp3 but i can play
> 3gp even i m not able to play mp4...i saw ur comment tht mp4 has been
> supported by android so can u give me any idea and if possible share
> code tht play mp4 ..
>
> I will wait for response and thanks in advance......
>
> On Mar 22, 12:06 am, "Megha Joshi" <[EMAIL PROTECTED]> wrote:
> > Hi Kosmaj,
> >
> > The streaming URLs should be played as shown in the MediaPlayer sample.
> The
> > streaming URL that you provided causes an exception in the native
> > MediaPlayer.
> > I have logged this bug for now.
> >
> > Thanks,
> > MeghaOn Thu, Mar 20, 2008 at 8:15 PM, Kosmaj <[EMAIL PROTECTED]> wrote:
> >
> > > Hi Megha
> >
> > > Thank you for your prompt reply!
> >
> > > You say:
> > > > Streaming is supported for mp4 and 3gp formats currently.
> > > > The "http://"; protocol should be used, not "rtsp://" .
> >
> > > I'll be happy with http but how??
> > > After creating a MediaPlayer instance, and setting all
> > > listeners, I tried the following:
> >
> > > if (!URLUtil.isNetworkUrl(path)) {  // local file
> > >  Log.d(TAG, "setDataSource, local file: " + path);
> > >  mp.setDataSource(path);
> > >  mp.prepare();
> > >  mp.start();
> >
> > > } else {
> > >  Log.d(TAG, "setDataSource, remote file: " + path);
> > >  mp.setDataSource(path);
> > >  mp.prepareAsync();
> > >  mp.start();    // <-- shall I do this here?
> > > }
> >
> > > and later:
> >
> > > private boolean nowPlaying=false;
> > > private int bufferingPcMin=5;
> >
> > > public void onBufferingUpdate(MediaPlayer mpx, int pc) {
> > >  Log.d(TAG, "onBufferingUpdate ---> pc="+pc);
> >
> > >  if(pc>bufferingPcMin && !nowPlaying) {
> > >    Log.d(TAG, "Starting remote media, pc="+pc);
> > >    mpx.start();
> > >    nowPlaying=true;
> > >  }
> > > }
> >
> > > Here is the LogCat output:
> > > DEBUG/VideoPlayer(1173): setDataSource, remote file:
> > >http://daily3gp.com/vids/747.3gp
> > > DEBUG/VideoPlayer(1173)<
> http://daily3gp.com/vids/747.3gpDEBUG/VideoPlayer%281173%29>:
> > > onBufferingUpdate ---> pc=0
> > > DEBUG/VideoPlayer(1173): onBufferingUpdate ---> pc=1
> > > DEBUG/VideoPlayer(1173): onBufferingUpdate ---> pc=6
> > > DEBUG/VideoPlayer(1173): Starting remote media, pc=6
> >
> > > at which point the app craches with the SEGV signal in
> > > /system/lib/libmedia.so and
> > > /system/lib/libmedia_jni.so
> >
> > > I'm aware that pcMin of 5% is too low, but I could never
> > > get more than 14% of media, and sometimes only 0% or 1%.
> > > Is this the way to use onBufferingUpdate ??
> >
> > > I'm ready to refactor my app to use the VideoView but
> > > I'm afraid VideoView calls MediaPlayer in the
> > > background and then I'll hit the same problem?
> >
> > > Your further help will be greatly appreciated.
> > > Kosmaj
> >
> > > On Mar 21, 7:09 am, "Megha Joshi" <[EMAIL PROTECTED]> wrote:
> > > > Hi Kosmaj,
> >
> > > > The future release of the Media APIs will have lots of bugs fixed, I
> > > have
> > > > tried to answer your concerns below for now:
> >
> > > > On Thu, Mar 20, 2008 at 1:00 AM, Kosmaj <[EMAIL PROTECTED]> wrote:
> >
> > > > > Thanks to Google for sending someone to help us with the Media
> Player
> > > > > and to Megha Joshi for providing a working code. As far as I can
> say
> > > > > the only
> > > > > difference to the old code (which worked in m3 but doesn't work
> now)
> > > > > is the
> > > > > absence of another thread to run
> > > > > mp.setDataSource and
> > > > > mp.prepare (or mp.prepareAsync).
> >
> > > > > Local 3gp and mp4 files now play well (except for the choppy sound
> on
> > > > > Vista) but
> > > > > no remote files can be downloaded. There are only a few hits to
> > > > > onBufferingUpdate
> > > > > callback and then nothing. When the above two calls are placed in
> a
> > > > > Runnable and
> > > > > run in a separate thread, then a remote mp3 file can be played
> (but
> > > > > only first 20
> > > > > seconds or so). Can you kindly  tell us what exactly changed in
> m5,
> > > > > and how to
> > > > > handle MediaPlayer in a multi-threaded environment?
> >
> > > > The progressive download feature for remote media files which was
> > > provided
> > > > in the m3 release was removed in the m5 release. That is the reason
> for
> > > the
> > > > remote mp3 files playback not working in your case. For playing
> remote
> > > > files, only streaming format is supported now. Streaming is
> supported
> > > for
> > > > mp4 and 3gp formats currently. The "http://"; protocol should be
> used,
> > > not
> > > > "rtsp://" .
> >
> > > > > For the Android challenge me and my team need the remote video
> file
> > > > > play-back capability and in this situation it seems we have only
> two
> > > > > options:
> > > > > to switch back to m3 or to give up. Needless to say we are
> > > > > disappointed.
> > > > > I expected one more sdk release before the challenge deadline but
> > > > > obviously
> > > > > there will be none.
> >
> > > > > Can VideoView play remote files?
> >
> > > > Yes, VideoView can play streaming mp4 and 3gp files(http://) .
> >
> > > > > Finally, to Megha et al, note that there is one more bug in mp4
> > > > > playback:
> > > > > when the view holder's size is larger than the mp4 frame size the
> > > > > video is
> > > > > distorted. If the holder's size is equal or smaller than the frame
> > > > > size then
> > > > > it's okay.
> >
> > > > This is a bug in m5, but it has been fixed for the next release. A
> > > method
> > > > will be provided to get the framesize of the video  and
> > > > set the holder's size accordingly.
> >
> > > > Thanks,
> > > > Megha
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to