You are using in your code

           mVideoView.setVideoPath(path);


but you are trying to play a video from web address.

I assume that setVideoPath expects a local path on your file system
(Android documentation is very bad and does not say anything....).

Use

      video.setVideoURI(Uri.parse("rtsp:<your stream"));

instead.

Note: I noticed that rtsp streaming is not straight forward using the
MediaPlayer. A lot of times the MediaPlayer does not like the
container format also if it is playable by other mediaplayers.

Also implement a onPrepared method and start the video within the
onPrepared.

    public void onPrepared(MediaPlayer mp) {

        mp.start();

    }

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.

On Oct 13, 5:47 am, Maxood <[email protected]> wrote:
> I tried to play a you tube movie through the media app provided in the
> samples. The emulator is running fine but once i click the media apps
> and try to play the video demo, i get the following error : "Sorry
> this video cannot be played"
>
> Here is the code and i am trying to play a youtube video in my
> emulator:
>
> package com.example.android.apis.media;
>
> import com.example.android.apis.R;
> import android.app.Activity;
> import android.graphics.PixelFormat;
> import android.net.Uri;
> import android.os.Bundle;
> import android.util.Log;
> import android.widget.MediaController;
> import android.widget.Toast;
> import android.widget.VideoView;
> import android.media.
>
> public class VideoViewDemo extends Activity {
>
>     /**
>      * TODO: Set the path variable to a streaming video URL or a local
> media
>      * file path.
>      */
>     private String path = "http://www.youtube.com/watch?
> v=0p_6ZruRC_c";
>     private VideoView mVideoView;
>
>     @Override
>     public void onCreate(Bundle icicle) {
>         super.onCreate(icicle);
>         setContentView(R.layout.videoview);
>         mVideoView = (VideoView) findViewById(R.id.surface_view);
>
>         if (path == "") {
>             // Tell the user to provide a media file URL/path.
>             Toast.makeText(
>                     VideoViewDemo.this,
>                     "Please edit VideoViewDemo Activity, and set path"
>                             + " variable to your media file URL/path",
>                     Toast.LENGTH_LONG).show();
>
>         } else {
>
>             /*
>              * Alternatively,for streaming media you can use
>              * mVideoView.setVideoURI(Uri.parse(URLstring));
>              */
>             mVideoView.setVideoPath(path);
>             mVideoView.setMediaController(new MediaController(this));
>             mVideoView.requestFocus();
>
>         }
>     }}
>
> On Sep 29, 2:33 pm, Mark Murphy <[email protected]> wrote:
>
> > shobhit kasliwal wrote:
> > > I tried the DemoApi's that come's with the sdk but still no luck.
> > > I am still getting a still image with audio if I try to run teh Wmv file
> > > and for 3gp and mp4 I am not getting anything.
>
> > WMV is not supported onAndroidgenerally. WMV may be supported on
> > select devices from manufacturers.
>
> > > I am not geting what the problem is...??
>
> > 1. Start with avideofile known to work with your sample, or known to
> > work onAndroid.
>
> > For example:
>
> >http://www.law.duke.edu/cspd/contest/finalists/
>
> > At least the "Documentaries and You"videoworks fine onAndroid. I have
> > used it with numerous training classes, with my sample code I linked to
> > earlier.
>
> > 2. Check your warnings in logcat to see if anything shows up.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > AndroidApp Developer Books:http://commonsware.com/books.html
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to