Android: ¿Cómo puedo reproducir video en el MediaPlayer interno desde un recurso? ¿Alguien puede ayudarme?

I am trying to play a mp4 video from the resource within the app, either res/raw or assets, but i am having no luck, nor can i find any tutorials or solutions that work anywhere, hoping someone hear can provide the answer.

Code below that i thought would work but doesnt, please show me how?

Gracias Lucy

public void onCreate(Bundle savedInstanceState) {

    final Button button = (Button) findViewById(;  
         button.setOnClickListener(new Button.OnClickListener() {  
             public void onClick(View v) {  
                 Uri uri = Uri.parse("android.resource://" + R.raw.test2);
                 Intent intent=new Intent(Intent.ACTION_VIEW); intent.setDataAndType(uri, "video/mp4");

preguntado el 09 de enero de 11 a las 12:01

1 Respuestas

Please check this answer on that subject:

What I have managed was to play video from resources in my application (SufraceView in my layout). Another approach is (as suggested in the link) to copy video to SD card and easily play it from there using internal (system) MediaPlayer.

Respondido el 21 de enero de 11 a las 10:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.