Android 3.1 / Galaxy Tab / VideoView won't play - android

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?

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

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.

Related

VideoView fails to play video on certain devices

After recording a .mp4 video from a Samsung Galaxy S4 and uploading it to a server, I try to stream it on my Nexus 5 device in a VideoView which fails and Logcat shows this
E/MediaPlayer﹕ Error (1,-2147483648)
D/MediaPlayer﹕ Couldn't open file on client side, trying server side
The video turns out to be around 4.82mb and is recorded via intents
//VIDEO CAMERA
Intent cameraIntent = new Intent( MediaStore.ACTION_VIDEO_CAPTURE);
cameraIntent.putExtra( MediaStore.EXTRA_DURATION_LIMIT, 20);
cameraIntent.putExtra( MediaStore.EXTRA_VIDEO_QUALITY, 1 );
startActivityForResult( cameraIntent, TAKE_VIDEO_REQUEST_CODE );
The recorded video is playing properly on the Samsung device, and also when I download the file from the server to my PC it plays properly. I have tried downloading the file to my Nexus device and it still fails to play, tried to stream it within the VideoView and it fails with errors mentioned above each time. I have tried uploading a video from Nexus 5 and the Samsung device plays it properly. I am at a lost as to why this is happening, has anyone encountered a similar problem and found a fix or maybe I am doing something wrong?
Edit
It fails to play in any of the systems video players as well, but still plays on the original Samsung device.
Also I have tested a lower resolution and it works then, so now I think I need to find a way to change the resolution after video capture or send an instruction to use a certain resolution if possible. Any help with this aspect?
These messages are not indicative of an error:
E/MediaPlayer﹕ Error (1,-2147483648)
D/MediaPlayer﹕ Couldn't open file on client side, trying server side
You get these because streaming content can only be opened on the server side. You should get another error after these, e.g. Error (1,-1001). Most likely the S4 uses a profile that is not supported on Nexus 5.
As for resolution, the intent API you are using only supports 2 quality settings (high and low). Low means really low, and is device dependent.
To have more control over a video capture, you could use the Camera and the MediaRecorder interface. There is a guide at http://developer.android.com/guide/topics/media/camera.html#capture-video.
For a more advanced example, there is a sample project at http://developer.android.com/samples/MediaRecorder/index.html.

How to play inline HTML5 video using Phonegap for Android 4.1.1

I'm trying to embed an MP4 video in an Android Phonegap 2.9.0 application using the HTML5 video tag.
The application will be used at an exhibition and the video has to be played back offline on the device. The video also can't be played back in the native player as the back button will be locked, which I think rules out the VideoPlayer plugin (http://simonmacdonald.blogspot.ca/2011/11/video-player-plugin-for-phonegap.html).
I have set the hardwareAccelerated attribute to true, which should work on Android 4.x devices (see http://simonmacdonald.blogspot.co.uk/2012/10/partial-support-for-video-tag-in.html). I successfully got a video embedded and played back as desired from a folder on the SD card on a Motorola Xoom tablet (Android 4.0.4).
I then wanted to recreate the same on an Archos 97 Titanium HD tablet (Android 4.1.1), which will be the device used in the exhibition. Using the same code as on the Xoom (just with the folder path adjusted according to the device) the Archos tablet plays only the sound and the video itself stays black, apart from a line of changing pixels in the top left corner. If I switch to fullscreen mode the video plays fine.
Also if I stream the same video from a web server it plays back fine embedded in webview - again using the same code.
So it seems like it can cope with the video format and encoding in webview, but for some reason it does not work from the internal (or external) SD card.
Has anyone come across a similar problem and is there any solution?
Is there a problem version 4.1.1 of Android or is this likely to be an issue with the device itself?

HLS streaming on Galaxy S3

We are developing music streaming application for Android devices with adaptive bit rate support. We are using Wowza as streaming server which will stream songs using HLS. We have converted each song into four bitrates and have created smil files which are referred in HLS URLs. So basically final URL will look something like this.
http://streaming.server.name:1935/vod/smil:audiofile.smil/playlist.m3u8.
We have tested the app on multiple android devices ( Android version 4.0 or later ) including Galaxy S2, Galaxy Note I, Sony Experia, Google Nexus etc.. On all these devices the songs are getting streamed except on Galaxy S3. On Galaxy S3 the song starts and plays till 6 secs. After that the song goes in loop and plays again and again 6 sec part.
The same behavior is observed when the above URL is accessed through browser.
We have tried to check wowza logs but no errors were reported.
Has anyone tried such thing on S3 devices. Any guidance on how to debug this issue will be greatly appreciated.
The Android documentation states (not clearly enough though) that the TS container format only supports AAC audio. Your are trying to play HLS with TS segments containing MP3 audio data (which is supported by iOS).
I can share the observation that doing so works on most Android devices, but not on all.
The S-III is an example of that.
Please refer to the Android Supported Media Formats section in the documentation.

Android MP4 playback issue from URL

I am trying to play mp4 video from URL but my phone always give me error "sorry this video can not be played" instead if i download video from same URL then video plays fine at phone.
http://beta-vidizmo.com/hilton.mp4
Please tell me what i am doing wrong?
It also depends on the android version. Droid X and Samsung Captivate had a lot of trouble streaming MP4 files when it was in version 2.1, but after the Gingerbread update a lot of androids had this problem fixed.
Make sure you encode the video so that the moov atom is bought to the beginning. I think you can do this with QT Faststart.

mpeg-4 format not working in VideoView

I'm using a videoview to show a movie (which works on an htc desire). But this fails on the htc wildfire. I don't get a stacktrace, just android itself telling me it cannot play this movie. I thought mpeg-4 was generally working on android? I'm programming for api level 4. Does someone know why this format isn't accepted and which formats work?
MPEG4 is supported on Android when it is contained in the following container formats- .mp4, .3gp and .ts. I think you are trying to play a mpeg4 media content in .avi which is not supported.
Here is a list of all the media formats supported by Android.
This might or might not be your problem's solution but maybe it will help someone who lands here by search.
I couldn't get Android's VideoView from API example to play any file, but it was a mistake on my part.
I've type path from the root, example /videoFileName.mp4 and I should have type it with sdcard in between like /sdcard/videoFileName.mp4
2. My Sony Ercisson Xperia Arc was connected as a usb mass device storage at the same time I was running my app through adb, so internal sd card was unmounted and file could not be found. I've discovered this when I tryed same code on Samsung Galaxy S which behaves differently when connected.
Maybe the bolded part is your problem?

Categories

Resources