MediaPlayer and video problem

by Anton Okolelov » Sat, 02 Oct 2010 02:14:49 GMT


Sponsored Links
 I try to play video, but all I get is sound and black screen. I don't
understand what's wrong with the code. That video is 3gp, it works on
my phone if I run it using standard phone player (without my program).
I tryed VideoView, but no result...

Please help!

here's code:


package danilka.appl;

import android.media.MediaPlayer;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

public class Answer implements Runnable {
        actiff mainActivity;
        MediaPlayer mp;

        public Answer(actiff mainActivity) {
                this.mainActivity = mainActivity;
        }

        public void showAnswer(int resid)
        {
        mp = MediaPlayer.create(mainActivity, R.raw.test);
        SurfaceView v = new SurfaceView(mainActivity);
        SurfaceHolder sh = v.getHolder();
        sh.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        mp.setDisplay(sh);
        mainActivity.setContentView(v);
        mp.start();
        v.postDelayed(this, 2000);
        }

        @Override
        public void run() {
                mp.release();
                mainActivity.newQuestion();
        }
}

--



MediaPlayer and video problem

by Doug » Sat, 02 Oct 2010 15:22:37 GMT


 


You might want to keep trying with VideoView, because if you can't get
that to work, then it probably won't work at all.  The source for
VideoView will help you understand what to do if VideoView isn't good
enough.

Doug

--


Sponsored Links


MediaPlayer and video problem

by Indicator Veritatis » Sun, 03 Oct 2010 17:36:01 GMT


 One possible cause of what you describe is that the file has the right
codec for the sound, but not for the video. Verify what codec it has
for video and make sure that is supported on the phone. As
 http://en.wikipedia.org/wiki/3GP_and_3G2 describes , the video stream
may be either H.263 OR H.264. Which does your phone support?




--



Other Threads

1. Receiving inactivity notifications in service from android

Hi,
    I want to launch an activity only when there is no activity on android
till a particular a period of time. I know the timer value, and I want
notification after inactivity timeout of timer value. Just like what windows
provides, you set some timer value and system will be locked after that
particular inactivity timeout.

Currently I am using ACTION_SCREEN_OFF intent, but this notification timer
value i.e. inactivity timer value is screen timeout of android's default
setting.

Does anybody has any idea about providing our own timer value for
ACTION_SCREEN_OFF ? Or different way of getting inactivity notifications ?

Thanks in advance,
Swapnil

|| Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
|| Hare Rama    Hare Rama   Rama   Rama    Hare Hare ||

-- 

2. Native IM Cyanogen

mantapp... ntar gw coba test ahhh... :D





--~--~---------~--~----~------------~-------~--~----~
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group, please visit the following page:
 

3. how to set wifi rate (enable 802.11G) on HTC hero G1

4. Interleaving vertex data in OpenGL ES

5. Ellipsize attribute in 1.6???

6. how can I target api 1.6, but use packages from 2.0 (and safely)

7. HORE HERO udah bisa security OFF a.k.a unlocked SPL