Android: Video cannot be played from non hard-coded URL
<p>I'm trying to stream a video and play it using VideoView. I supply the view with the source URL of the video with setVideoURI() as shown below. With a hardcoded value like urlString = "www.myvideoserver.com/videos/bigbuckbunny.mp4", the video plays fine. However, when urlString is given the value from the intent (coming from the previous activity where the user chose the video), I get the message: "Sorry, Video cannot be played". I've read that one of the common causes is video format, like it's described <a href="http://stackoverflow.com/questions/8714033/android-videoview-gives-me-alert-sorry-this-video-cannot-be-played">here</a> and <a href="http://stackoverflow.com/questions/8012494/sorry-this-video-cannot-be-played-streaming-mp4-to-android">here</a>. I'm almost certain that it is not a format issue because I can play the video when the URL is fixed (and I know this because I can see from Log.d("PVurl", urlString); that the value of urlString is exactly the same as the one I fixed it to. That is, in LogCat, I copy paste the value into the line <code>urlString = getIntent()... // "www.myvideoserver.com/videos/bigbuckbunny.mp4"</code>, and it works but not when urlString is set to the intent return value . LogCat Errror panel gives the following: </p>

<pre><code>04-13 17:35:32.786: ERROR/MediaPlayer(2620): error (1, -1007)
04-13 17:35:32.786: ERROR/MediaPlayer(2620): Error (1,-1007)
</code></pre>

<p>I've searched around the internet but it doesn't seem that anyone has encountered such an error code before. </p>

<p>I'd very much appreciate if anyone has any idea what could be the problem. Thanks!</p>

<pre><code>public void playvideo () { // obtain URL of the requested video from the intent in previous activity

    try
    {
        urlString =  getIntent().getStringExtra("mypackage.fulladdr");

        if (urlStr != null)
        {
            Log.d("PVurl", urlString);

            VideoView v = (VideoView) findViewById(R.id.videoView1);

            // play video

            v.setVideoURI(Uri.parse(urlString));
            v.setMediaController(new MediaController(this));
            v.start();

            v.setOnCompletionListener(new OnCompletionListener() {
                public void onCompletion(MediaPlayer mp) {
                    showRatingDialog();
                }
            });
        }
    }
    catch (Exception e)
    {
        Log.d("PV_TAG", +e.getMessage());
        e.printStackTrace();
    }
}
</code></pre>
