Flash player not playing music in android

440 views Asked by At

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);

 }
     }
1

There are 1 answers

0
ud_an On

try to embed your flash content in html page using swfObject then load that html page in webview.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body bgcolor="#000000" style="margin: 0; padding: 0">
<table width=800px height=600px border=1>
    <tr>
        <td>
            <div id="moviename"></div>
        </td>
    </tr>
</table>

<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("main.swf", "moviename", "1024", "600", "9.0.0");
</script>
</body>
</html>