Android 一个播放器,但更多的按钮

Android 一个播放器,但更多的按钮,android,video-streaming,android-videoview,exoplayer,Android,Video Streaming,Android Videoview,Exoplayer,到目前为止,我们已经为每个流创建了一个播放器。但我说要学会做正确的事。 我如何制作更多的按钮,每个按钮都有一个流地址,可以在同一视频视图中打开。 我认为应该有一种方法来字符串或获取字符串。 具体来说,要发送到另一个活动的m3u8地址,其中Andres m3u8将被提取并放入videoview videoview.xml public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPreparedList

到目前为止,我们已经为每个流创建了一个播放器。但我说要学会做正确的事。 我如何制作更多的按钮,每个按钮都有一个流地址,可以在同一视频视图中打开。 我认为应该有一种方法来字符串或获取字符串。 具体来说,要发送到另一个活动的m3u8地址,其中Andres m3u8将被提取并放入videoview

videoview.xml

public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPreparedListener  {

protected EMVideoView emVideoView;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    emVideoView = (EMVideoView)findViewById(R.id.video_play_activity_video_view);
    emVideoView.setOnPreparedListener(this);

    //For now we just picked an arbitrary item to play.  More can be found at
    //https://archive.org/details/more_animation
    emVideoView.setVideoURI(Uri.parse("http://xxxxxxxxxx/xxxx/xx.m3u8"));


    //-----------------------
    if(Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) { // lower api
        View v = this.getWindow().getDecorView();
        v.setSystemUiVisibility(View.GONE);
    } else if(Build.VERSION.SDK_INT >= 19) {
        //for new api versions.
        View decorView = getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        decorView.setSystemUiVisibility(uiOptions);
    }


    //---------
}


@Override
public void onPrepared(MediaPlayer mp) {
    //Starts the video playback as soon as it is ready
    emVideoView.start();
}
这不是工作

>  Bundle bundle = getIntent().getExtras();
>         String url = bundle.getString("url");
> 
>         emVideoView = (EMVideoView)findViewById(R.id.video_play_activity_video_view);
>         emVideoView.setOnPreparedListener(this);
> 
>         //For now we just picked an arbitrary item to play.  More can be found at
>         //https://archive.org/details/more_animation
>         emVideoView.setVideoURI(Uri.parse(getString(R.string.url)));
按钮:

>         setContentView(R.layout.activity_main2);
>         Intent intent = new Intent(Main2Activity.this, MainActivity.class);
>         intent.putExtra("url", "http://xxxxx/xxx.m3u8");
>         startActivity(intent);
谢谢

正确的版本是: 进展很顺利。 但我如何从其他应用程序中获取url和url

Bundle Bundle=getIntent().getExtras(); 字符串url=bundle.getString(“url”)

>         setContentView(R.layout.activity_main2);
>         Intent intent = new Intent(Main2Activity.this, MainActivity.class);
>         intent.putExtra("url", "http://xxxxx/xxx.m3u8");
>         startActivity(intent);
    emVideoView = (EMVideoView)findViewById(R.id.video_play_activity_video_view);
    emVideoView.setOnPreparedListener(this);

    //For now we just picked an arbitrary item to play.  More can be found at
    //https://archive.org/details/more_animation
    emVideoView.setVideoURI(Uri.parse(url)));