Tutorial: Custom Media Streaming for Android's MediaPlayer

Tutorials with advanced 'difficulty' and more Lines of Code.

Re: Tutorial: Custom Media Streaming for Android's MediaPlay

Postby Paul72 » Sat Sep 25, 2010 8:15 pm

Hello all - I recently loaded biosopher's tutorial, but I'm having trouble playing files back through it. The streaming seems to be working (progress bar shows file is loading and when it is completed) but the file doesn't play after that.

Any suggestions?
Paul72
Freshman
Freshman
 
Posts: 7
Joined: Sat Sep 25, 2010 8:08 pm

Top

Re: Tutorial: Custom Media Streaming for Android's MediaPlay

Postby ankitpatel » Mon Oct 11, 2010 6:30 am

Hello There

I have tried this tutorial and it works absolutely great..!!!

But I am getting small puses while streaming live stream
and elso getting following error in console

10-11 16:24:14.998: ERROR/MediaPlayer(7866): pause called in state 128

10-11 16:24:14.998: ERROR/MediaPlayer(7866): error (-38, 0)

10-11 16:24:15.178: ERROR/QC_MP3DEC(1074): component init: role = OMX.qcom.audio.decoder.mp3

10-11 16:24:15.178: ERROR/QC_MP3DEC(1074): IN thread created!

10-11 16:24:15.178: ERROR/QC_MP3DEC(1074): OUT thread created!

10-11 16:24:15.178: ERROR/QC_MP3DEC(1074): unknown param 0ff7a347

10-11 16:24:15.418: ERROR/MediaPlayer(7866): Error (-38,0)

10-11 16:24:15.418: ERROR/com.AudioPlayer.AudioPlayer$3(7866): Error in MediaPlayer: (-38) with extra (0)

10-11 16:24:25.088: ERROR/QC_MP3DEC(1074): COMPONENT DEINIT...

10-11 16:24:25.088: ERROR/QC_MP3DEC(1074): Component-deinit being processed m_drv_fd 8

10-11 16:24:25.088: ERROR/QC_MP3DEC(1074): Killing timer thread...

10-11 16:24:25.088: ERROR/QC_MP3DEC(1074): Timer thread exited

10-11 16:24:25.098: ERROR/QC_MP3DEC(1074): Component-deinit success

10-11 16:24:25.098: ERROR/QC_MP3DEC(1074): OMX MP3 component destroyed

10-11 16:24:25.258: ERROR/QC_MP3DEC(1074): COMPONENT DEINIT...

10-11 16:24:25.268: ERROR/QC_MP3DEC(1074): Component-deinit being processed m_drv_fd 20
10-11 16:24:25.268: ERROR/QC_MP3DEC(1074): Killing timer thread...
10-11 16:24:25.268: ERROR/QC_MP3DEC(1074): Timer thread exited
10-11 16:24:25.268: ERROR/QC_MP3DEC(1074): Component-deinit success
10-11 16:24:25.268: ERROR/QC_MP3DEC(1074): OMX MP3 component destroyed
ankitpatel
Freshman
Freshman
 
Posts: 2
Joined: Thu Oct 07, 2010 6:05 am

Re: Tutorial: Custom Media Streaming for Android's MediaPlay

Postby seanyc111 » Wed Oct 13, 2010 11:50 am

i cant get any playback from the app
and when i try it on a phone it stops unexpectedly wots da crck???
seanyc111
Junior Developer
Junior Developer
 
Posts: 14
Joined: Wed Oct 13, 2010 11:10 am

Re: Tutorial: Custom Media Streaming for Android's MediaPlay

Postby ravi_nayaka11 » Thu Jan 13, 2011 11:31 am

hi,im developing video streaming from url please send me code,thx in advance.
ravi_nayaka11
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Jan 13, 2011 11:01 am

Re: Tutorial: Custom Media Streaming for Android's MediaPlay

Postby zephir » Thu Feb 03, 2011 12:31 pm

Hello,

I know this Post is quite old but i believe its still relevant, since many people still have problems with MediaPlayer-only streaming.

so i downloaded the source code provided on the blog and ran it. turns out the server hosting the target mp3 file is down. so i edited the stream url. now i get this:

