Skip to content

How to show multiple playerViews simultaneously with one simpleExoPlayer instance? #9567

@psycureaws

Description

@psycureaws

I am developing a video streaming app with android.

And I found some problem while developing using exoplayer2.

I want to show multiple playerViews simultaneously with one simpleExoPlayer instance

But I couldn't assign the same simpleExoPlayer instance to multiple playerViews.

How to show multiple playerViews simultaneously with one simpleExoPlayer instance?

Below is the code I wrote.

playerView = findViewById(R.id.player_view);
playerViewL = findViewById(R.id.player_viewL);
playerViewR = findViewById(R.id.player_viewR);
// exoPlayer = new ExoPlayer().
simpleExoPlayer1 = new SimpleExoPlayer.Builder(this).build();
simpleExoPlayer2 = new SimpleExoPlayer.Builder(this).build();
simpleExoPlayer3 = new SimpleExoPlayer.Builder(this).build();
playerView.setPlayer(simpleExoPlayer1);  // PlayerView cannot play video by simpleExoPlayer1, I want to play both (and all after)
playerViewL.setPlayer(simpleExoPlayer2); // PlayerView can play video by simpleExoPlayer2
playerViewR.setPlayer(simpleExoPlayer1); // PlayerView only can play video by simpleExoPlayer1
simpleExoPlayer1.setRepeatMode(simpleExoPlayer1.REPEAT_MODE_ALL);
simpleExoPlayer2.setRepeatMode(simpleExoPlayer2.REPEAT_MODE_ALL);
simpleExoPlayer3.setRepeatMode(simpleExoPlayer3.REPEAT_MODE_ALL);

I hope you have a simple way.

thank you

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions