Ahhh. Thanks for your response. The emulator's behavior makes a lot more sense now. I'll try out what you suggest.
Is this in the documentation anywhere? I looked around and everything I can find seems to say that video and audio are handled the same way. Maybe I just missed it, but if not this sort of information would be useful to have in an obvious place. On Feb 11, 2:12 am, Dave Sparks <davidspa...@android.com> wrote: > You can't play a resource file using VideoView by passing a pathname. > The file doesn't exist; it's just a binary blob inside the APK file. > If you create a content provider, you could pass a URI to setVideo(). > I'm not entirely sure that will work because the video file might be > compressed inside the APK. We exclude audio files from compression, > but I don't video files are excluded because they don't make a lot of > sense as a resource - they are too big. > > The simplest way to get this working is to copy the file to the SD > card. You can either "adb push" the file to the SD card or UMS mount > the SD card and copy it over from your host computer. Then modify your > setVideo(path) to "/sdcard/movie.mp4" (or whatever directory you put > it in on the SD card). > > On Feb 10, 11:21 pm, Brendan <raven...@gmail.com> wrote: > > > So I'm trying to do this: > > > VideoView video_view = new VideoView(context); > > video_view.setVideoPath("res/raw/movie.mp4"); > > video_view.setMediaController(new MediaController(context)); > > video_view.requestFocus(); > > video_view.start(); > > > Seems simple, but even with video files that I've seen work in other > > video players on the phone, I keep getting the "Sorry, this video > > cannot be played" message. And this associated debug info: > > > INFO/MediaPlayer-JNI(234): prepareAsync: surface=0x1a3ff0 (id=1) > > ERROR/MediaPlayer(234): Error (-4,0) > > DEBUG/VideoView(234): Error: -4,0 > > > Any ideas as to what those errors mean or how I can fix this? > > > If this is not how I should be using VideoView please let me know. I'd > > appreciate being sent in the right direction for how to get a local > > video file playing within a view. --~--~---------~--~----~------------~-------~--~----~ 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 android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---