02-03 11:09:10.672: ERROR/com.pocketjourney.media.StreamingMediaPlayer(540): Error updating to newly loaded content.
02-03 11:09:10.672: ERROR/com.pocketjourney.media.StreamingMediaPlayer(540): java.lang.NullPointerException
02-03 11:09:10.672: ERROR/com.pocketjourney.media.StreamingMediaPlayer(540): at com.pocketjourney.media.StreamingMediaPlayer.transferBufferToMediaPlayer(StreamingMediaPlayer.java:222)
02-03 11:09:10.672: ERROR/com.pocketjourney.media.StreamingMediaPlayer(540): at com.pocketjourney.media.StreamingMediaPlayer.access$3(StreamingMediaPlayer.java:219)
02-03 11:09:10.672: ERROR/com.pocketjourney.media.StreamingMediaPlayer(540): at com.pocketjourney.media.StreamingMediaPlayer$5.run(StreamingMediaPlayer.java:272)
02-03 11:09:10.672: ERROR/com.pocketjourney.media.StreamingMediaPlayer(540): at android.os.Handler.handleCallback(Handler.java:587)
02-03 11:09:10.672: ERROR/com.pocketjourney.media.StreamingMediaPlayer(540): at android.os.Handler.dispatchMessage(Handler.java:92)
02-03 11:09:10.672: ERROR/com.pocketjourney.media.StreamingMediaPlayer(540): at android.os.Looper.loop(Looper.java:123)
02-03 11:09:10.672: ERROR/com.pocketjourney.media.StreamingMediaPlayer(540): at android.app.ActivityThread.main(ActivityThread.java:3647)
02-03 11:09:10.672: ERROR/com.pocketjourney.media.StreamingMediaPlayer(540): at java.lang.reflect.Method.invokeNative(Native Method)
02-03 11:09:10.672: ERROR/com.pocketjourney.media.StreamingMediaPlayer(540): at java.lang.reflect.Method.invoke(Method.java:507)
02-03 11:09:10.672: ERROR/com.pocketjourney.media.StreamingMediaPlayer(540): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-03 11:09:10.672: ERROR/com.pocketjourney.media.StreamingMediaPlayer(540): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-03 11:09:10.672: ERROR/com.pocketjourney.media.StreamingMediaPlayer(540): at dalvik.system.NativeStart.main(Native Method)



Has anyone encountered this? I'll be debugging this to find out more and keep you updated.
zephir
Freshman
Freshman
 
Posts: 2
Joined: Wed Feb 02, 2011 2:43 pm

Re: Tutorial: Custom Media Streaming for Android's MediaPlay

Postby purdual » Thu May 12, 2011 12:14 pm

HELLO!

I want to do something like this streaming but from a radio. My problem is that the buffer´s file size go up because my app is reading all the time from the radios url. How I can change this? thank you.
purdual
Once Poster
Once Poster
 
Posts: 1
Joined: Thu May 12, 2011 12:05 pm

Top

Re: Tutorial: Custom Media Streaming for Android's MediaPlay

Postby Dahevos » Wed Aug 24, 2011 10:20 am

Hi,

I wanna just play a mp3 file from internet. Progress bar and playing button is useless for me in this case.

So, i took the class and i delete in the constructor variables in order to keep just the context (because the other is useless for me)



Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         public StreamingMediaPlayer(Context  context)
  2.         {
  3.                 this.context = context;
  4.  
  5.         }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

of course, i deleted also all the method linked to the variable that i deleted.


Then, what i do is that :

During the onCreate :

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         if ( audioStreamer != null) {
  2.                         audioStreamer.interrupt();
  3.                 }
  4.                
  5.                 audioStreamer = new StreamingMediaPlayer(this);
  6.                 try {
  7.                         audioStreamer.startStreaming("http://**********/***.mp3", 9, 1);
  8.                 } catch (IOException e1) {
  9.                         // TODO Auto-generated catch block
  10.                         e1.printStackTrace();
  11.                 }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


And then on button click :

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                                         audioStreamer.getMediaPlayer().start();
  2.  
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


But when i execute i have a Java Null Pointer exception at this line : audioStreamer.getMediaPlayer().start();
I don't und why ?

Thx.
Dahevos
Freshman
Freshman
 
Posts: 3
Joined: Mon Dec 20, 2010 3:45 pm

Re: Tutorial: Custom Media Streaming for Android's MediaPlay

Postby ForTheDream » Wed Oct 12, 2011 3:35 am

i am a newbie , i am learning how to program for android
i have read the tutorial about media streaming in pocketjourney and test , i hava some problem in this
- i test tutorial 1.5 , everything is ok , streaming audio work well ( i test it in android 2.2 , google api 8 )
- when i type exactly code in a new project , and test it in emulator , it don't play . Button "Start Streaming" is pressed but nothing happen , the progressbar is not updated immediately ( in tutorial , when press button " Tutorial 3 " i see progress bar is updated , it is longer ) ( test in same emulator )
- in Androidmainfest i type <uses-permission ............. / >
- in Logcat , i see that " Unable to initialize the MediaPlayer for audio.mp3 "
so i dont know why it does'nt work ??

here is the code : http://www.mediafire.com/?xxe6b8vn65f67m5
ForTheDream
Freshman
Freshman
 
Posts: 2
Joined: Wed Oct 12, 2011 3:17 am

Re: Tutorial: Custom Media Streaming for Android's MediaPlay

Postby ForTheDream » Wed Oct 12, 2011 5:29 pm

i connect to the URL and audio start play , but the progressbar is not longer as i tested in tutorial 1.5
and the secondary progressbar is not update ,
my code is still there , plz help me
ForTheDream
Freshman
Freshman
 
Posts: 2
Joined: Wed Oct 12, 2011 3:17 am

Top
Previous

Return to Advanced Tutorials

Who is online

Users browsing this forum: No registered users and 8 guests