{"id":13614694,"url":"https://github.com/rghale/webrtc-screen-share","last_synced_at":"2025-04-13T18:33:33.753Z","repository":{"id":93762384,"uuid":"383117120","full_name":"rghale/webrtc-screen-share","owner":"rghale","description":"WebRTC based screen sharing","archived":false,"fork":false,"pushed_at":"2021-07-05T13:41:42.000Z","size":76,"stargazers_count":28,"open_issues_count":1,"forks_count":13,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-07T22:42:46.605Z","etag":null,"topics":["javascript","kurento","screensharing","webrtc","webrtc-demos","webrtc-examples"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rghale.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-07-05T11:28:02.000Z","updated_at":"2024-10-27T23:21:28.000Z","dependencies_parsed_at":"2023-03-25T20:20:19.406Z","dependency_job_id":null,"html_url":"https://github.com/rghale/webrtc-screen-share","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rghale%2Fwebrtc-screen-share","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rghale%2Fwebrtc-screen-share/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rghale%2Fwebrtc-screen-share/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rghale%2Fwebrtc-screen-share/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rghale","download_url":"https://codeload.github.com/rghale/webrtc-screen-share/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248760779,"owners_count":21157426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","kurento","screensharing","webrtc","webrtc-demos","webrtc-examples"],"created_at":"2024-08-01T20:01:04.573Z","updated_at":"2025-04-13T18:33:33.451Z","avatar_url":"https://github.com/rghale.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# WebRTC Based Screen Sharing\n\nWebRTC screen sharing project. It supports Chrome, Firefox, Safari, Opera, Android, and Microsoft Edge. Platforms: Linux, Mac and Windows.\n\n----------\n\n## Live Demo\n\nPresenter \u003chttps://51.158.104.137:3000/presenter.htm?session_id=123456\u003e\n\nViewer \u003chttps://51.158.104.137:3000/viewer.htm?session_id=123456\u003e\n\n----------\n\n## Installation Steps\n\n### Pre-requirements\n\nInstall following apps on your server:\n\n#### Mandatory\n\n* Last version of Node.js \u003chttps://nodejs.org/en/\u003e\n\n* Last version of Coturn server (STUN \u0026 TRUN server) \u003chttps://meetrix.io/blog/webrtc/coturn/installation.html\u003e\n\n    note: You can also use free STUN servers but in many cases, it causes the viewer cannot display streamed data because of routing problems.\n\n#### Optional\n\n* Last version of Kurento media server (to using stream server) \u003chttps://doc-kurento.readthedocs.io/en/latest/user/installation.html\u003e\n\n### Installation\n\n1. Clone the repository\n\n    ```bash\n    git clone https://github.com/rghale/webrtc-screen-share.git\n    ```\n\n2. Install Node modules\n\n    ```bash\n    cd webrtc-screen-share \n    npm install\n    ```\n\n3. Set your desired port, Kurento server IP and certificates in ./server.js as following:\n\n    ```js\n    const httpPort = 3000; //your desired port\n    const kurentoIP = '127.0.0.1'; //if using kurento specify IP address here   \n    const kurentoPort = 8888; //if using kurento specify port number here   \n    ...\n    const server = https.createServer({\n        key: fs.readFileSync('./certs/key.pem'),\n        cert: fs.readFileSync('./certs/cert.pem'),\n        passphrase: 'your certificate passphrase'\n    }, app);     \n    ...\n    \n    ```\n\n4. Copy user SSL certificates in ./certs as following:\n\n    ```text\n    ./cert/cert.pem\n    ./cert/key.pem\n    ```\n\n5. Set you STUN server in ./public/presenter.htm and ./public/viewer.htm as following:\n\n    ```javascript\n    //presenter.htm\n    var presenterObj = new presenter({\n    iceServers: [\n        { urls:\"stun:stun_server_pubic_ip:stun_server_port\"},\n        …\n    ]\n    });\n    ```\n\n    ```javascript\n    //viewer.htm\n    var viewerObj = new viewer({\n    iceServers: [\n        { urls:\"stun:stun_server_pubic_ip:stun_server_port\"},\n        …\n    ]\n    });\n    ```\n\n6. Start Node.js server using pm2 as following\n\n    ```bash\n    pm2 start server.js \n    ```\n\n7. Now you can browse prenseter.htm \u0026 viewer.htm as following:\n\n    ```text\n    https://yourdomain:node_port/presenter.htm\n    https://yourdomain:node_port/viewer.htm    \n    ```\n\n## API reference\n\n### Presenter class\n\n#### *constructor(options)*\n\n```text\noptions:\n    iceServers: list of STUN or TURN servers\n    [\n        {urls: \"stun:stun_server1_pubic_ip: stun_server1_port\"},\n        {urls: \"trun:trun_server2_pubic_ip: stun_server2_port\", credential: \"your credential\", username: \"user user name\"}\n    ]\n```\n\n#### *startSharing(options, startEvent, stopEvent, failedEvent)*\n\n```text\nstart screen sharing\noptions:\n    mechanism: mechanism of sharing\n        * distributed\n        * peer\n        * streamserver\n    maxFrameRate: maximum frame rate (number 1 .. 30)\n    screenSize: size of shared stream screen (ex: 800*600, 1360*768)\n    microphone: audio state\n        * muted\n        * unmuted\n    startEvent: the event that raises when sharing start\n    stopEvent: the event that raises when sharing stop\n    failedEvent: the event that raises when sharing failed\n```\n\n#### *startSharing(stopEvent)*\n\n```text\nstop screen sharing\nstopEvent: the event that raises when sharing stop\n```\n\n#### *setOptions(options)*\n\n```text\nset sharing options\noptions:\n    microphone: audio state\n        * muted\n        * unmuted\n```\n\n#### *onStatusChanged*\n\n```text\nThis is an event, and raises when any status of sharing status is changed\n```\n\n#### Public Properties\n\n* isConnected (boolean): node socket connected or not\n\n### Viewer class\n\n#### *constructor(options)*\n\n```text\noptions:\n    player: video play object\n    iceServers: list of STUN or TURN servers\n    [\n        {urls: \"stun:stun_server1_pubic_ip: stun_server1_port\"},\n        {urls: \"trun:trun_server2_pubic_ip: stun_server2_port\", credential: \"your credential\", username: \"user user name\"}\n    ]\n```\n\n#### *onStatusChanged*\n\n```text\nThis is an event, and raises when any status of sharing status is changed.\n```\n\n#### Public Properties\n\n* played (boolean): playing video status\n* isWaitingViewer (boolean): viewer joined to presenter or not\n* presenterStatus (string): online or offline\n* isSharing (boolean): sharing available or not\n* isConnected (boolean): node socket connected or not\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frghale%2Fwebrtc-screen-share","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frghale%2Fwebrtc-screen-share","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frghale%2Fwebrtc-screen-share/lists"}