Android :: Streaming With MediaPlayer In SDK 8

Nov 17, 2010

SDK level 8 (Froyo) has introduced the native capability for the MediaPlayer to connect to a streaming source, like Shoutcast. Previous SDK versions were able to do workarounds, such as run a local proxy on the device (see NPR). I took the same approach as NPR and am using a StreamProxy. However, NPR first checks if the currently running SDK is less than 8. If so, it uses the proxy. Otherwise, it connects directly. My StreamProxy requests metadata from the Shoutcast server, so it does not simply route the data from Shoutcast to my client. Instead, it parses out metadata and uses it accordingly, and only routes the music data.

When trying to use the StreamProxy at SDK level 8 or above, the MediaPlayer fails to prepare. My StreamProxy receives the connection and accepts it, but after successfully writing out the status line and headers to the client, the next write produces "java.net.SocketException: Connection reset by peer". This results in the client's mediaplayer throwing an "Error(1,-1007)". I am trying to figure out why the MediaPlayer is unable to connect to my local proxy. It should be the same as connecting to the original source without the metadata, which does work. I am forwarding on all headers from the external source, through my proxy, which includes content-type.

Android :: Streaming with MediaPlayer in SDK 8


Android :: Mediaplayer With Streaming

Feb 17, 2009

I am developing a media player which will download the media content from network (Shoutcast) It works fine. Problem is a small gap between players (2 players) I am using two mediaplayers to play the data while a thread downloads and stores the data and stores in to 100Kb files continuously. on first players oncompletelistener() i started the second player wise versa. I think there is a problem with mp3 frames(header sync byte) while splitting 100kb files. how to resole the gap between players.

View 2 Replies View Related

Android :: Streaming To The MediaPlayer

Mar 24, 2010

I'm trying to write a light-weight HTTP server in my app to feed dynamically generated MP3 data to the built-in Android MediaPlayer. I am not permitted to store my content on the SD card. My input data is essentially of an infinite length. I tell MediaPlayer that its data source should basically be something like "http://localhost/myfile.mp3". I've a simple server set up that waits for MediaPlayer to make this request. However, MediaPlayer isn't very cooperative. At first, it makes an HTTP GET and tries to grab the whole file. It times out if we try and simply dump data into the socket so we tried using the HTTP Range header to write data in chunks. MediaPlayer doesn't like this and doesn't keep requesting the subsequent chunks.

Has anyone had any success streaming data directly into MediaPlayer? Do I need to implement an RTSP or Shoutcast server instead? Am I simply missing a critical HTTP header? What strategy should I use here?.................

View 4 Replies View Related

Android :: Streaming With Mediaplayer On 2.0

Dec 18, 2009

I have an app that streams mp3's from a server, works fine on 1.5 and lower. But on the droid, for certain songs the mediaplayer buffers to like over 50% but onPrepared() is never called. These same songs work fine on 1.5 or on a 2.0 emulator but for some reason they just hang on the actual droid phone. No mediaplayer errors are thrown but if i call stop or reset it while it is hanging like this, it throws this,

12-18 19:14:05.230: ERROR/MediaPlayer(15718): stop called in state 4 12-18 19:14:05.230: ERROR/MediaPlayer(15718): error (-38, 0) 12-18 19:14:05.238: ERROR/PlayerDriver(987): Command (6) was cancelled

it is only for certain files (yes they are all mp3s) and only on the droid. Anyone have any ideas why these songs would hang? I already checked the http headers and they are correct.

View 5 Replies View Related

Android :: Streaming Audio From URL Using MediaPlayer?

Dec 27, 2009

I've been trying to stream mp3's over http using Android's built in MediaPlayer class. The documentation would suggest to me that this should be as easy as :

MediaPlayer mp = new MediaPlayer();
mp.setDataSource(URL_OF_FILE);
mp.prepare();
mp.start();

However I am getting the following repeatedly. I have tried different URLs as well. Please don't tell me that streaming doesn't work on mp3's.

E/PlayerDriver( 31): Command PLAYER_SET_DATA_SOURCE completed with an error or info PVMFErrNotSupported
W/PlayerDriver( 31): PVMFInfoErrorHandlingComplete
E/MediaPlayer( 198): error (1, -4)
E/MediaPlayer( 198): start called in state 0
E/MediaPlayer( 198): error (-38, 0)
E/MediaPlayer( 198): Error (1,-4)
E/MediaPlayer( 198): Error (-38,0)

View 8 Replies View Related

Android :: MediaPlayer Streaming MP3 Over POST

Sep 17, 2010

I've got a question related to the Android MediaPlayer. Can it stream content through HTTP POST method , or do I have to write my own implementation? If so, what SDK do I have to use?

View 1 Replies View Related

Android :: MediaPlayer Streaming From PHP Redirect Does Not Work

Aug 25, 2010

The company I work for is developing an Android App that plays a video file from a URL on web. The
video URL is a parameter for a PHP script that encode it properly and redirects to the encoded video as shown below:

header('Content-Type: video/'.$format);
header('Location:'.$output_video);

Where $output_video is the URL to the encoded video (it works if we use this URL in the browser) and $format is the video format. But when I try executing the MediaPlayerDemo_Video from the API Demos using the streaming mode, I get an error like this:

MediaPlayer Command PLAYER INIT completed with an error or info PVMFErrCorrupt
MediaPlayer error (1. -10)
MediaPlayer Error (1.-10)

If we hard-code the URL and format in the PHP script, it also does not work out, but with a different error:

MediaPlayer info/warning (1. 28)
MediaPlayer Info (1 .28)

View 1 Replies View Related

Android :: Mediaplayer Online Streaming Formats

Sep 22, 2010

I am trying to create a small application for streaming radio broadcast that is in video/x-ms-asf format. the url has a .asx extension at the end. I have come to know that Android does not support this format currently, what other format for streaming broadcasts does it support so I can request that from the radio?

View 2 Replies View Related

Android :: Mediaplayer To Play Live Streaming Audio

Nov 8, 2010

In my music app, i would like to play live streaming like radio broadcasting with mediaplayer as Mediaplayer mp = new Mediaplayer(); mp.setDataSource(LiveStreamingURL); mp.prepare(); mp.start(); but after playing for few seconds it is stopped. I dont know how to overcome it. Give me your suggestions for this.

View 3 Replies View Related

Android :: MediaPlayer Stops Playing When Streaming Over 3G On The Nexus One

Apr 23, 2010

I am maintaining a streaming music player, and I'm running into a similar problem as http://www.last.fm/group/Last.fm+Android/forum/114391/_/593575

My player stop after roughly 1-2 minutes, and there are no log messages except for "I/AudioHardwareQSD( 52): AudioHardware pcm playback is going to standby" just after the playback stops.

This happens when I run it on the Nexus One over 3G. It does not happen over Wifi, and it does not happen on my HTC Hero with android 1.5 over 3G.

Do you guys have any hints on how to debug this? Is it e.g. possible to monitor the memory available to the media player object?

View 5 Replies View Related

Android :: MediaPlayer Provides Wrong Duration On Audio Streaming

May 27, 2010

I am having the following problem: I am using Android's MediaPlayer to play an mp3 through an HTTP connection. The audio is played correctly, but the MediaPlayer returns an incorrect duration (calling mediaPlayer.getDuration() ). Depending on the mp3 the duration is either shorter or longer. The code that plays the audio is the following:

mediaPlayer = new MediaPlayer(); mediaPlayer.setOnCompletionListener(this); mediaPlayer.setOnErrorListener(this); mediaPlayer.setOnPreparedListener(this); mediaPlayer.setOnBufferingUpdateListener(this); mediaPlayer.setDataSource("a valid URL"); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.prepareAsync();............................

View 2 Replies View Related

Android :: MediaPlayer.start - Doesnot Work Fine After Calling MediaPlayer.seekTo - 0

Apr 27, 2009

I have a requirement to play several sounds many times in my game so instead of creating the MediaPlayer again and again I have called mp.seekTo(0) in onCompletion(mp) so that it will restart. Sometimes the sound is not audible from the device when I call mp.start () after setting mp.seekTo(0); but the player calls onCompletion() without playing any sound, this is observed randomly on most of the sounds

