Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
themeRDark
    Flashphoner.getMediaDevices(null, true, MEDIA_DEVICE_KIND.OUTPUT).then(function (list) {
        list.audio.forEach(function (device) {
            ...
        });
    }).catch(function (error) {
        $('#audioOutputForm').remove();
    });

WebRTC statistics displaying

A client application can get WebRTC statistics according to the standard while publishing or playing stream. The statistics can be displayed in browser, for example:

Image Added

Note that in Safari browser audio only statistics can be displayed.

1. Statistics displaying while stream is published

stream.getStats() code:

Code Block
languagejs
themeRDark
    publishStream.getStats(function (stats) {
        if (stats && stats.outboundStream) {
            if(stats.outboundStream.videoStats) {
                $('#outVideoStatBytesSent').text(stats.outboundStream.videoStats.bytesSent);
                $('#outVideoStatPacketsSent').text(stats.outboundStream.videoStats.packetsSent);
                $('#outVideoStatFramesEncoded').text(stats.outboundStream.videoStats.framesEncoded);
            } else {
                ...
            }

            if(stats.outboundStream.audioStats) {
                $('#outAudioStatBytesSent').text(stats.outboundStream.audioStats.bytesSent);
                $('#outAudioStatPacketsSent').text(stats.outboundStream.audioStats.packetsSent);
            } else {
                ...
            }
        }
    });

2. Sattistics displaying while stream is played

stream.getStats() code:

Code Block
languagejs
themeRDark
    previewStream.getStats(function (stats) {
        if (stats && stats.inboundStream) {
            if(stats.inboundStream.videoStats) {
                $('#inVideoStatBytesReceived').text(stats.inboundStream.videoStats.bytesReceived);
                $('#inVideoStatPacketsReceived').text(stats.inboundStream.videoStats.packetsReceived);
                $('#inVideoStatFramesDecoded').text(stats.inboundStream.videoStats.framesDecoded);
            } else {
                ...
            }

            if(stats.inboundStream.audioStats) {
                $('#inAudioStatBytesReceived').text(stats.inboundStream.audioStats.bytesReceived);
                $('#inAudioStatPacketsReceived').text(stats.inboundStream.audioStats.packetsReceived);
            } else {
                ...
            }
        }
    });

Known issues

1. Microphone swithing does not work in Safari browser.

Symptoms: microphone does not switch using switchMic() WCS WebSDK method.

Solution: use another browser, because Safari always uses sound input microphone, that is chosen in system sound menu (hold down the option (alt) button and click on the sound icon in the menu bar). When microphone is chosen in sound menu, Mac reboot is required.

If Logitech USB camers microphone does not work (when it is chosen in sound menu), format / sample rate changing in Audio MIDI Setup and rebooting can help.