I can stream some videos from URL (server) successfully,
But the others (my video up to my server) is not.
You can see both in my code (Working/Not working) I'm on stuck with this problem. "Sorry, this video is not valid for streaming to this device"
The following code :
String url = null;
// url = "rtsp://v5.cache5.c.youtube.com/CiILENy73wIaGQmC00ZlwwIDOxMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp"; // Working
// url = "http://daily3gp.com/vids/747.3gp"; // Working
url = "http://www.ooklnet.com/files/381/381489/video.mp4"; // Working
// url = "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov"; // Working
// url = "http://dl.dropbox.com/u/80419/santa.mp4"; // Working
// url = "http://trekvn.hostoi.com/encode_normal.mp4"; // Not Working
// url = "http://trekvn.hostoi.com/output_encode_mp4_box.mp4"; // Not Working
// url = "http://www.ourserversite.com:14556/ingCloud/users/400010001/mp4_320p/e8d8535852a98c949640c5d618ac23d320131022174507.mp4"; // Not Working
// url = "http://trekvn.hostoi.com/mpeg_2_ts.ts"; // Not Working
videoviewer.setVideoURI(Uri.parse(url));
videoviewer.requestFocus();
videoviewer.setKeepScreenOn(true);
videoviewer.setOnErrorListener(this);
videoviewer.setOnPreparedListener(this);
@Override
public void onPrepared(MediaPlayer mp) {
videoviewer.start()'
}
All of these video can play good on the site, have format *.mp4 (mpeg-4 part 10), Video : .H264, Audio : aac.
Please tell me why, and how to fix it.
p/s : Samsung Galaxy Tab 7" - 2.2.1
Thanks,
This is the issue that many people met, ensure you understand following content to fix the issue.
Through my experience and the answer in this Sorry, this video cannot be played - streaming mp4 to android
Finally, I found the reason and the solution:
- Reason : Almost the *.mp4 file was produced for developing focus on iOS, and have the encoding : H264 Main. While Android side can only stream & play the files have the encoding : H264 Baseline.
- Solution : We need convert from the encoding H264 Main to H264 Baseline (guaranteed enabled Web Optimized (move -moov atom before -mdat) feature)
- Bugs :
Sorry this video is not valid for streaming to this device.
Sorry, this video can not be played.
HandBrake tool is the easiest and cheapest way to complete it.
Thanks,
p/s : But if you use this method, you need upload your video to the server for testing.