1

I have .mp4 file. If I placed it in the memory card, android's default video player can play it normally. But If I upload it to the web server and try to play it through the web browser of Android, it is giving mag saying, "Sorry, the video is not valid for seaming to this device."

The same is happening is I want to play it through my App. I used the following code:

private SurfaceHolder holder;
mPreview = (SurfaceView) findViewById(R.id.surface);
holder = mPreview.getHolder();
holder.addCallback(this);
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setDataSource("http://www.languagehostess.com/videos/aka1.mp4");
mMediaPlayer.setDisplay(holder);
mMediaPlayer.prepare();
mMediaPlayer.setOnBufferingUpdateListener(this);
mMediaPlayer.setOnCompletionListener(this);
mMediaPlayer.setOnPreparedListener(this);
mMediaPlayer.setOnVideoSizeChangedListener(this);
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 

It is giving the follwing error:

Command PLAYER_INIT completed with an error or info PVMFFailure

What is the problem related the that video or code?

dev_android
  • 8,698
  • 22
  • 91
  • 148
  • Are you sure the link is working. Bcoz when I tried to open it in browser, it showed file not found error. – Andro Selva Aug 05 '11 at 09:55
  • Did you try hinting the video? Have a look at [here](http://stackoverflow.com/questions/5794794/how-can-i-make-it-play-video-on-andriod-iphone/5800781#5800781) – Muhammad Razib Aug 05 '11 at 10:37

1 Answers1

1

You need to check the Android Video Encoding Recommandations . Make sure that your video is encoded with the supported code, and your video respects the resolutions. I had the exact same issues and after the video were properly encoded the streamming worked.

Also if you didn't noticed yet, usually the emulator does not play them, and you'll have to test on a real device.

Ovidiu Latcu
  • 71,607
  • 15
  • 76
  • 84
  • Ya, I am testing i real device only. I have tested the specific video in placing it in the memory card. From memory card card it is running fine. If it is problem related encoding, it should not play from memory card also. – dev_android Aug 05 '11 at 09:00
  • I told you. It is a encoding issue. I had the same exact problem. Video was playing from card but not from stream. Check that article again and in the bottom read what are the requirements so that your video can be streamed on your device. – Ovidiu Latcu Aug 05 '11 at 12:42
  • Hi guy's I have 1 issue please go through it.... when the video is streaming through url then it get crashed sometime, and the video quality is not good as compare to youtube videos... so, can you please share your ideas... ?? – kamal_tech_view Dec 19 '11 at 12:18