stream = session.createStream(options).on(STREAM_STATUS.PENDING, function(stream) {
var video = document.getElementById(stream.id());
...
//don't resize html5 video
if (video.nodeName.toLowerCase() !== "video") {
video.addEventListener('resize', function (event) {
var streamResolution = stream.videoResolution();
console.log("Stream resolution " + streamResolution);
if (Object.keys(streamResolution).length === 0) {
resizeVideo(event.target);
} else {
// Change aspect ratio to prevent video stretching
var ratio = streamResolution.width / streamResolution.height;
var newHeight = Math.floor(options.playWidth / ratio);
resizeVideo(event.target, options.playWidth, newHeight);
}
});
}
}
...
});
stream.play();