dom - How to check if a div has a video track attached? -


i using twilio enable in app video chat. attaching audio , video tracks of each user separate container divs. how can check whether given div has video track attached it?

twilio developer evangelist here.

if can target <div> sort of id or css selector, can within <div> element too. so, following html:

<div id="localvideo">   <video></video> </div> 

then can <div> document.getelementbyid or document.queryselector , search within <div> using element.queryselector.

const div = document.getelementbyid('localvideo'); if (div.queryselector('video')) {   console.log('there video!'); } else {   console.log('no video yet.'); } 

element.queryselector returns element searching if exists or null if doesn't.

let me know if helps @ all.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -