cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
824
Views
0
Helpful
1
Replies

Detecting receive video in api?

For purposes of making intelligent decisions in a macro, is there any simple facility via feedback/xapi to query whether video is being received in the currently active call?  The only thing I can find on this topic is to walk through the MediaChannels list under Status, but doing it this way is more complicated than I was hoping to find. 

Was originally hoping that Call/CallType would work here, but if a call is placed as video and the far-end is not sending video (or even video capable) it still shows Video as the type regardless.

1 Reply 1

Never figured out a way other than walking the media streams, but it works.  Not very elegant, thought I would share my solution anyhow:

function getVideoCallState() {
    let rxVideo = false;
    if (xapi.status.get('Call')) {
        xapi.status.get('MediaChannels Call').then(media => {
            let index, channel = null;
            for (index = 0; index < media[0].Channel.length; index++) {
                channel = media[0].Channel[index];
                if (channel.Direction == 'Incoming' &&
                    channel.Type == 'Video' &&
                    channel.Video.ChannelRole == 'Main' &&
                    channel.Video.Protocol != 'Off') {
                    rxVideo = true;
                }
            }
        });
    }
    return rxVideo;
}
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: