PVMFErrContentInvalidForProgressivePlayback MediaPlayer IOException: Prepare failed.: status=0xC8 - android

I want to play video from a URL via HTTP. I read Media Tutorial and other stackoverflow questions. Here is my code:
String url = "http://..../myVideo.mp4"
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(url);
mediaPlayer.prepare();
mediaPlayer.start();
mediaPlayer.prepare() is throwing IOException: Prepare failed. For the test purpose I record a video using my mobile phone and then I put the mp4 file to server.

I missed this line from stack trace:
08-17 14:36:58.005: ERROR/PlayerDriver(1943): Command PLAYER_INIT completed with an error
or info PVMFErrContentInvalidForProgressivePlayback
The problem is: my video is not capable of progressive download.
The only solution I figured out is using MP4Box which can be downloaded from here.
To make video ready for android I just run MP4Box.exe -hint myVideo.mp4.

Related

Android MediaPlayer Won't Stream from HTTP

When setting a MediaPlayer DataSource to a HTTP URL as opposed to an HTTPS URL, no audio streams and MediaPlayer error code -38 is displayed in logs.
I attempted to connect to the stream using ExoPlayer instead, and received this error. Following the docs suggestion, I added the following line of code to the application tag of my application's manifest file:
android:usesCleartextTraffic="true"
I am now able to connect to the stream at HTTP URL using both ExoPlayer and MEdiaPlayer.

URl not played in android MediaPlayer

I'm working media palyer app, in this i need to stream audio from URL. In my case some URL's are not streamed in some devices (Eg. Samsung Note III), after a long time i got this error message in onError() method.
E/MediaPlayer(24445): error (1, -1004)
I used the following code to pay url.
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(songPreViewUrl);
mediaPlayer.setOnPreparedListener(BackgroundAudioService.this);
mediaPlayer.setOnCompletionListener(BackgroundAudioService.this);
mediaPlayer.setOnBufferingUpdateListener(BackgroundAudioService.this);
mediaPlayer.prepareAsync();
Can any one please share the suggestion, why the urls are not streams in Samsung devices.

Hot to get live streaming data in android

I am trying to make an app which gets livestreaming camera videos. I can stream my webcam from my laptop on the ip (for example ip:176.33.226.53:8070), by using the 1AVStreaming program but I can't reach the streaming video in my code.
Media Player can directly work with the url itself.
Look for something like
Uri myUri = Uri.parse("http://your/video/file/path");
MediaPlayer player = new MediaPlayer();
player.setDataSource(context, myUri);
player.prepare();
Use MediaPlayer.OnPreparedListener to show controls or start the video
Their are various examples available. Just Google It

live audio streaming in android

I am facing problem to play a audio url using MediaPlayer as well as native Android audio player.
Here is my url
http://live.politiafm.com:8500/politiafm.mp3
Here is my code
Using native audio player
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(STREAM_URL), "audio/*");
StartActivity(intent);
Using Media Player
MediaPlayer mp = new MediaPlayer();
mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
mp.create(Landing.this, Uri.parse(STREAM_URL));
mp.prepareAsync();
mp.start();
In both the cases audio is not playing. Can some body help me out from this trouble.
Thanks & Regards
I guess it is to late a reply but in case if you are still facing the same problem,
you need to enable mime type for your server based on the type of the server. The MIME types are something you can learn from here how to enable them for Tomcat Server, IIS Server or Apache, whichever your mp3 file is hosted on : http://www.developershome.com/wap/wapServerSetup/tutorial.asp?page=settingUpMIME
Thanks
try changing
mp.prepare();
not
mp.prepareAsyunc();

Android MediaPlayer error -1004 (ERROR_IO)

My application plays audio stream
Here the code:
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(url);
mediaPlayer.prepare();
mediaPlayer.start();
url is local file (127.0.0.1)
I use my own HttpServer which runs on the same phone.
After call to
mediaPlayer.prepare();
I get the error:
error (1, -1004) which is ERROR_IO
Any idea what is this error?
Thanks, Costa.
the problem is php5 which sends a 500 http header if your server does not send the correct headers
Android MediaPlayer error -1004 (ERROR_IO)
You can use mediaPlayer.prepareAsync(), but not mediaPlayer.prepare().
Please try it...
The problem was with HTTP server.
I used alternative server:
http://www.prasannatech.net/2008/10/simple-http-server-java.html
And it works great!
I change my video from mp4 to 3gp.
Its work for me.

Categories

Resources