How do I handle multiple players on the same page?

When multiple players live on the same page, they can be handled by the onLCPlayerLoaded() function as they are loaded; for example, by saving references to the player objects in individual variables.

Additionally, the global function getLCPlayers() returns an array containing all the loaded players on the current page. For example, the following Javascript function stops all players on the page:

function stopAll() {
var players = getLCPlayers();
for (i = 0; i < players.length; i++) {
var player = players[i];

We can also obtain the "playing" players using the getPlayingPlayers function. This function will return a list containing all the player wich are in "playing" state. For example , the following Javascript function pause all the players wich are in "play" state.

function pausePlayingPlayers() {
var playingPlayers = getPlayingPlayers();
for (i = 0; i < playingPlayers.length; i++) {
var player = playingPlayers[i];
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.