我制作了一个与Vitamio合作的应用程序。当点击按钮但流媒体停止时,我也转发到收音机的Facebook页面。我想继续直播。我的代码在这里:
public class MainActivity extends Activity {
private Button startButton,facebookButton,twitterButton;
private VideoView videoView;
private String httpLiveUrl = "http://someURL.m3u8";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.setTitle("Standart FM");
startButton = (Button) findViewById(R.id.buttonBasla);
facebookButton = (Button)findViewById(R.id.buttonFacebook);
twitterButton = (Button)findViewById(R.id.buttonTwitter);
videoView = (VideoView)findViewById(R.id.VideoView);
videoView.setVideoURI(Uri.parse(httpLiveUrl));
if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(MainActivity.this))
return ;
new getStream().execute();
startButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(videoView.isPlaying()){
videoView.pause();
startButton.setBackgroundResource(R.drawable.andplaybtn);
}else{
startButton.setBackgroundResource(R.drawable.andstopbtn);
videoView.start();
}
}
});
facebookButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("https://www.facebook.com/StandartFM"));
startActivity(browserIntent);
}
});
}
如果点击并打开浏览器,如何在后台运行?