Hi there,

I was trying to serve video on sdcard by using HTML5 video tag with the url 
"content://com.android.htmlfileprovider/sdcard/videos/BigBuck.m4v"

Logcat tells me that the file descriptor couldn't be opened ... 

02-19 15:34:00.874: INFO/MediaPlayer(3993): uri 
is:content://com.android.htmlfileprovider/sdcard/videos/BigBuck.m4v
02-19 15:34:00.874: INFO/MediaPlayer(3993): path is null
02-19 15:34:00.878: DEBUG/MediaPlayer(3993): Couldn't open file on client 
side, trying server side
02-19 15:34:00.878: VERBOSE/MediaPlayer-JNI(3993): setDataSource: path 
content://com.android.htmlfileprovider/sdcard/videos/BigBuck.m4v
02-19 15:34:00.878: VERBOSE/MediaPlayer(3993): 
setDataSource(content://com.android.htmlfileprovider/sdcard/videos/BigBuck.m4v)
02-19 15:34:00.882: ERROR/MediaPlayerService(2397): Couldn't open fd for 
content://com.android.htmlfileprovider/sdcard/videos/BigBuck.m4v
02-19 15:34:00.882: ERROR/MediaPlayer(3993): Unable to to create media 
player
02-19 15:34:00.894: WARN/VideoView(3993): Unable to open content: 
content://com.android.htmlfileprovider/sdcard/videos/BigBuck.m4v
02-19 15:34:00.894: WARN/VideoView(3993): java.io.IOException: setDataSource 
failed.: status=0x80000000
02-19 15:34:00.894: WARN/VideoView(3993):     at 
android.media.MediaPlayer.setDataSource(Native Method)
02-19 15:34:00.894: WARN/VideoView(3993):     at 
android.media.MediaPlayer.setDataSource(MediaPlayer.java:745)

I looked into the source of mediaplayer's "public void setDataSource(Context 
context, Uri uri)" 
(http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/1.5_r4/android/media/MediaPlayer.java/?v=source)
 
and implemented the method  openAssetFile

    @Override
    public AssetFileDescriptor openAssetFile(Uri uri, String mode)
            throws FileNotFoundException {

        ParcelFileDescriptor pfd = this.openFile(uri, mode);
        AssetFileDescriptor afd = new AssetFileDescriptor(pfd, 0, 
pfd.getStatSize());

        Log.v("SHOUT", uri.getPath());

        return afd;
    }


But still, I cannot view the video on the sdcard with html5 video tag. Any 
help ^^?

mrkschan.

-- 
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to