I'm using code almost verbatim out of the VideoViewDemo example.
Below is the exact code to be sure, and I've tried with both
setVideoPath() and setVideoURI().

Looking at wireshark during this process, it seems that the both
YouTube and my server are spewing back plenty of video data, but the
VideoView somehow never gets it, or doesn't know what to do with it.
With RTSP, it takes about 5-10 seconds before a "Cannot play video:
Sorry, this video cannot be played." error message appears, but with
the HTTP link it appears almost instantly.

For Internet traffic, I'm behind a NAT.  However, for the HTTP
example, I've also tried a local Apache server that doesn't go through
a NAT.  (Unless the emulator itself counts as another NAT.)


=== VideoViewDemo.java ===

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;

public class VideoViewDemo extends Activity {

    private VideoView mVideoView;

    private String path = "http://www.jsharkey.org/downloads/dailytest.
3gp";
    //private String path = "rtsp://ehug.rtsp-youtube.l.google.com/
CkELENy73wIaOAnUq-
btqFy58BMYDSANFEIJbXYtZ29vZ2xlSARSB2RldGFpbHNaB2RldGFpbHNgz9u3rfm40Np6DA==/
0/0/0/video.3gp";

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.videoview);
        mVideoView = (VideoView) findViewById(R.id.surface_view);

        //mVideoView.setVideoPath(path);
        mVideoView.setVideoURI(Uri.parse(path));
        mVideoView.setMediaController(new MediaController(this));
        mVideoView.requestFocus();

    }
}



=== videoview.xml ===

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

    <VideoView
        android:id="@+id/surface_view"
        android:layout_width="320px"
        android:layout_height="240px"
    />

</LinearLayout>



=== AndroidManifest.xml ===

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
    package="org.jsharkey.videotest">
    <application android:icon="@drawable/icon">
        <activity android:name=".VideoViewDemo" android:label="@string/
app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>






On Aug 18, 10:31 pm, "Justin (Google Employee)" <[EMAIL PROTECTED]>
wrote:
> Code for this would be helpful. Can you provide yours for setting up
> the VideoView, loading, and playing the file?
>
> Cheers,
> Justin
> Android Team @ Google
>
> On Aug 18, 9:03 pm, Jeffrey Sharkey <[EMAIL PROTECTED]> wrote:
>
> > Hey there, I'm trying to play 3GP-encoded video using the
> > VideoViewDemo example.
>
> > It will play local 3GP videos that have been adb push'ed to the
> > device, specifically to:
> > /data/data/[package]/files/dailytest.3gp
>
> > However, it refuses to play remote 3GP video from an Apache server,
> > specifically with the error message:
>
> > 08-19 03:36:35.785: INFO/ActivityManager(56): Displayed activity
> > [package]/.VideoActivity: 492 ms
> > 08-19 03:36:50.965: ERROR/MediaPlayer(2000): Error (-1,0)
> > 08-19 03:36:50.965: DEBUG/VideoView(2000): Error: -1,0
>
> > In addition, it refuses to play back YouTube 3GP-encoded RTSP video
> > URLs with the same error, sometimes with the following warning
> > attached:
>
> > 08-19 03:51:19.055: WARN/PlayerDriver(859):
> > PVMFInfoErrorHandlingComplete
>
> > These same errors occur whether using setVideoPath() or
> > setVideoURI().  The Apache server records that VideoView tries to
> > watch the video:
>
> > 192.168.254.240 - - [18/Aug/2008:21:36:25 -0600] "HEAD /dump/flv/
> > dailytest.3gp HTTP/1.0" 200 - "-" "PVCore/5.02.00.00"
> > 192.168.254.240 - - [18/Aug/2008:21:36:40 -0600] "GET /dump/flv/
> > dailytest.3gp HTTP/1.0" 200 229635 "-" "PVCore/5.02.00.00"
>
> > And the HEAD response from the server looks okay:
>
> > HTTP/1.1 200 OK
> > Date: Tue, 19 Aug 2008 03:57:54 GMT
> > Server: Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/
> > 5.2.0-8+etch11
> > Last-Modified: Thu, 17 Jul 2008 01:56:49 GMT
> > ETag: "3a4c02f-38103-8ddeba40"
> > Accept-Ranges: bytes
> > Content-Length: 229635
> > Content-Type: video/3gpp
>
> > Is there something I'm missing?
>
> > In the Release Notes, it mentions that MediaPlayer can't play from
> > memory (InputStream).  Does this extend to the online video streams?
>
> > Is this related to the Release Note that describes that MediaPlayer
> > might
>
> > Unfortunately, the ability to play audio streams from memory (such as
> > via an InputStream or Reader) will not be possible in Android 1.0.
> > Streaming seems like a big deal--if this is the case are there any
> > recommended workarounds?
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to