Marco,

Thank you so much! I just spent a day and a half trying every example
I could get my hands on, and about 2 minutes before you replied I
found a hint that video could not be a raw resource. I had just been
adapting every example to include that, and it never occurred to me
that might be the problem!

The dev guide I reference is here 
http://developer.android.com/guide/topics/media/index.html
It is very lacking on video info in general, but in particular it
never mentions that video cannot be a raw resource, and I never found
that on Google's site anywhere! I would like to file a issue, but
before I do, do you know if they include it elsewhere? I don't want to
turn in an issue that says it is never mentioned, and then have them
dismiss it because it was mentioned somewhere I didn't look.

Thanks again, I am so relieved to be done with that!

Hamy

On May 27, 10:57 am, Marco Nelissen <[email protected]> wrote:
> Which "Audio and Video dev guide" are you referring to? If that guide tells
> you that the code you posted should work, it needs to be fixed :)
> There are several problems in your code, but the main one is that you can't
> use any of the MediaPlayer.create() convenience methods to play video from a
> resource. This is because create() calls prepare() internally, but you need
> to call setDisplay() before calling prepare().
> You'll need to use "new MediaPlayer" and setDataSource and setDisplay
> instead. Also be sure to wait for the surfaceCreated callback on the
> SurfaceHolder before calling start().
>
> On Wed, May 27, 2009 at 8:42 AM, Hamy <[email protected]> wrote:
>
> > Hey all,
>
> > I can only hear sound when trying to play a video in a surfaceView.
> > The video codecs are very likely supported - I was reading this
> > thread:
> >http://groups.google.com/group/android-developers/browse_thread/threa...
> > where Mark Murphy mentions that the video is known to work.
>
> > This is very straightforward code, right off the Audio and Video dev
> > guide, so I am surprised I am having so much trouble with it.
>
> > Thanks,
> > Hamilton
>
> > Here is all the code in my onCreate method
> >        public void onCreate(Bundle savedInstanceState) {
> >                super.onCreate(savedInstanceState);
> >                setContentView(R.layout.main);
>
> >                MediaPlayer mp = MediaPlayer.create(this,
> > R.raw.documentariesandyou);
> >                SurfaceView sv = (SurfaceView)findViewById(R.id.surface);
> >                mp.setDisplay(sv.getHolder());
> >                mp.start();
> >        }
>
> > and here is my XML
> > <?xml version="1.0" encoding="utf-8"?>
> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> > android"
> >        android:orientation="vertical" android:layout_width="fill_parent"
> >        android:layout_height="fill_parent">
> >        <SurfaceView android:id="@+id/surface"
> >                android:layout_width="fill_parent"
> > android:layout_height="fill_parent" />
> > </LinearLayout>
--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to