muaz-khan / RTCMultiConnection

RTCMultiConnection is a WebRTC JavaScript library for peer-to-peer applications (screen sharing, audio/video conferencing, file sharing, media streaming etc.)
https://muazkhan.com:9001/
MIT License
2.56k stars 1.37k forks source link

How to disable full-screen video playback when the smartphone rotate? #768

Open ghost opened 5 years ago

ghost commented 5 years ago

When I rotate the smartphone in a horizontal position, then full screen video playback is enabled by default.

That is if I have a communication session with several broadcasters, when I turn the screen of the smartphone, then I see only one video full-screen expanded. Any idea how to change this?

I found information that you can change the settings on your smartphone in the chrome browser settings: chrome://flags/#rotate-to-fullscreen and set the status to disabled.

But is it possible to disable full-screen video playback when rotated using JS or maybe CSS?

ghost commented 5 years ago

I temporarily use this code:

screen.orientation.addEventListener('change', function(e) {
    if(screen.orientation.type === 'portrait-primary') return;
    setTimeout(function () {
        if (document.fullscreenElement) document.exitFullscreen();
    }, 1500);
});

But the code does not work well, because it does not eliminate the cause.