2011-09-05 75 views
1

我有发挥逐渐流媒体视频和编码如下活动:的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。有任何想法吗?

+0

我可以得到您的网址来测试我的代码吗?我也从我的客户端接收到IP摄像头的rtsp实时流,并且采用H.264 AVC媒体格式。我从资源中了解到,它仅支持SDK 3.0及以上版本。我想知道您的链接如何支持Galaxy S –

回答