Search code examples
androidwebrtc

How to share android screen without using app


Can we share mobile screen without using any app or without using developer options?

I used WebRTC to share my screen but it doesn't work on android browser.

<!DOCTYPE html>
<html>
<head>
    <title>Screen Sharing Example</title>
</head>
<body>
    <h1>Screen Sharing Example</h1>
    <script>
        // Request screen access
        navigator.mediaDevices.getDisplayMedia({ video: true })
            .then(function (stream) {
                // Use the stream for your WebRTC connection
                const videoElement = document.createElement('video');
                videoElement.srcObject = stream;
                document.body.appendChild(videoElement);
            })
            .catch(function (error) {
                console.error('Error accessing screen:', error);
            });
    </script>
</body>
</html>

Is it possible? Kindly let me know.


Solution

  • Screen sharing in web applications is done using the getUserMedia function, which is currently not supported by any mobile browser. Thus, there is no way to perform screen sharing without a native app on a mobile device.