Create an activity to open the layout with a VideoView
and another to work with the streaming with its own layout too:
private ProgressDialog carregando;
private Context context;
private VideoView mVideoView;
public void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
setContentView(R.layout.player);
this.context = this;
this.carregando = ProgressDialog.show(this.context, "", "Carregando...", true, true, new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface paramAnonymousDialogInterface)
{
Player.this.carregando.dismiss();
Player.this.mVideoView.stopPlayback();
Player.this.mVideoView.setVisibility(8);
}
});
this.carregando.setCancelable(true);
this.mVideoView = ((VideoView)findViewById(R.layout.videoview));
this.mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener()
{
public void onPrepared(MediaPlayer paramAnonymousMediaPlayer)
{
Player.this.carregando.dismiss();
}
});
this.mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener()
{
public void onCompletion(MediaPlayer paramAnonymousMediaPlayer)
{
Player.this.mVideoView.setVisibility(8);
Player.this.carregando.dismiss();
}
});
this.mVideoView.setVisibility(0);
this.mVideoView.setVideoURI(Uri.parse("linkdostreamingnoservidor"));
MediaController localMediaController = new MediaController(this.context);
this.mVideoView.setMediaController(localMediaController);
Log.d("NSLog", "Talvez isso: " + this.context + " ou isso: " + localMediaController);
this.mVideoView.requestFocus();
this.mVideoView.start();
}