Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How check if connection created #1043

Open
Vladislavlr opened this issue Jun 29, 2022 · 2 comments
Open

How check if connection created #1043

Vladislavlr opened this issue Jun 29, 2022 · 2 comments

Comments

@Vladislavlr
Copy link

How i can check if broadcast exist?
` var broadcastId = "stream_"+recipientId;
if (broadcastId.replace(/^\s+|\s+$/g, '').length <= 0) {
alert('Please enter broadcast-id');
document.getElementById('broadcast-id').focus();
return;
}

connection.extra.broadcastId = broadcastId;

connection.session = {
    audio: {
        autoGainControl: false,
        echoCancellation: false,
        googAutoGainControl: false,
        noiseSuppression: false,
    },
    video: true,
    oneway: true
};

connection.getSocket(function (socket) {
    socket.emit('check-broadcast-presence', broadcastId, function (isBroadcastExists) {
        if (!isBroadcastExists) {

            //disableBroadcastVideo();
            //return false;
            connection.userid = broadcastId;
        }

        console.log('check-broadcast-presence', broadcastId, isBroadcastExists);

        socket.emit('join-broadcast', {
            broadcastId: broadcastId,
            userid: connection.userid,
            typeOfStreams: connection.session
        });
    });
});`
@Vladislavlr
Copy link
Author

I want to check if the room is already created

@MediaKitApp
Copy link

Hello!

You can check if a room exists with the following code:

connection.checkPresence(ROOM_ID, function (isRoomExist) {
             if (isRoomExist) {
                   console.log("ROOM EXIST")
                } else {
       	           console.log("ROOM NOT EXIST")
             }
});

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants