3.3.0 • Published 2 years ago

@realeyes/environment-checker v3.3.0

Weekly downloads
41
License
Apache-2.0
Repository
github
Last release
2 years ago

Environment Checker

This package allows you to automatically run the environment check and receive the return the result in a simplified format. We provide two versions of Environment Checker, version 1 should be used for flash-only collections, version 2 for flash and WebRTC collections.

Installation

CDN version

The general format for the script URL is "https://codesdwncdn.realeyesit.com/environment-checker/release/{version}/Realeyesit.EnvironmentalDetectionAPI.js". You can specify which kinds of updates your app can accept using semver string in a following format:

  • x.y.z to load the exact version, for example: https://codesdwncdn.realeyesit.com/environment-checker/release/2.2.1/Realeyesit.EnvironmentalDetectionAPI.js
  • x.y to receive patch updates: https://codesdwncdn.realeyesit.com/environment-checker/release/2.2/Realeyesit.EnvironmentalDetectionAPI.js
  • x to receive minor updates: https://codesdwncdn.realeyesit.com/environment-checker/release/2/Realeyesit.EnvironmentalDetectionAPI.js

This example loads the latest release of version 2:

<script src="https://codesdwncdn.realeyesit.com/environment-checker/release/2/Realeyesit.EnvironmentalDetectionAPI.js"></script>

Self hosted

To use the self-hosted solution you will have to download the archive that contains all necessary files and deploy it on your host https://codesdwncdn.realeyesit.com/environment-checker/release/2/environment-checker.zip. You will also have to change the SWF path in the javascript source code. Find the DEFAULT_FLASH_DETECTOR_PATH variable and replace its value, for example DEFAULT_FLASH_DETECTOR_PATH = 'https://example.com/environment-detector.swf';

API

To use environment checker you can register a callback function _RealeyesitEnvDetectCallback or _RealeyesitEnvDetectParams._callback. The other way is to call the Realeyesit.EnvironmentalDetectionAPI.start(callback, options) method manually. In this case you should provide the callback that will handle the result. options parameter is optional and can be used to disable logging, for example: Realeyesit.EnvironmentalDetectionAPI.start(callback, { logger: { disable: true } }). The result will be in the following format:

{
  checksPassed: boolean,
  failureReasonCode: number,
  failureReasonString: string,
  detectorResult: {
          browser: {
            name: string,
            version: string,
          },
          platform: {
            type: string,
          },
          os: {
            name: string,
            version: string,
          },
          flash: ({
            version: string,
          }|null),
          webcams: Array.<string>,
          capabilities: Array.<string>
          },
}

Where 'failureReasonCode' is one of:

  • FLASH_NOT_INSTALLED: 1
  • FLASH_TOO_OLD: 2
  • FLASH_BLACKLISTED: 3
  • BROWSER_NOT_CAPABLE: 4
  • MOBILE_BROWSER: 5
  • NO_WEBCAMS_DETECTED: 6
  • OTHER_ERROR: 7

And 'detectorResult' is a result object of environment detector (see more Environment Detector API)

NOTE: if you are using Environment Checker, then there is no need to use Environment Detector separately.

Example usage

<script type="text/javascript">
    function environmentalDetectionCallback(result) {
        alert(result.checksPassed ? 'Passed ' : 'Failed. ' + result.failureReasonString);
    }
    var _RealeyesitEnvDetectParams = _RealeyesitEnvDetectParams || {};
    _RealeyesitEnvDetectParams._callback = environmentalDetectionCallback;
    (function() {
        var envDetect = document.createElement('script');
        envDetect.type = 'text/javascript';
        envDetect.async = true;
        envDetect.src = 'https://codesdwncdn.realeyesit.com/environment-checker/Realeyesit.EnvironmentalDetectionAPI.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(envDetect, s);
    })();
</script>

License

Copyright 2016 Realeyes OU.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

3.3.0-stage.3

2 years ago

3.3.0-stage.5

2 years ago

3.3.0-stage.6

2 years ago

3.3.0-stage.7

2 years ago

3.3.0-stage.8

2 years ago

3.3.2-stage.4

2 years ago

3.3.2-stage.3

2 years ago

3.3.2-stage.2

2 years ago

3.3.2-stage.1

2 years ago

3.3.0

3 years ago

3.3.0-stage.2

3 years ago

3.3.0-stage.1

3 years ago

3.1.17-stage.67

3 years ago

3.2.0-stage.2

3 years ago

3.1.17

4 years ago

3.1.17-stage.2

4 years ago

3.1.16

4 years ago

3.1.16-stage.10

4 years ago

3.1.16-stage.9

4 years ago

3.1.16-stage.8

4 years ago

3.1.16-stage.4

4 years ago

3.1.15

4 years ago

3.1.15-stage.4

4 years ago

3.1.15-stage.3

4 years ago

3.1.15-stage.2

4 years ago

3.1.14

4 years ago

3.1.13

5 years ago

3.1.12

5 years ago

3.1.10

5 years ago

3.1.9

6 years ago

3.1.6

6 years ago

2.5.6

6 years ago

2.5.5

6 years ago

3.1.4

6 years ago

3.1.3

6 years ago

3.1.1

6 years ago

2.5.4

6 years ago

2.5.3

6 years ago

3.1.0

6 years ago

2.3.2

7 years ago

2.3.1

7 years ago

2.2.7

7 years ago

2.2.6

7 years ago

2.2.4

7 years ago

2.2.3

7 years ago

1.1.2

7 years ago

2.2.1

7 years ago

1.1.0

7 years ago

2.1.0

7 years ago

2.0.3

7 years ago

1.0.7

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago