how can a client find its own connectionId when it connects to a session?
here is my client code I tried listening to streamcreated but it gives back id of all the streams when they connect.
function initializeSession() {
var session = OT.initSession(apiKey, sessionId);
session.on('streamCreated', function streamCreated(event) {
var subscriberOptions = {
insertMode: 'append',
width: '100%',
height: '100%'
};
session.subscribe(event.stream, 'subscriber', subscriberOptions, handleError);
});
session.on('sessionDisconnected', function sessionDisconnected(event) {
console.log('You were disconnected from the session.', event.reason);
});
var publisherOptions = {
insertMode: 'append',
width: '100%',
height: '100%',
name: pubname,
style: { nameDisplayMode: "auto" }
};
var publisher = OT.initPublisher('publisher', publisherOptions, handleError);
session.connect(token, function callback(error) {
if (error) {
handleError(error);
} else {
session.publish(publisher, handleError);
}
});
}
getData();
initializeSession();
Aucun commentaire:
Enregistrer un commentaire