Jump to content

Video view


Recommended Posts

Bonjour à tous :) ,

Je suis nouvelle dans le developpement android ^^ j'ai besoin un coup de main SVP !

j'ai créer une petite application pour lire une vidéo mais j'ai un problème au niveau de l'exécution de mon application sous l'émulateur (can't play this video) et je sais pas pourquoi !!

voici mon code java:

package com.example.video;

import android.app.Activity;

import android.net.Uri;

import android.os.Bundle;

import android.widget.MediaController;

import android.widget.VideoView;

public class MainActivity extends Activity {

VideoView vid;

@Override

public void onCreate(Bundle savedIstanceState){

super.onCreate(savedIstanceState);

setContentView(R.layout.activity_main);

vid = (VideoView) findViewById(R.id.vid);

String urlpath = "android.resource://" +getPackageName() + "/" + R.raw.video_test;

vid.setVideoURI(Uri.parse(urlpath));

vid.setMediaController(new MediaController(this));

vid.start();

vid.requestFocus();

}

}

Code .XML :

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical" >

<VideoView

android:id="@+id/vid"

android:layout_width="match_parent"

android:layout_height="match_parent" />

</LinearLayout>

Merci de m'aider j'en ai besoin urgent :(

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...