I use to play an music from the site. i use to load html page and the flash player. but when i press play button its suddenly changing to pause button in device why i have to use any buffer method for streaming plz tell me wht's going wrong.....i am using galaxys.and the code is.......?
import java.io.IOException;
import android.app.Activity;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Button;
public class Mymediaplayer extends Activity {
private WebView wv;
Button b1;
MediaPlayer player;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
b1=(Button)findViewById(R.id.button1);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// playvideofromresource();
// playvideofromsdcard();
setupWebView();
//playaudiofromremorturl();
}
});
}
public void setupWebView(){
wv = (WebView) findViewById(R.id.web_view);
wv.setVisibility(View.VISIBLE);
if(wv != null){
wv.getSettings().setJavaScriptEnabled(true);
wv.getSettings().setPluginState(WebSettings.PluginState.ON);
wv.loadUrl("http://media.radiosai.org/www/Afristream.html");
}
}
void playaudiofromremorturl()
{
player=new MediaPlayer();
String urlstring="http://media.radiosai.org/www/Afristream.html";
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
try
{
player.reset();
player.setDataSource(urlstring);
player.prepareAsync();
player.start();
}
catch (IOException e) {
e.printStackTrace();
// TODO: handle exception
}
player.setLooping(true);
}
}
try to embed your flash content in html page using swfObject then load that html page in webview.