Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To analyze the code, let's take the version of file 2players.js with hash cf0daabc6b86e21d5a2f9e4605366c8b7f0d27eb66cc393, which is available here and  and can be downloaded with corresponding build 0.35.1828.18942753.133.

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

1. Two <div> elements creation

code

Code Block
languagejs
themeRDark
<div id="player1" class="display"></div>

code

Code Block
languagejs
themeRDark
<div id="player2" class="display"></div>

...

document.getElementById(), session.createStream() code

Code Block
languagejs
themeRDark
    var display = document.getElementById("player" + index);

session.createStream() code

Code Block
languagejs
themeRDark
     session.createStream({
        name: streamName,
        display: display
    }).on(STREAM_STATUS.PLAYINGPENDING, function(stream) {
        ...
    }).play();

So, for each stream <div> element 'display' can be passed, and any number of video streams can be played on one HTML page.