Skip to content
Advertisement

Android VideoView not playing sample video on T-Mobile G2 (just audio)

What I’m trying to do is play the first video retrieved from the external SD card, which on my T-Mobile G2 turns out to be the sample video for the phone. Now I assumed that since it plays in the phones video player, that it’d have no problems playing in the VideoView in my test app.

However, all I get is the audio playing. I’m pretty sure the code is all fine. After all, it’s pretty simple.

All I can think is that maybe the phones video player uses some native playback function which supports more video formats?

I’ve also tried playing the mv4 (actually an MP4 file) and the 3gp files from this site http://support.apple.com/kb/HT1425, but pushing them on to the emulator SDCard. Both of them exhibit the same problem – there is audio, but no video!

Could I be missing a permission somewhere or what could explain this behavior?

Code:

JavaScript

Update

I’ve tried using android 1.5 and 1.6, but the problem still persists.

Also, I just checked logcat and there are no errors for any of the other files, but for the .3gp I get this error:

JavaScript

Advertisement

Answer

Wow, sometimes I hate the android documentation.

Turns out that in my case, I was specifying a background colour for the VideoView in xml, but instead of being the background colour which I assumed would show while the video is loading / buffering, it was in fact the foreground and being rendered over the video which was playing perfectly behind it! lol

So changing:

JavaScript

to

JavaScript

Works a treat for me and my videos are now showing! 🙂

Hope this helps someone!

Andy.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement