Resize embedded player

Corrado

New Member
I am using an embedded player inside my webpage, i need to resize it when i toggle my function from pip to full screen, i have seen there is a resize function in the embedded player but i can't fire it when i put my iframe to full screen.
I use CSS to resize iframe but video remains the size of when it first initialized on page load.
I would like to just resize it without restarting the whole video so to not have any interruption.
thanks
 

Max

Administrator
Staff member
Good day.
When iframe is resized, onresize event will not be fired for page elements displayed in iframe, but for window object only. You should use window.onresize event in Embed Player code, for example:
Code:
    stream = session.createStream(options).on(STREAM_STATUS.PENDING, function(stream) {
        var video = document.getElementById(stream.id());
        ...
        window.addEventListener('resize', function(event) {
            console.log("Iframe resize event");
            resizeVideo(video, window.innerWidth, window.innerHeight);
        });
    }).on(STREAM_STATUS.PLAYING, function (stream) {
        ...
    });
    stream.play();
 
Top