GithubHelp home page GithubHelp logo

trial6's Introduction

Please use getDisplayMedia instead

getScreenStream(function(screenStream) {
    video.srcObject = screenStream;
});

function getScreenStream(callback) {
    if (navigator.getDisplayMedia) {
        navigator.getDisplayMedia({
            video: true
        }).then(screenStream => {
            callback(screenStream);
        });
    } else if (navigator.mediaDevices.getDisplayMedia) {
        navigator.mediaDevices.getDisplayMedia({
            video: true
        }).then(screenStream => {
            callback(screenStream);
        });
    } else {
        getScreenId(function(error, sourceId, screen_constraints) {
            navigator.mediaDevices.getUserMedia(screen_constraints).then(function(screenStream) {
                callback(screenStream);
            });
        });
    }
}

Disclaimer

No more maintaining this extension; as of 2019. So please use at your own risk.


This chrome extension simply captures content of your screen. It returns source-id to callee; and that source-id can be used as chromeMediaSourceId in WebRTC applications to capture screen's MediaStream.

Description Download Install
Access/capture screen from any HTTPs domain. Source Code Install from Google Web Store

Demos

Note: Following demos works only if you install chrome extension from Google WebStore.

How to modify this chrome extension?

  1. Download ZIP
  2. Windows users can use WinZip/WinRAR/7Zip however MacOSX/Linux users can use tar -zxvf desktopCapture.tar.gz to extract the archive
  3. Add your own domain here at line #17
  4. LocalHost users can test directly by adding unpacked extension.. via chrome://extensions/
  5. Otherwise you can make ZIP of the entire directory and upload at Google dashboard

Here is how to modify allowed-domains in manifest.json file:

{
    "content_scripts": [ {
       "js": [ "content-script.js" ],
       "all_frames": true,
       "run_at": "document_end",
       "matches": ["https://www.domain.com/*"]
    }]
}

How to publish?

Learn more about how to publish a chrome extension in Google App Store:

For additional information, click this link.

How to use?

Download and link Screen-Capturing.js:

Now you can use getScreenConstraints method to capture your screen:

getScreenConstraints(function(error, screen_constraints) {
    if (error) {
        return alert(error);
    }

    navigator.getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
    navigator.getUserMedia({
        video: screen_constraints
    }, function(stream) {
        var video = document.querySelector('video');
        video.src = URL.createObjectURL(stream);
        video.play();
    }, function(error) {
        alert(JSON.stringify(error, null, '\t'));
    });
});

For more Screen-Capturing.js snippets/help:


Do NOT Deploy Chrome Extension YourSelf!!!!

getScreenId | Capture Screen on Any Domain! This script is a hack used to support single chrome extension usage on any HTTPs domain.

First step, install this chrome extension:

Now use getScreenId.js (on any HTTPs page):

<script src="https://cdn.WebRTC-Experiment.com/getScreenId.js"></script>
<video controls autoplay></video>
<script>
getScreenId(function (error, sourceId, screen_constraints) {
    navigator.getUserMedia = navigator.mozGetUserMedia || navigator.webkitGetUserMedia;
    navigator.getUserMedia(screen_constraints, function (stream) {
        document.querySelector('video').src = URL.createObjectURL(stream);
    }, function (error) {
        console.error(error);
    });
});
</script>

License

Chrome-Extensions are released under MIT license . Copyright (c) Muaz Khan.

trial6's People

Contributors

nazariy995 avatar vidushi260 avatar ykhedher avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.