Hi,

I was trying to set up my app to play a video.

I tried to load it form local and net both, but no way to get it
working: I still receive a "Cannot play video" error.

Basically I used the same src that we are able to find in sample dir.

Here you are my media.xml

<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout
android:id="@+id/media"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000"
xmlns:android="http://schemas.android.com/apk/res/android";
>
<VideoView
android:id="@+id/media_video"
android:layout_width="fill_parent"
android:layout_height="240px"
/>
<Button
android:id="@+id/media_home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#000000"
android:text="Home"
android:textColor="#FFFFFF"
android:layout_x="10px"
android:layout_y="410px"
>
</Button>
</AbsoluteLayout>

And here Media.java

package com.app1;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.MediaController;
import android.widget.VideoView;

public class Media extends Activity {

        private VideoView video;

        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.media);

        Button bottoneHome = (Button) findViewById(R.id.media_home);
        bottoneHome.setOnClickListener(mHomeListener);

        video = (VideoView) findViewById(R.id.media_video);

        video.setVideoURI(Uri.parse("http://www.jsharkey.org/downloads/
dailytest.3gp"));
        //video.setVideoURI(Uri.parse("android.resource://com.app1/" +
R.raw.v));

        video.setMediaController(new MediaController(this));
        video.requestFocus();

    }

         private OnClickListener mHomeListener = new OnClickListener()
         {
                public void onClick(View v)
                {
                    finish();
                }
         };

}

Any idea how to get it working?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
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