Creating an async function to detect new video elements

Hello, I’m working on a WebRTC based app and I want to run a function when a new user joins (a new video element is created). How would I go around this?

1 Like

Maybe this would help. It uses jquery

$(document).on('DOMNodeInserted', function(e) {
    if ( $(e.target).hasClass('yourclassaddedtoallthevideos') ) {
       //element was inserted.
    }
}); 
3 Likes

Also, one more slightly off topic question, how can I disable the camera?

This might help?

1 Like