I created a simple app that has an option to play some remotely hosted videos. I used the code from the Android developer docs samples, and it works fine on a variety of devices, but on Droid Pro there’s an error “Sorry, we can’t play that video”. I’ve tried several other videos from other sources in case there was an encoding or compression issue, but all seem to produce the same error.
We’ve tried this on 2 different Droid Pro devices, and both have the same error.
All videos are mp4, and as mentioned above all work fine in various other devices (Samsung Galaxy SII, Nexus S, Droid 3, an HTC, etc).
Additionally, I used the 2 samples in the ApiDemos that come with the SDK (MediaPlayer_VideoDemo and VideoViewDemo), again with a few different videos, and these show the same error.
The YouTube app does play videos, so I assume there’s a way to do it.
Here’s the abbreviated code (minus error handling, progress feedback, etc):
import android.app.Activity;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
public class VideoActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
VideoView videoView = new VideoView(this);
setContentView(videoView);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
Bundle extras = getIntent().getExtras();
if (extras != null) {
String path = extras.getString("url");
Uri video = Uri.parse(path);
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
}
}
}
Any suggestions? TYIA.
Turns out the Droid PRO won’t play videos of a certain size (filesize? dimension? IDK). By resizing them to 320×180 (from 960×540), they work fine.