Discussion Forums  >  Audio, Video, Playing, Recording

Replies: 6    Views: 411

g1pro757
Android Fan
Profile
Posts: 12
Reg: Feb 12, 2015
new york
120
02/15/15 02:00 PM (9 years ago)

Trying to create radio streaming app for android

Im trying to create a radio streaming app and am placing the streaming part in a blank screen I added using the blank screen plugin. In order to add the code im using I must delete the BT_screen_blank class code and that causes it to say missing plugin. How can I either remove the plugin or work around it. I have already tried extending a new class to the BT_screen_blank class but it did not work. If anyone has any recommendations or can help please let me know.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
02/15/15 02:23 PM (9 years ago)
You get missing plugin screen if you don't add the code right.you need blank screen plugin for custom plugins.what type of audio is the stream? The cp stream plugin can stream mp3
 
g1pro757
Android Fan
Profile
Posts: 12
Reg: Feb 12, 2015
new york
120
like
02/15/15 02:44 PM (9 years ago)
Its an online stream and yes its mp3 ive been working with this code: public class BT_screen_blank extends Activity implements View.OnClickListener { private ProgressBar playSeekBar; private Button buttonPlay; private Button buttonStopPlay; private MediaPlayer player; /** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bt_screen_blank); initializeUIElements(); initializeMediaPlayer(); } private void initializeUIElements() { playSeekBar = (ProgressBar) findViewById(R.id.progressBar1); playSeekBar.setMax(100); playSeekBar.setVisibility(View.INVISIBLE); buttonPlay = (Button) findViewById(R.id.buttonPlay); buttonPlay.setOnClickListener(this); buttonStopPlay = (Button) findViewById(R.id.buttonStopPlay); buttonStopPlay.setEnabled(false); buttonStopPlay.setOnClickListener(this); } public void onClick(View v) { if (v == buttonPlay) { startPlaying(); } else if (v == buttonStopPlay) { stopPlaying(); } } private void startPlaying() { buttonStopPlay.setEnabled(true); buttonPlay.setEnabled(false); playSeekBar.setVisibility(View.VISIBLE); player.prepareAsync(); player.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { public void onPrepared(MediaPlayer mp) { player.start(); } }); } private void stopPlaying() { if (player.isPlaying()) { player.stop(); player.release(); initializeMediaPlayer(); } buttonPlay.setEnabled(true); buttonStopPlay.setEnabled(false); playSeekBar.setVisibility(View.INVISIBLE); } private void initializeMediaPlayer() { player = new MediaPlayer(); try { player.setDataSource("192.235.87.113:10830"); player.start(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } player.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() { public void onBufferingUpdate(MediaPlayer mp, int percent) { playSeekBar.setSecondaryProgress(percent); Log.i("Buffering", "" + percent); } }); } @Override protected void onPause() { super.onPause(); if (player.isPlaying()) { player.stop(); } } }
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/15/15 03:23 PM (9 years ago)
Ever thought of using Cookup's solution? I used it for our Local NPR Affliate's streaming app, and it works just fine. https://www.buzztouch.com/plugins/plugin.php?pid=5A9F0BFC5A553FEC4BBD839 Cheers! -- Smug
 
g1pro757
Android Fan
Profile
Posts: 12
Reg: Feb 12, 2015
new york
120
like
02/19/15 05:28 PM (9 years ago)
Thanks for the recommendation! At first I couldn't get the plugin to work but after some research on the forums I figured out how to make it work. The instructions should be made a little clearer. Now I just need to finish up some things and im ready to sign the apk. Once again thanks.
 
g1pro757
Android Fan
Profile
Posts: 12
Reg: Feb 12, 2015
new york
120
like
02/19/15 05:41 PM (9 years ago)
This was also my first app by the way. Pretty bad way to start but it wasnt so difficult since I had some background in java. I wrote this because I refreshed the screen and it sent the message again. they have to fix that...
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
02/19/15 06:31 PM (9 years ago)
cool congrats!also it crashes when playing music and you click on the now playing icon notification.to stop it from crashing open Cp_streamservice.java and go to line 415 that has this line: Intent notificationIntent = new Intent(mPlayerService, Cp_stream.class); change it to this Intent notificationIntent = new Intent(mPlayerService, BT_activity_host.class);
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.