我有發揮逐漸流媒體視頻和編碼如下活動:的Android 2.2 VideoView「對不起,視頻無法播放」與H264的MP4
佈局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<VideoView android:id="@+id/myVideo"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"/>
</LinearLayout>
活動
public class PlayVideo extends Activity {
public ProgressDialog progressDialog;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video);
progressDialog = ProgressDialog.show(this, "", "Loading...", true);
Intent i = getIntent();
startVideo(i.getStringExtra("videoUrl"));
}
public void startVideo(String videoUrl) {
final VideoView videoView = (VideoView) findViewById(R.id.myVideo);
videoView.setMediaController(new MediaController(this));
videoView.setVideoURI(Uri.parse(videoUrl));
videoView.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer arg0) {
progressDialog.dismiss();
videoView.requestFocus();
videoView.start();
}
});
}
}
這在大多數設備上都能正常工作,但是我的客戶端有兩個設備,一個是運行2.2的三星galaxy ace。另一個是ide81 U8150(運行2.2),視頻不會在這兩個設備上播放。該ideos有一個錯誤,彈出並說,「對不起,這個視頻不能播放」,而音頻在後臺播放和三星只是有同樣的錯誤,但是當插入ddms唯一的輸出可能表明錯誤是:
09-05 15:11:03.461: ERROR/QCvdec(95): Omx Flush issued when vdec is not initialized yet.
09-05 15:11:03.461: ERROR/QCvdec(95): Unsupported profile, level, or widht, height
09-05 15:11:03.461: ERROR/QCvdec(95): Unsupported clip
09-05 15:11:03.461: ERROR/QCvdec(95): Omx Flush issued when vdec is not initialized yet.
09-05 15:11:03.461: ERROR/QCvdec(95): Empty this buffer in Invalid State
09-05 15:11:03.461: ERROR/QCvdec(95): Omx Flush issued when vdec is not initialized yet.
我已經在這裏編碼描述H264 +使用的設置AAC視頻:http://developer.android.com/guide/appendix/media-formats.html並確保在MOOV原子與QT-fastart等右擊地方見:http://www.sciencelearn.org.nz/content/download/7366/430467/version/14/file/08-future-of-radio-telescopes-sllg-ws.mp4
在影片播放罰款在2.3.3,摩托羅拉Xoom,Galaxy S,Galaxy Tab & HTC Desire。有任何想法嗎?
我可以得到您的網址來測試我的代碼嗎?我也從我的客戶端接收到IP攝像頭的rtsp實時流,並且採用H.264 AVC媒體格式。我從資源中瞭解到,它僅支持SDK 3.0及以上版本。我想知道您的鏈接如何支持Galaxy S –