My sounds are of short duration mostly less than a second.

I am using a separate MediaPlayer for each sound (as I need this) -

There are almost 28 sounds in my game so i will be creating 28 MediaPlayers.

Below is the attached code for player

Also If I try to play many sounds one after the other in a short period of time i get an error saying "no more track names available". can u tell Why this is happening...?

check the below code:

CODE:........

View 9 Replies View Related

Android :: MediaPlayer API

Apr 7, 2009

How to play the file which is present in MY computer For Eg : Path="D:/Vinod/Songs" can any body give the way to play the audiao file from files in system .....

View 3 Replies View Related

Android :: MediaPlayer And 1.5 Vs 1.6

Oct 20, 2009

In 1.6 I do the following to stream an mp3 shoutcast stream:

CODE:...........

This works great. However, I have to support phones running 1.5 as well. When I build against the 1.5 libraries and run in a level 3 emulator, I get an exception on the prepare() call with the message: Prepare failed.: status=0x1.

Is this supported in 1.5. Is there some other mechanism I have to use that will work in both?

View 11 Replies View Related

Android :: MediaPlayer Bug

Aug 10, 2009

I have such code:..............

When my sound played for the first time, it's all fine. But when for second, third, etc.. it sounds like cutted, just little part of my "click.wav". If I put there sound in another format like mp3 or ogg - all just fine.

Or if I write like this: mp_click = MediaPlayer.create(CubeTest_Main.Context, R.raw.click); mp_click.start(); All if fine too, but this is a bit slow, becouse this sound is playing very often.

View 5 Replies View Related

Android :: MediaPlayer SDK ?

Aug 1, 2010

I have a program with a function copied below it plays a sound upon clicking a button. If you click the button 10 times 10 different media players play the same sound that is the way i want it but how can i assign a button to stop all 10 media players at a time like a "STOP ALL BUTTON"

CODE:..............

The code above only stops the last instance of mp.

View 1 Replies View Related

Android :: How To Know The Status Of MediaPlayer?

Mar 3, 2009

I am developing a media player application which downloads from internet and plays. so while downloading I want to show a progress bar saying "buffering...", and while playing I want to dismiss the same progress bar. I can display the progress bar while downloading (by implementing the listener onBufferedUpdateListener), how can I get the event for player while it is playing.

View 6 Replies View Related

Android :: Cannot See Video When Using MediaPlayer

Jan 20, 2010

Attached is my code, I cannot see the video while playing a MPG file.

CODE:................

View 6 Replies View Related

Android :: Issue With MediaPLayer

Apr 26, 2010

This is my script:

CODE:..................

View 5 Replies View Related

Android :: Can't Stop Mediaplayer

Jul 21, 2009

I develop a music play app, whe app framework is:

list.java->play.java

eg: in the list.java there have two mp3 files : 1.mp3,2.mp3 when first time choose 1.mp3, then play ok, then back to list.java from play.java, and now the 1.mp3 is still playing, and then i click 2.mp3 in the list.java, and go to play.java, but it play 1.mp3 and 2.mp3 simultaneously? but i have used the mediaplayer.stop(); mediaplayer.release(); and it always play 1.mp3 and 2.mp3 simultaneously? i want stop 1.mp3 and play 2.mp3.

View 7 Replies View Related

Android :: Mediaplayer Error - 4

Jun 19, 2009

a mp3 file which can be played well in sdcard. but when i copy it to another subarea in linux linked as /data/test. but i can not be played in that directory

View 2 Replies View Related

Android :: EVO Failing In MediaPlayer

Jul 7, 2010

We are seeing some very strange results in media playback on HTC EVO devices.

In our call to MediaPlayer.create(getApplicationContext(), uri), we get failures with the following stack trace:

CODE:..................

This code works just fine for many, many thousands of other devices out there.

View 4 Replies View Related

Android :: MediaPlayer And OnRetainNonConfigurationInstance

Mar 18, 2009

I know this question has been asked previously because I have read the other postings over a hundred times but yet I cannot come up with an answer on how to use keep a MediaPlayer object playing over an orientation change. I've read that you can use onRetainNonConfigurationInstance() to pass an object to your future self when the activity is destroyed/recreated, but I can't keep a video playing in this circumstances. Does anybody have an example or an advice/guide on how to do this? or rather what do I pass on onRetainNonConfigurationInstance() to keep the video playing after an orientation change?

View 3 Replies View Related

Android :: Using MediaPlayer Best Practices

Nov 3, 2009

What is the best way to use the MediaPlayer when needed multiple times?

Reuse the instantiated MediaPlayer throughout the session? Or constantly stop() release() and instantiate a new MediaPlayer() ?

If I reuse I'm afraid the player could be in a bad state? What about performance wise? what's better? reuse or renew?

This is for using as a music player so one audio be present at one given time...

View 4 Replies View Related

Android :: Set Sdp File In MediaPlayer

Jan 22, 2009

I want to play a video file sitting in a server by setting local sdp file in the mediaplayer.

How to set the mediaplayer to read the local sdp file and start playing depending on the sdp connect (if it has unicast/multicast, start corresponding session)? I want to test unicast for now.

View 3 Replies View Related

Android :: Implementation Of Mediaplayer

Feb 22, 2009

I have run mediaplayer in SDK which can play media in res/raw folder successfully on emulator , but now I wanted to run it on my hardware which have already successfully implemented the android kernal and file system and audio, video drivers etc. I have no experience to implement JAVA app . I once implemented mplayer app written in C to my linux OS which only need to copy the final executable file , but now I don't know which files or folder should I copy to my platform because I have no basic knowledge of Java although I have run successfully on my emulator.

View 5 Replies View Related

Android :: MediaPlayer Now Working

Jul 5, 2009

I try to recived rtsp or mms audio stream for a long time, simply use the code to recive audio stream: myPlayer1.setDataSource("mms://....");myPlayer1.prepare(); myPlayer1.start(); I search for this topic for all discussions, and get some conclusions from all discussions: (a) sdk 1.1 not support for stream but sdk 1.5 could. (b) someone says stream can't work on the emulator because the firewall issue.But in fact,my computer without firewall,and i also try in the htc G1 mobile but still can't work!(sdk 1.1) (c)almost everyone got the same error from "prepare()" function.the error message from "adb logcat" Can someone or android engineer give some tips? because i search for this topic long time,and no answer, no one can success.

View 4 Replies View Related

Android :: MediaPlayer GetCurrentPosition On 2.2

Aug 4, 2010

Looking for some guidance on MediaPlayer issues on Android 2.2. I've confirmed that the below code works on Android 1.5 (an ADP1). I'm playing back an MP3 file using a MediaPlayer instance and using a ProgressBar to track the progress. The method that updates the progress bar is invoked from a Handler every second. On the ADP1 this results in a correct update rate (the countdown timer moves about a second every second) and steady progress on the ProgressBar. However, the exact same code deployed on the Nexus 1 results in about a half second update in the count down timer every second.

The code that updates the ProgressBar and captures the timer information is

CODE:.......................

I modified the code to log the method invocation, and it appears that the method is accurately called every second, but the calls to getCurrentPosition do NOT appear to work correctly. I noticed that there is an open issue, http://code.google.com/p/android/issues/detail?id=2559, talking about incorrect getCurrentPosition results: could this be what I'm seeing?

CODE:.........................

View 2 Replies View Related

Android :: 2 Mediaplayer Using One Surfaceview

Jun 16, 2009

I want to play 2 videos one after one minimizing delay between each video. so I created 2 mediaplayer, one playing the current video and the other preparing to play the following video.

The 1st video is played correctely but I couldn't get the video track of the second video. only sound without any error.

This is my source code : (note that here, I am using files on sdcard but the application will use files on a web server. that's why I need to prepare the second video while the 1st is playing)

CODE:...................................

View 5 Replies View Related

Android :: MediaController In MediaPlayer

Jun 4, 2010

I am using MediaPlayer to build a Video player for playing local video files. However, I don't know how to enable MediaController for my player. I want the media control buttons that pop up when you touch the video surface.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved