Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Example of Android application with two players

This example demonstrates how two or more players can be displayed in one application. Each of the players can be used to play a different stream.

Work with code of the example

To analyze the code, let's take class TwoPlayersActivity.java of the 2players example version with hash 4ed4c6d77, which can be downloaded with corresponding build 1.0.1.3.

Functions of initialization, creating stream, starting and stopping playback work the same as described in the example Player.

Unlike the example Player, this one has two Play buttons for starting playback of corresponding streams.

line 225

play1Stream.play();


line 299

play2Stream.play(); 


SurfaceViewRenderer, which will be used to play corresponding video stream, is passed with object StreamOptions when the stream is created.
Mehod StreamOptions.setRenderer() is used to add renderer to StreamOptions object.

line 191

streamOptions.setRenderer(remote2Render); 


line 265

streamOptions.setRenderer(remote2Render); 


Playback is stopped when corresponding Stop button is pressed.

line 235

play1Stream.stop(); 


line 309

play2Stream.stop(); 
  • No labels