Foros del Web » Programando para Internet » Android »

[SOLUCIONADO] Reproductor de videos

Estas en el tema de Reproductor de videos en el foro de Android en Foros del Web. Buenas quería hacer una consultilla, a ver si alguien me puede echar un cable. El caso es que quiero hacer una aplicación que reproduzca videos, ...
  #1 (permalink)  
Antiguo 22/07/2013, 09:46
 
Fecha de Ingreso: octubre-2012
Ubicación: Madrid
Mensajes: 67
Antigüedad: 11 años, 5 meses
Puntos: 1
Reproductor de videos

Buenas

quería hacer una consultilla, a ver si alguien me puede echar un cable. El caso es que quiero hacer una aplicación que reproduzca videos, hasta aquí sencillo porque hago esto y listo:

Código:
      Intent intent = new Intent(Intent.ACTION_VIEW);
      intent.setDataAndType(Uri.parse(consultorio.getVideo()), "video/*");
      view.getContext().startActivity(intent);
El caso es que esto lo que hace es crear un activity nuevo y utilizar el reproductor del móvil y yo no quiero hacer eso. Yo lo que quiero es crear un "view" (un algo!!) que ocupe la parte superior de la pantalla y en ese view que se vea el vídeo mientras en la parte de abajo hay texto.

Cómo podría hacer algo por el estilo?? algún view que reproduzca video?¿

un saludo!
  #2 (permalink)  
Antiguo 23/07/2013, 08:27
 
Fecha de Ingreso: octubre-2012
Ubicación: Madrid
Mensajes: 67
Antigüedad: 11 años, 5 meses
Puntos: 1
Respuesta: Reproductor de videos

ya está solucionado!!

El layout sería este
Código:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <RelativeLayout
        android:id="@+id/teaching_d"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/white"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:paddingTop="10dp" >

        <ViewSwitcher
            android:id="@+id/flipervideo"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:background="#EEE"
            android:inAnimation="@android:anim/fade_in"
            android:outAnimation="@android:anim/fade_out" >

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >

                <ImageView
                    android:id="@+id/play"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@drawable/playbutton" />

                <VideoView
                    android:id="@+id/video"
                    android:layout_width="wrap_content"
                    android:layout_height="185dp"
                    android:visibility="gone" />
            </FrameLayout>
        </ViewSwitcher>

        <ScrollView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/flipervideo"
            android:layout_marginBottom="120px" >

            <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <TextView
                    android:id="@+id/titulo"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:text="@string/titulo1" />

                <TextView
                    android:id="@+id/fecha"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/titulo"
                    android:layout_marginLeft="5dp"
                    android:text="@string/antetitulo1" />
            </RelativeLayout>
        </ScrollView>
    </RelativeLayout>

</FrameLayout>
y el código que lo maneja, este:

Código:
                video = (ViewSwitcher)findViewById(R.id.flipervideo);
		vv = (VideoView) findViewById(R.id.video);

		vv = (VideoView) findViewById(R.id.video);
		final MediaController mediaController = new MediaController(this);
		mediaController.setAnchorView(vv);

		vv.setMediaController(mediaController);
		vv.setVideoURI(Uri.parse(url ));
		vv.requestFocus();
		vv.start();

		vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
			@Override
			public void onCompletion(MediaPlayer vmp) {
				onBackPressed();
			}

		});

                TextView titulo = (TextView) findViewById(R.id.titulo);
		titulo.setText(consultorio.getTitulo());

		TextView fecha = (TextView) findViewById(R.id.fecha);
		fecha.setText(consultorio.getFecha());

Espero que le sirva a otros!!

Etiquetas: activity, reproductor, videos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:55.