1

I have an Activity that plays progressively streaming videos and is coded as follows:

Layout

<?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>

Activity

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();
            }
        } );
    }    
}

This works fine on most devices, however my client has two devices, one is a samsung galaxy ace running 2.2. And the other one is a ideos U8150 (running 2.2), videos will not play on these two devices. The ideos has an error that pops up and says "Sorry, this video cannot be played" while the audio plays in the background and the samsung just has the same error, however when plugged into ddms the only output that may indicate an error is:

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.

I have encoded the videos in H264+AAC using the settings described here: http://developer.android.com/guide/appendix/media-formats.html and made sure the moov atoms are in the righ place with qt-fastart etc. See: http://www.sciencelearn.org.nz/content/download/7366/430467/version/14/file/08-future-of-radio-telescopes-sllg-ws.mp4

The videos play fine on 2.3.3, Motorola Xoom, Galaxy S, Galaxy Tab & HTC Desire. Any Ideas?

thepearson
  • 2,118
  • 3
  • 17
  • 24
  • Can I get your URL to test my code?I am also receiving rtsp live stream of IP camera from my client and it is in H.264 AVC media format. I learnt from resources that it supports only SDK 3.0 and above.I want to see how did your link support Galaxy S – Rashmi.B Dec 29 '11 at 05:58

1 Answers1

1

Refer the default video codec support for android, http://developer.android.com/guide/appendix/media-formats.html , H.263 MPEG-4 (.mp4), is a good choice for 2.2 devices,,,

Or for alternatives refer question : FFmpeg on Android

Community
  • 1
  • 1
Beep.exe
  • 1,340
  • 12
  • 18