کلیدستان

نسخه‌ی کامل: پیلر آنلاین موزیک
شما در حال مشاهده نسخه آرشیو هستید. برای مشاهده نسخه کامل کلیک کنید.
سلام Iran


کسی از دوستان پلیر موزیک به صورت آنلاین کار کرده؟

موزیک پلیر میشه ساخت اما چون میخوام از اینترنت به صورت آنلاین اسفاده کنم نمیدونم چیکارکنم.
ممنون
خودم پیداش کردم.
کسی خواست استفاده کنه یا ادمین عزیز به عنوان کلید بذارتش تو سایت Shy 

کد پی‌اچ‌پی:
import java.io.IOException;

import android.app.Activity;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.SeekBar;
import android.widget.Toast;

public class 
MusicAndroidActivity extends Activity {

    static 
MediaPlayer mPlayer;
    
Button buttonPlay;
    
Button buttonStop;
    
String url "http://آدرس سایت آپلود موزیکmusic.mp3";
 
   private    SeekBar seekbar;
 
   
    Handler handler
;
    
Runnable runnable;
 
   
    
@Override
    
public void onCreate(Bundle savedInstanceState) {
        
super.onCreate(savedInstanceState);
        
setContentView(R.layout.main);
        
        
seekbar = (SeekBarfindViewById(R.id.seekBar);
        
        
buttonPlay = (ButtonfindViewById(R.id.play);
        
buttonPlay.setOnClickListener(new OnClickListener() {
            
            
            public 
void onClick(View v) {
                
mPlayer = new MediaPlayer();
                
mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
                try {
                    
mPlayer.setDataSource(url);
                } catch (
IllegalArgumentException e) {
                    
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!"Toast.LENGTH_LONG).show();
                } catch (
SecurityException e) {
                    
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!"Toast.LENGTH_LONG).show();
                } catch (
IllegalStateException e) {
                    
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!"Toast.LENGTH_LONG).show();
                } catch (
IOException e) {
                    
e.printStackTrace();
                }
                try {
                    
mPlayer.prepare();
                } catch (
IllegalStateException e) {
                    
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!"Toast.LENGTH_LONG).show();
                } catch (
IOException e) {
                    
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!"Toast.LENGTH_LONG).show();
                }
                
mPlayer.start();
            }
        });
        
        
buttonStop = (ButtonfindViewById(R.id.stop);
        
buttonStop.setOnClickListener(new OnClickListener() {

            public 
void onClick(View v) {
                
// TODO Auto-generated method stub
                
if(mPlayer!=null && mPlayer.isPlaying()){
                    
mPlayer.stop();
                }
            }
        });
        
        
        
    }
    
    protected 
void onDestroy() {
        
super.onDestroy();
        
// TODO Auto-generated method stub
        
if (mPlayer != null) {
            
mPlayer.release();
            
mPlayer null;
        }
    }