Developer Guide Javascript API Reference Developer Tools Release Notes

Resizing the Player

A demo setup of JW Player with an external link that resizes the player on the fly.

github
const playerInstance = jwplayer('player').setup({
    playlist: 'https://cdn.jwplayer.com/v2/media/l76Ij09F'
});

const resizeButton = document.getElementById('resize');
resizeButton.addEventListener('click', () => {
    if (playerInstance.getWidth() > 480) {
        playerInstance.resize(480, 270);
    } else {
        playerInstance.resize(640, 360);
    }
});