Versions Compared

Key

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

...

3. Получение от сервера события, подтверждающего успешное соединение.

SESSION_STATUS.ESTABLISHED code

...

6. Обработка события о недостаточной пропускной способности канала

STREAM_EVENT, STREAM_EVENT_TYPE.NOT_ENOUGH_BANDWIDTH code

Code Block
languagejs
themeRDark
    }).on(STREAM_EVENT, function(streamEvent){
        if (STREAM_EVENT_TYPE.NOT_ENOUGH_BANDWIDTH === streamEvent.type) {
            var info = streamEvent.payload.info.split("/");
            var remoteBitrate = info[0];
            var networkBandwidth = info[1];
            console.log("Not enough bandwidth, consider using lower video resolution or bitrate. Bandwidth " + (Math.round(networkBandwidth / 1000)) + " bitrate " + (Math.round(remoteBitrate / 1000)));
        } else if (STREAM_EVENT_TYPE.RESIZE === streamEvent.type) {
            ...
        }
    });

7. Обработка события об изменении размера картинки потока

STREAM_EVENT, STREAM_EVENT_TYPE.RESIZE code

Code Block
languagejs
themeRDark
    }).on(STREAM_EVENT, function(streamEvent){
            ...
        } else if (STREAM_EVENT_TYPE.RESIZE === streamEvent.type) {
            console.log("New video size: " + streamEvent.payload.streamerVideoWidth + "x" + streamEvent.payload.streamerVideoHeight);
        }
    });

...