[android-developers] Media Player - using authntication
Hi We are trying to stream a live mp4 file (over http), that is protected by username and password on the server side. Looking at the wireshark recording I see that the android device receives a 401 message from the server but there is no attempt to send back an authenticated request In addition the device logs show that there are several attempts to connect, all fail (this is backed by the wireshark logs) See message in android logcat: E/NuCachedSource2: source returned error -1, 10 retries left Is there a way to allow the native layer of MediaPlayer perform the authentication handshake? Please advise Adaya -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/41737c2b-0797-463f-98aa-c83f006ab5b5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] Media player help
Hello there, I have problem in playing icecast stream radio through my android application any help will be appreciated. thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Media player help
How in the world do you expect anyone to help you? Are we supposed to be mind readers? Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Thu, Oct 11, 2012 at 3:14 AM, Ravi ravikant.sha...@tanzaniteinfotech.com wrote: Hello there, I have problem in playing icecast stream radio through my android application any help will be appreciated. thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] media player error (1, -4)
I'm trying to crate an app that will play a number of sound file saved within the app. I'm having trouble getting the media player to start however. Here is the code: public static final String LOG_TAG = BCA; public MediaPlayer mp; @Override public void onCreate(Bundle savedInstanceState) { Log.v(LOG_TAG, creating); super.onCreate(savedInstanceState); setContentView(R.layout.main_list); mp = new MediaPlayer(); mp.setAudioStreamType(AudioManager.STREAM_MUSIC); Log.v(LOG_TAG, set stream type); playMusic(); } public void playMusic() { try { mp.setDataSource(R.raw.music); Log.v(LOG_TAG, set data source); mp.setOnPreparedListener(this); mp.prepareAsync(); Log.v(LOG_TAG, preparing); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public void onPrepared(MediaPlayer mediaPlayer) { Log.v(LOG_TAG, finished preparing; starting); //if (!mp.isPlaying()) mp.start(); Log.v(LOG_TAG, started music); } It runs smoothly until the logtag preparing but finished preparing; starting never prints. Not sure what's going wrong in this segment. The media file is type .mp3 and the api is level 8 (2.1) thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Media Player full screen like youtube
Hi, I am not looking for making the screen to full screen. I am looking for video toggle between fullscreen and normal screen like youtube. On Fri, Jul 6, 2012 at 12:11 PM, TreKing treking...@gmail.com wrote: On Fri, Jul 6, 2012 at 12:24 AM, master revanth.andr...@gmail.com wrote: I there any API to make full screen mediaplayer. Try this first: http://lmgtfy.com/?q=android+set+fullscreen - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Media Player full screen like youtube
On Mon, Jul 9, 2012 at 6:26 AM, Revanth kumar revanth.andr...@gmail.comwrote: I am looking for video toggle between fullscreen and normal screen like youtube. OK. What have you tried so far? - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Media Player full screen like youtube
On Fri, Jul 6, 2012 at 12:24 AM, master revanth.andr...@gmail.com wrote: I there any API to make full screen mediaplayer. Try this first: http://lmgtfy.com/?q=android+set+fullscreen - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media Player full screen like youtube
Hi All, I am creating a library for a custom player, which contains mediaplayer to play video. The media player should toggle between fullscreen and normal screen like youtube. I there any API to make full screen mediaplayer. There is a method (setFullScreen()) of player in IOS to make full screen video. Thanks, Revanth -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media Player progressive download
Hi , I am new to android. i am developing an app that has the capabilities to play video. I used default media player. what i want is while streaming video through http i want to save the video in SD Card. so that next time i can play it from the SD card instead of playing from server. Can anyone please help me. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media player no video
Hi! I have a problem with playing videos through mediaplayer. I have a sound but no video. I was searching a lot of thread but can't find solve for my problem. Is is something wrong with the code? Or is it something else. Here's the code: public class TestStream1 extends Activity implements Callback{ MediaPlayer mMediaPlayer; String SrcPath = rtsp://184.72.239.149/vod/ mp4:BigBuckBunny_175k.mov; private SurfaceView mPreview; private SurfaceHolder holder; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mPreview = (SurfaceView) findViewById(R.id.myvideoview); holder = mPreview.getHolder(); holder.addCallback(TestStream1.this); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); holder.setFixedSize(400,300); mMediaPlayer = new MediaPlayer(); try{ mMediaPlayer.setDataSource(SrcPath); mMediaPlayer.setDisplay(holder); mMediaPlayer.prepare(); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mMediaPlayer.start(); }catch(Exception e){ Toast .makeText( TestStream1.this, Fail, Toast.LENGTH_LONG).show(); } } } -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media Player problem
hi guys, i'am a beginner in development, and i'am developing an app which i'm using ImageView and the image when it's clicked should play a sound for 6 sec, so i used MediaPlayer i start it inside the (switch case) all woks good, but the problem is when i click on the same imageview the sound will start inside the old one!!is there any way to handle the imageview or the screen till the sound is finish, also if i click the second image the sound will come together. this is a part of my code which may help to explain the problem: ImageView display @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.alphabets_menu); display = (ImageView) findViewById (R.id.main_view); MediaPlayer image_sound image_a = (ImageView) findViewById (R.id.image_a); image_a.setOnClickListener(this); public void onClick(View v) { // TODO Auto-generated method stub image_sound = MediaPlayer.create(this, R.raw.image_s); } switch (v.getId()) { case R.id.image_a: display.setImageResource(R.drawable.a); image_sound.start(); break; } thanks... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media player problem whit file audio stored in memory
hi guys i have this strange problem: i create a app, in this app i record voice in ogg file, i store file in memory (i see the file using DDMS) , when i wont to play the file audio i have a error in this link you can see the source: http://pastebin.com/PWE9FsxT in this link you can see the android manifest: http://pastebin.com/p39J1Y6i in this link you can see the log cat http://pastebin.com/ktyFWPXq i think the problem is in mediaPlayer.setDataSource(RECORDING_FILE_NAME); but I do not know how to fix it please help me best regads Antonio -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media Player stops abruptly with a warning in logcat: TimedEventQueue(33): Event 4 was not found in the queue, already cancelled?
I am trying to put background music in my app.I have created an intent service which creates a Media Player and starts the music. Once my app is launched the music is played only for a second and after that I see the following warning in my logcat:- 09-13 20:12:54.082: WARN/TimedEventQueue(33): Event 4 was not found in the queue, already cancelled? For every run of my App, the Event number changes.This time it was Event 5. Here is my service class which implements media player:- import android.app.IntentService; import android.content.Intent; import android.media.MediaPlayer; import android.media.MediaPlayer.OnErrorListener; import android.widget.Toast; public class MusicService extends IntentService { MediaPlayer mPlayer; private OnErrorListener mErrorListener; public MusicService() { super(MusicService); // TODO Auto-generated constructor stub } @Override protected void onHandleIntent(Intent intent) { // TODO Auto-generated method stub // Normally we would do some work here, like download a file. } /// @Override public int onStartCommand (Intent intent, int flags, int startId) { Toast.makeText(this, service starting, Toast.LENGTH_SHORT).show(); mPlayer.setLooping(true); mPlayer.start(); return super.onStartCommand(intent,flags,startId); } @Override public void onCreate () { super.onCreate(); // try{ mPlayer = MediaPlayer.create(this, R.raw.jingle); //}catch (IllegalArgumentException e) { //e.printStackTrace(); //}catch (IllegalStateException e ) { //e.printStackTrace(); //} if(mPlayer!= null) { mPlayer.setLooping(true); // Set looping mPlayer.setVolume(100,100); } mPlayer.setOnErrorListener(new OnErrorListener() { public boolean onError(MediaPlayer mp, int what, int extra) { // TODO Auto-generated method stub onPlayError(); return true; } }); } private void onPlayError() { Toast.makeText(this, music player failed, Toast.LENGTH_SHORT).show(); if(mPlayer != null) { try{ mPlayer.stop(); mPlayer.release(); }finally { mPlayer = null; } } } @Override public void onDestroy () { super.onDestroy(); if(mPlayer != null) { try{ mPlayer.stop(); mPlayer.release(); }finally { mPlayer = null; } } } } -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media player display black screen (flash) when release
Hi, all: I met an issue when using MediaPlayer to play a video. Every thing is fine until I release(/reset) the MediaPlayer. A black hole displayed on the surface view used by media player. I can't find a way to avoid the black screen. As you know, sometimes the users need to rotate the device, the activity will be recreated. This will cause to destroy the surface view, and recreate the media player. The bloack hole shows up. And then new ui (ratated) displayed. How can I avoid the black hole being showed every screen rotate or activity change. Is it possible? Best wishes Terry 2011-9-6 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] media player OnCompleteListener never called
I have tried to implement a streaming player. everything looks fine and the codes works. I have only problem that onCompleteListener is never called. hence im not able to update the UI or do something on play complete. Please tell me the possible things that i have to take care to make a mediaplayer work smoother. Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media Player Issues
I'm using a stream proxy (similar to the NPR method) to stream music to my device. When using this method certain songs will download approximately 64k worth of data, then the socket will report a 'Connection reset by peer' error. I believe the socket is being killed on the media player side for some reason. If one song does not work, then all of the songs on the same album do not work. The songs will play fine when not using the stream proxy, but instead just streaming straight from the server, however, I must use the stream proxy. The songs will play fine on my droid x but will not work on the Samsung Galaxy S or on the emulator. Any songs that were purchased off of Amazon.com will not play through the stream proxy either. All of the songs are mp3's and have the content-type of audio/mpeg3. If I remove all of the id3 information from the song, it plays fine through the StreamProxy. The songs that do not play seem to have a larger id3 tag size due to a larger album art cover. Any suggestions? Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] media player
hey i m new to android and when i m trying to play a video file using the below code i m having the proble m tht its not forwading (buffering is not being done)the video.and it is displying the first scene only. HERE IS THE CODE: package com.examples; import java.io.InputStream; import android.app.Activity; import android.graphics.PixelFormat; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.widget.MediaController; import android.widget.VideoView; public class MediaVedio extends Activity { /** Called when the activity is first created. */ private MediaController mc; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); VideoView video = (VideoView) findViewById(R.id.videoView1); Uri uri = Uri.parse(android.resource:// +getPackageName()+ /+R.raw.ansh1); mc = new MediaController(MediaVedio.this); video.setMediaController(mc); video.setVideoURI(uri); video.requestFocus(); video.isPlaying(); video.start(); } } -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media player problems with android 2.3 (gingerbread), I can't open a service connection....
I'm trying to setup a service connection to control the stock android media player. This works great under 2.1 and 2.2. However, when I tried to run my application on the 2.3 emulator my application crashes and I get the following error: ERROR/AndroidRuntime(466): Caused by: java.lang.SecurityException: Not allowed to bind to service Intent {cmp=com.android.music/.MediaPlaybackService } Have the permissions to bind to the IMediaServiceConnetion been revoked for gingerbread? Here is the code I'm running from my class that is a child of ServiceConnection Intent i = new Intent(); i.setClassName(com.android.music, com.android.music.MediaPlaybackService); a.bindService(i, (ServiceConnection) this, 0); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Media player problems with android 2.3 (gingerbread), I can't open a service connection....
Please understand that this is not part of the Android SDK. According to the source code, it is not exported, and therefore is not available outside of its process. On Mon, Dec 20, 2010 at 3:43 PM, neuromit stuart.lay...@gmail.com wrote: I'm trying to setup a service connection to control the stock android media player. This works great under 2.1 and 2.2. However, when I tried to run my application on the 2.3 emulator my application crashes and I get the following error: ERROR/AndroidRuntime(466): Caused by: java.lang.SecurityException: Not allowed to bind to service Intent {cmp=com.android.music/.MediaPlaybackService } Have the permissions to bind to the IMediaServiceConnetion been revoked for gingerbread? Here is the code I'm running from my class that is a child of ServiceConnection Intent i = new Intent(); i.setClassName(com.android.music, com.android.music.MediaPlaybackService); a.bindService(i, (ServiceConnection) this, 0); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Media Player For Android
create local server(Server Socket) on the phone and open stream on the file you want to play and write the buffers on to the server socket. On Mon, Dec 6, 2010 at 11:11 AM, chamith weerasinghe e05ch...@gmail.comwrote: Thanks... but I need to do a different thing.How I down load a audio file while it playing. I'm very new to android and want to do this. chamith On Mon, Dec 6, 2010 at 11:02 AM, nithya nataraj nithyan...@gmail.comwrote: Refer to the samples in android sdk android sdk /samples/api demos/media -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media Player For Android
Hi All, I want to build a application to play a audio file while downloading it. Here I want to use buffer. and put the downloaded audio to buffer and while downloading, play it. (Like Steaming). Please Help me... Chamith -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Media Player For Android
Refer to the samples in android sdk android sdk /samples/api demos/media -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Media Player For Android
Thanks... but I need to do a different thing.How I down load a audio file while it playing. I'm very new to android and want to do this. chamith On Mon, Dec 6, 2010 at 11:02 AM, nithya nataraj nithyan...@gmail.comwrote: Refer to the samples in android sdk android sdk /samples/api demos/media -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media Player
Hi all, I'm really stuck up with this. Our team recently bought an android 1.6 device. I know android 1.6 media player had some issues, But i need to make it work for 1.6, as thats the only device i have for demos. My code is as below MediaPlayer mp = new MediaPlayer(); mp.setDataSource(URL); mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.prepare(); mp.start(); this code always fails at mp.prepare(); This is a problem only with Android 1.6 Android 2.2 it works fine.. ERROR: D/PlayerDriver( 30): buffering (3) D/PlayerDriver( 30): buffering (12) D/PlayerDriver( 30): buffering (15) D/PlayerDriver( 30): buffering (18) D/PlayerDriver( 30): buffering (21) D/PlayerDriver( 30): buffering (25) D/PlayerDriver( 30): buffering (28) D/PlayerDriver( 30): buffering (31) D/PlayerDriver( 30): buffering (35) E/PlayerDriver( 30): Command PLAYER_INIT completed with an error or info PVMFFailure E/MediaPlayer( 200): error (1, -1) W/System.err( 200): java.io.IOException: Prepare failed.: status=0x1 W/System.err( 200): at android.media.MediaPlayer.prepare(Native Method) W/System.err( 200): at com.tcs.channels.mobile.ChannelsHome.playAudio(ChannelsHome.java:608) I NEED THIS WORKING ON 1.6 HAS ANYONE BEEN SUCSESSFULL ANY HELP WUD BE HIGHLY APPRECIATED. I have tried setting content type to audio/mpeg, tried writing the file to SD card first then playing it.. Everythin works on 2.2 but not on 1.6.. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] media player not looping properly
Hi all, I'm trying to play a looping background track in my app and it doesn't loop. The track starts playing and once it reaches the end all I hear is a weird crackly sound for a split second and then nothing else. Logcat doesn't show anything useful at the time. No errors/warning/ exceptions/etc. Here's how I'm doing it... During initialisation I call this: public static MediaPlayer MEDIA_PLAYER; private static boolean initMusicPlayer(InGameView p_inGameView) { MEDIA_PLAYER = MediaPlayer.create(p_inGameView.getContext(), R.raw.bgmusic); MEDIA_PLAYER.setOnErrorListener( new MediaPlayer.OnErrorListener() { public boolean onError(MediaPlayer p_mp, int p_what, int p_extra) { Log.e(MEDIA_PLAYER, ERROR: MediaPlayer: ( + p_what +) with extra ( + p_extra +) ); return false; } }); MEDIA_PLAYER.setLooping(true); return true; } Then, in the surfaceChanged of my InGameView (i.e. when things are good to go), I call MEDIA_PLAYER.start(); Can you guys see anything wrong with the above? Any ideas what could be causing this? All help greatly appreciated. cheers, kk. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media Player restarts during call
If the media player is streaming and audio file when you get a phone call, the audio either stops or restarts after the phone call. how do I fix this? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media Player - crop video for fullscreen mode
Hello, i'm using the android mediaplayer to display videos and i try to implement two modes: The first one is a simple fullscreen mode which scales the video to the maxiumum maintainable aspect ratio. Depending on the video size there are black bars on top/bottom or left/right. The second mode should scale the video to fill the full screen but to keep the aspect ratio. That means either the width or the height has to be cropped. And that is the problem. How to crop a video? For ImageView there is a scale type crop_center which crops the image on a predefined rectable. Is there a similiar solution for video? If i set the surface view to a bigger size than its parent container the surface view is automatically scaled to fill parent. Next try was to set negative margins in the parent layout but in vain. Another try was to place the surface view in a scrollview which also leads to strange behaviour. Any ideas? robber -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media Player bad behavior
My phone is Droid, version 2.01. I have a clip 1.mp4, 23456 bytes of data on my desktop. I transfer to SD card, woking fine. I UPLOAD to web server, then use PHP to download it to my phone. It's working fine and downloads exactly 23456 bytes, same filename. It's no longer playable. I then, download that clip again, using my desktop, same PHP downloading, transfer the new downloaded file to SD. It's still playing fine. With the bad downloaded file using phone, moving to desktop, no working. Note that they're all the same bytes and never been rename from server or phone at all. So what's the problem here? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-developers] media player source code
Dear sir Good morning to all. please send the media player source code to me. ** -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-developers] Media Player not working on HTTPS as Data source
Hi, I am able to play mp3 files from a HTTP server.I have given the link as Datasource and it is working fine.When I replaced the link with HTTPS then media player is not working.Please help to resolve this issue. Thanks in advance. Cheers, Kamal -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media player API's and File Permission problem
Hello, I am facing problem in playing mp3 file using mediaplayer API's. File is in application private folder say app_xyz file permission is -rw--- when file is created using File API's. So is there any way to change the file permission to -rw-rw---. without moving it to system folder say files Thanks Arpit Pradhan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media Player Issues With Song ID's
I'm making a basic media player that uses a cursor to query the playlist members. It does everything fine, but I cannot figure out how to play a song once I have it in a cursor. mSongList = Uri.withAppendedPath(ContentUris.withAppendedId(Playlists.EXTERNAL_URI, playlistId), Members.CONTENT_DIRECTORY); songsCursor = getContentResolver().query(mSongList, null, null, null, null); mSongId = songsCursor.getColumnIndex(Members.AUDIO_ID); columnTitle = songsCursor.getColumnIndex(Members.TITLE); columnArtist = songsCursor.getColumnIndex(Members.ARTIST); int id = songsCursor.getColumnIndex(Members._ID); mp = new MediaPlayer(); while(mSongsLeft = 0) { nextSong(); THIS IS WRONG ?? mSong = ContentUris.withAppendedId(mPlaylists, songsCursor.getInt(mSongId)); // try { mp.setDataSource(this, mSong); mp.start(); I just need the code to convert it into a proper uri or just get the path... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] media player....
can any one send me the right code for media player. ... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media player source code
Hi guys.. Im new to this android.. Where can i get the source code of Media player based on OpenCORE framework?? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media Player and FileDescriptor Issues
I'm attempting to play files located in a Sounds directory located in my assets directory. The code below is what im using in my Listener method of my activity try { AssetManager mgr = getAssets(); //Lets me get file as i i'm using the Tag object of a radio button to store the filename AssetFileDescriptor mgrFileDesc = mgr.openFd(Sounds/ + grp.getChildAt(chkId).getTag().toString()); FileDescriptor fd = mgrFileDesc.getFileDescriptor(); MediaPlayer mPlay = new MediaPlayer(); mPlay.setDataSource(fd); Toast.makeText(getBaseContext(),fd.toString() , Toast.LENGTH_SHORT).show(); mPlay.prepare(); mPlay.start(); } catch (IOException e) { // TODO Auto-generated catch block // e.printStackTrace(); Toast.makeText(getBaseContext(),ERROR:+ e.getCause() , Toast.LENGTH_SHORT).show(); } The first Toast message shows me that i have a FileDescriptor The IOException error is telling me that the e.getCause() is null. If i change the e.getMessage() it tells meprepare failed. status 0x1 I'm lost.. What im attempting to achieve overall is to create a dynamic list of radio buttons, that play a file. So i used the assetManager to work with the files in my assets folder, and was able to write the filename to the radioButtons Tag object, and then reference that in my listener method. If someone can point me in the right direction, to either debug this, or approach my task in a different manner. Thanks in advance -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Media player
Is there a way that I can get the media information (song title, genre, artist, etc) that is being played in the default music player? Does the default music player allows sharing of these kind of information? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] media player exception
Hi, I m trying to run a simple media player activity .. public void onCreate(Bundle icicle) { super.onCreate(icicle); try { /* * TODO: Set the path variable to a local media file path. */ setContentView(R.layout.mediaplayer_2); mPreview = (SurfaceView) findViewById(R.id.surface); holder = mPreview.getHolder(); // Create a new media player and set the listeners mMediaPlayer = MediaPlayer.create(this, R.raw.lucky); mMediaPlayer.setDisplay(holder); mMediaPlayer.prepare(); mMediaPlayer.setOnBufferingUpdateListener(this); mMediaPlayer.setOnCompletionListener(this); mMediaPlayer.setOnPreparedListener(this); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); } catch (Exception e) { Log.e(TAG, error: + e.getMessage(), e); } } public void onBufferingUpdate(MediaPlayer arg0, int percent) { Log.d(TAG, onBufferingUpdate percent: + percent); } public void onCompletion(MediaPlayer arg0) { Log.d(TAG, onCompletion called); } public void onPrepared(MediaPlayer mediaplayer) { Log.d(TAG, onPrepared called); mVideoWidth = mMediaPlayer.getVideoWidth(); mVideoHeight = mMediaPlayer.getVideoHeight(); if (mVideoWidth != 0 mVideoHeight != 0) { holder.setFixedSize(mVideoWidth, mVideoHeight); mMediaPlayer.start(); } but my application is crashing . my raw resource file is just 443 KB in size and it's in WMV here is stack trace I/ActivityManager( 567): Starting activity: Intent { action=android.intent.acti on.MAIN categories={android.intent.category.LAUNCHER} flags=0x1020 comp={Hel lo.Android/Hello.Android.HellAndroid} } I/ActivityManager( 567): Start proc Hello.Android for activity Hello.Android/.H ellAndroid: pid=731 uid=10019 gids={3003} D/AudioSink( 542): bufferCount (4) is too small and increased to 12 I/DEBUG ( 539): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** * ** I/DEBUG ( 539): Build fingerprint: 'generic/sdk/generic/:1.5/ CUPCAKE/148875:e ng/test-keys' I/DEBUG ( 539): pid: 731, tid: 731 Hello.Android I/DEBUG ( 539): signal 11 (SIGSEGV), fault addr 000c I/DEBUG ( 539): r0 bed344fc r1 0001 r2 a770 r3 I/DEBUG ( 539): r4 000c r5 bed344f8 r6 bed344c8 r7 bed34498 I/DEBUG ( 539): r8 bed34550 r9 41049d2c 10 41049d18 fp I/DEBUG ( 539): ip a9d46ce8 sp bed34488 lr a9d2635b pc ab222ba2 cpsr 800 00030 I/DEBUG ( 539): #00 pc 00022ba2 /system/lib/libmedia.so I/DEBUG ( 539): #01 pc 0001ffcc /system/lib/libmedia.so I/DEBUG ( 539): #02 pc 3f40 /system/lib/ libmedia_jni.so I/DEBUG ( 539): #03 pc e3b4 /system/lib/libdvm.so I/DEBUG ( 539): #04 pc 00040a8a /system/lib/libdvm.so I/DEBUG ( 539): #05 pc 00013118 /system/lib/libdvm.so I/DEBUG ( 539): #06 pc 00017b1c /system/lib/libdvm.so I/DEBUG ( 539): #07 pc 00017560 /system/lib/libdvm.so I/DEBUG ( 539): #08 pc 00052268 /system/lib/libdvm.so I/DEBUG ( 539): #09 pc 000596ee /system/lib/libdvm.so I/DEBUG ( 539): #10 pc 00013118 /system/lib/libdvm.so I/DEBUG ( 539): #11 pc 00017b1c /system/lib/libdvm.so I/DEBUG ( 539): #12 pc 00017560 /system/lib/libdvm.so I/DEBUG ( 539): #13 pc 000520ec /system/lib/libdvm.so I/DEBUG ( 539): #14 pc 0003f0f8 /system/lib/libdvm.so I/DEBUG ( 539): #15 pc 00031ac2 /system/lib/libdvm.so I/DEBUG ( 539): #16 pc 00028280 /system/lib/ libandroid_runtime.so I/jdwp( 731): received file descriptor 24 from ADB I/DEBUG ( 539): #17 pc 00028d7e /system/lib/ libandroid_runtime.so I/DEBUG ( 539): #18 pc 8bf2 /system/bin/app_process I/DEBUG ( 539): #19 pc 0001fd1a /system/lib/libc.so I/DEBUG ( 539): #20 pc bcb2 /system/lib/libc.so I/DEBUG ( 539): #21 pc b000157e /system/bin/linker I/DEBUG ( 539): stack: I/DEBUG ( 539): bed34448 I/DEBUG ( 539): bed3444c 0019231c [heap] I/DEBUG ( 539): bed34450 0019231c [heap] I/DEBUG ( 539): bed34454 a9d32a6b /system/lib/libutils.so I/DEBUG ( 539): bed34458 00191678 [heap] I/DEBUG ( 539): bed3445c a780 [heap] I/DEBUG ( 539): bed34460 bed3447c [stack] I/DEBUG ( 539): bed34464 000c I/DEBUG ( 539): bed34468 a770 [heap] I/DEBUG ( 539): bed3446c a9d2635b /system/lib/libutils.so I/DEBUG ( 539): bed34470 bed34498 [stack] I/DEBUG ( 539): bed34474 bed344fc [stack] I/DEBUG ( 539): bed34478 bed344f8 [stack] I/DEBUG ( 539): bed3447c a9d274b3 /system/lib/libutils.so I/DEBUG ( 539): bed34480 df002777 I/DEBUG ( 539):
[android-developers] media player that plays bbc radio (streaming)
Does any one know (atleast i don't) of a media player that plays live bbc radio? I have searched alot on android market but unable to fine one. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Media player problem : got the error (1,-15)
Hi friends, I am playing a progressive streamable content. I got the error (1, -15). I am not understanding this. Why the android guys doesn't specify any reference to all the error codes. And also, I didn't get any reference to the video file properties ( I mean the properties that the video file must have to be played successful like its video codec, video size, fps). Can any one please help me to solve this issue. Thanks, Manoj. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] media player does not display video, only audio coming, the screen turns black
Hi, I am trying to play mp4 video file from mediaplayer demo given in the api demos along with android sdk. I changed the path to /sdcard/video.mp4.. If i run mediaplayer_video demo, the audio output is coming, but no video is being displayed, the screen is black. when i seen the logcat, it reports, surfaceCreated called and surfaceChanged called. how to fix this... meanwhile, any videoplayer is available for android. Thanks and Regards, HarishKumar.V --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Media Player sound state problems in G1
Hi I am using MediaPlayer to play my sounds below is my another post http://groups.google.com/group/android-developers/browse_thread/thread/8d1c01b055873f39# I tried all the possible ways stated in the above post but could not play sounds accordingly so changed the sound code as below, Now the sounds are working fine and no sound is getting skipped but am getting some errors which i cannot figure why they are coming...? Below are some errors: 1- E/MediaPlayer( 2173): stop called in state 1 2- E/MediaPlayer( 2173): stop called in state 2 the above errors i get frequently and i get the below one's randomly, the game freezes and requires a force close when i encounter the below errors 3- E/MediaPlayer( 2173): setDataSource called in state 2 W/System.err( 2173): java.lang.IllegalStateException W/System.err( 2173):at android.media.MediaPlayer.setDataSource(Native Method) 4- E/MediaPlayer( 2173): setDataSource called in state 128 W/System.err( 2173): java.lang.IllegalStateException W/System.err( 2173):at android.media.MediaPlayer.setDataSource(Native Method) W/System.err( 2173):at android.media.MediaPlayer.setDataSource(MediaPlayer.java:247) 5- E/MediaPlayer( 2173): prepareAsync called in state 128 E/MediaPlayer( 2173): setDataSource called in state 128 W/System.err( 2173): java.lang.IllegalStateException W/System.err( 2173):at android.media.MediaPlayer.setDataSource(Native Method) 6- E/MediaPlayerService( 31): offset error E/MediaPlayer( 2173): Unable to to create media player I have observed that all the sounds played atleast once in the game without any error. I want to know what are the states 1,2 128 and why are the errors raised. As per the http://developer.android.com/reference/android/media/MediaPlayer.html#Valid_and_Invalid_States I suppose there is no problem in my code but y is that error shown...? Plz check the below code: public void stop() throws MediaException { try { mp.stop(); mp.reset(); FileInputStream fIn = Utils.getContext().openFileInput(fileName); if (fIn != null) { mp.setDataSource(fIn.getFD()); fIn.close(); } } catch(Exception e){e.printStackTrace();} isPlayingSound = false; } public boolean isPlayingSound; //class member MediaPlayer mp = null; String last_req = ; public void playSound(final String res) { if (isPlayingSound){ return; } try { if (!last_req.equals(res)) { last_req = res; mp = new MediaPlayer(); FileInputStream fIn = Utils.getContext().openFileInput(res); if (fIn != null) { mp.setDataSource(fIn.getFD()); fIn.close(); } mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void onCompletion(MediaPlayer mp) { try { mp.stop(); mp.reset(); FileInputStream fIn = Utils.getContext().openFileInput(res); if (fIn != null) { mp.setDataSource(fIn.getFD()); fIn.close(); } isPlayingSound = false; } catch(Exception e){e.printStackTrace();} } }); mp.setOnErrorListener(new MediaPlayer.OnErrorListener() { public boolean onError(MediaPlayer mp, int what, int extra) { mp.release(); mp = null; deleteSoundFile(res); isPlayingSound = false; last_req=; System.gc(); new PlayerImpl(fileName,fileInputStream); return false; } });
[android-developers] Media player -38 Error
Hi, I am trying to play media player.Its working fine but in log i am getting this kind of error Can anybody tell me why this error occured and how to solve this. 03-29 14:33:02.529: ERROR/MediaPlayer(1980): Error (-38,0) 03-29 14:33:02.539: ERROR/MediaPlayer(1980): start called in state 0 03-29 14:33:02.539: ERROR/MediaPlayer(1980): Error (-38,0) 03-29 14:33:02.539: ERROR/MediaPlayer(1980): start called in state 0 03-29 14:33:02.539: ERROR/MediaPlayer(1980): Error (-38,0) 03-29 14:33:02.539: ERROR/MediaPlayer(1980): start called in state 0 03-29 14:33:02.539: ERROR/MediaPlayer(1980): Error (-38,0) 03-29 14:33:02.549: ERROR/MediaPlayer(1980): start called in state 0 03-29 14:33:02.549: ERROR/MediaPlayer(1980): Error (-38,0) 03-29 14:33:02.549: ERROR/MediaPlayer(1980): start called in state 0 03-29 14:33:02.549: ERROR/MediaPlayer(1980): Error (-38,0) 03-29 14:33:02.549: ERROR/MediaPlayer(1980): start called in state 0 03-29 14:33:02.559: ERROR/MediaPlayer(1980): Error (-38,0) 03-29 14:33:02.559: ERROR/MediaPlayer(1980): start called in state 0 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] media player problem
Hi friends, I have developed a video playing application. I have a problem playing a video file. Actually it plays well (both audio and video are coming). But nothing is visible in the following scenario: The media file which is playing well when we first played, is not playing well when we play it after playing the high quality media file which wont play at all. scenario: play v1. --- playing well (both video and audio are coming). then play v2 (high quality media file) --- not playing at all(neither video nor audio are coming). then play v1 --- not playing well (it should play, but only audio is coming, no video is coming). here v1, v2 are video files. The log is here: I/MediaPlayer-JNI( 441): prepareAsync: surface=0x1e14f8 (id=2) D/MediaPlayerDemo( 441): surfaceChanged called E/MemoryHeapBase( 31): mmap(fd=20, size=233472) failed (Invalid argument) E/VideoMIO( 31): Error creating frame buffer heap D/MediaPlayerDemo( 441): onPrepared called can any one please help to solve this problem. Thanks, Manoj. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] media player error
i am also getting the same error while playing the media file E/MemoryHeapBase( 31): mmap(fd=20, size=233472) failed (Invalid argument) E/VideoMIO( 31): Error creating frame buffer heap any suggetions --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Media Player surprises me!
Can anyone help on this? Whenever I'm playing a Media file (mp3) from the sdcard in the emulator... And I try to read another file from the sdcard in parallel from an another thread, the Media Player stops! And doesnt even give any form of error.. Is only 1 read possible at a time from the sdcard?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Media Player blocks IO
Why does the Emulator block any Write to sdcard while a Media Player is playing an audio file? Is it because Media Player is reading from the sdcard at that time? So only one IO operation possible at a time? If thats the case, we can not work on any other file while listening to audio.. Is it the same with actual devices? What could be the work around for the same? Any suggestions ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Media player Problem-The application videoplayer has stopped unexpectedly please try again.
I am using the 0.9 version of android SDK Encountering the error The application videoplayer has stopped unexpectedly please try again. This is the code which I have Videoplayer.java package com.android.VideoPlayer; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import android.app.Activity; import android.graphics.PixelFormat; import android.media.MediaPlayer; import android.media.MediaPlayer.OnBufferingUpdateListener; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnErrorListener; import android.os.Bundle; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.webkit.URLUtil; import android.widget.EditText; import android.widget.ImageButton; public class VideoPlayer extends Activity implements OnErrorListener, OnBufferingUpdateListener, OnCompletionListener, MediaPlayer.OnPreparedListener, SurfaceHolder.Callback { private static final String TAG = VideoPlayer; private MediaPlayer mp; private SurfaceView mPreview; private EditText mPath; private SurfaceHolder holder; private ImageButton mPlay; private ImageButton mPause; private ImageButton mReset; private ImageButton mStop; private String current; /** * Called when the activity is first created. */ public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); // Set up the play/pause/reset/stop buttons mPreview = (SurfaceView) findViewById(R.id.surface); mPath = (EditText) findViewById(R.id.path); mPlay = (ImageButton) findViewById(R.id.play); mPause = (ImageButton) findViewById(R.id.pause); mReset = (ImageButton) findViewById(R.id.reset); mStop = (ImageButton) findViewById(R.id.stop); mPlay.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { playVideo(); } }); mPause.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (mp != null) { mp.pause(); } } }); mReset.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (mp != null) { mp.seekTo(0); } } }); mStop.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (mp != null) { mp.stop(); mp.release(); } } }); // Set the transparency getWindow().setFormat(PixelFormat.TRANSPARENT); // Set a size for the video screen holder = mPreview.getHolder(); holder.addCallback(this); holder.setFixedSize(400, 300); } private void playVideo() { try { final String path = mPath.getText().toString(); Log.v(TAG, path: + path); // If the path has not changed, just start the media player if (path.equals(current) mp != null) { mp.start(); return; } current = path; // Create a new media player and set the listeners mp = new MediaPlayer(); mp.setOnErrorListener(this); mp.setOnBufferingUpdateListener(this); mp.setOnCompletionListener(this); mp.setOnPreparedListener(this); mp.setAudioStreamType(2); // Set the surface for the video output mp.setDisplay((SurfaceHolder) mPreview.getHolder().getSurface()); // Set the data source in another thread // which actually downloads the mp3 or videos // to a temporary location Runnable r = new Runnable() { public void run() { try { setDataSource(path); } catch (IOException e) { Log.e(TAG, e.getMessage(), e); } try { mp.prepare(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Log.v(TAG, Duration: === + mp.getDuration());