6

My app downloads a video file from a server and plays it using VideoView. I am using a H264 (AVC) encoded file in an .mp4 container.

On my Motorola Xoom with 3.0.1, it works perfectly.

On my Samsung Galaxy Tab 10.1 with 3.1, it does not work. I simply get an error message 'Sorry, the video cannot be played'. Trapping the error in code simply gives me 'MEDIA_ERROR_UNKNOWN'.

I suspect a codec problem (despite my codec being valid, according to http://developer.android.com/guide/appendix/media-formats.html). I take the same video file and manually copy it to the device - the device prompts me to convert the video. The resulting file plays fine in the Video app on the device. I take the file back off the device (inspected it in VLC tells me the video codec is now mp4v) and try to play it through my app - same result.

Is there something specific about 3.1, or the Galaxy Tab, that is causing this problem?

TheNextman
  • 12,428
  • 2
  • 36
  • 75
  • 2
    I guess you already selected an answer but just wanted to inform you that I have exactly the same problem on my Galaxy Tab. The same video runs fine on Nook Color, Kindle Fire, and a few other tablets I have here. When I switch to a lower res video it works fine on the Galaxy Tab. It might be that there is some size limitation? This seems odd since the Kindle has a much smaller screen resolution. How did you end up solving it? – Joris Weimar Mar 08 '12 at 23:04
  • 1
    So I got my Tab to play back video by putting it on the SD card storage. *However* it's still remarkably picky about what videos it will play... Android SDK says that H.264 AVC in mp4 should work (http://developer.android.com/guide/appendix/media-formats.html) - I have several such videos and they play on my other devices, but not my Tab. In the end I resorted to converting videos for the TAB using the Samsung Kies software... I hadn't considered that resolution/size might be the issue. I'd be interested if you ever figure this out - I can find no documentation from Samsung – TheNextman Mar 09 '12 at 13:38
  • 2
    For me different video resolutions do not work. The video is copied on the SD card at the startup of the Application. The odd is that the video is not played while the audio is perfectly clear and audible! I tested it on the Nexus tab. And, obviously, it works like a charm. So probably it is something else rather than the video resolution / codec. But I don't know what... – 2dvisio Jul 26 '12 at 15:56

2 Answers2

1

Double check the download/play location. Since it's a different device manufacture the path to the file might be slightly different

Brent Hacker
  • 394
  • 2
  • 8
  • 26
  • Thank you. Through ADB, I see that the path to the file is the same in both cases: /data/data/[packagename]/files/local/[someguid].mp4 – TheNextman Feb 28 '12 at 14:25
  • to rule out a codec issue, after you download the file on the device it does not work on, open it with a different video app such as rockplayer or your device's default app to check it will play. – Brent Hacker Feb 28 '12 at 15:13
  • So that's telling me it's the app itself. Perhaps for some reason it's trying to play the file before it's downloaded? – Brent Hacker Feb 28 '12 at 15:23
  • Interesting. If I embed the video in my raw directory and set the VideoView URI to the resource, it plays. However, my app doesn't try to play the video until it's downloaded, but I think this is definitely along the right lines... – TheNextman Feb 28 '12 at 16:14
1

The issue is as described here:

Can a videoview play a video stored on internal storage?

My app stores the files on internal storage. The Xoom I was using to test was rooted, and therefore permissions were not a problem. However the Galaxy is not rooted, so videos would not play.

Community
  • 1
  • 1
TheNextman
  • 12,428
  • 2
  • 36
  • 75