var OV; var session; /* OPENVIDU METHODS */ function joinSession() { var mySessionId = document.getElementById("sessionId").value; var myUserName = document.getElementById("userName").value; // --- 1) Get an OpenVidu object --- OV = new OpenVidu(); // --- 2) Init a session --- session = OV.initSession(); // --- 3) Specify the actions when events take place in the session --- // On every new Stream received... session.on('streamCreated', event => { // Subscribe to the Stream to receive it. HTML video will be appended to element with 'video-container' id var subscriber = session.subscribe(event.stream, 'video-container'); // When the HTML video has been appended to DOM... subscriber.on('videoElementCreated', event => { // Add a new

element for the user's nickname just below its video appendUserData(event.element, subscriber.stream.connection); // Add a new