GithubHelp home page GithubHelp logo

tempbottle / flashgetusermedia Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maciejzasada/flashgetusermedia

0.0 1.0 0.0 166 KB

Provides WebRTC getUserMedia fallback via Flash plugin for browsers that do not support getUserMedia natively.

JavaScript 86.01% HTML 1.76% ActionScript 12.23%

flashgetusermedia's Introduction

flashGetUserMedia

Provides WebRTC getUserMedia() fallback via Flash plugin for browsers that do not support getUserMedia() natively.

Usage

flashGetUserMedia.init({swfPath: 'flashGetUserMedia.swf', force: false});
navigator.getUserMedia({audio: true, video: false}, successHandler, failureHandler);

Options

  • swfPath path to flashGetUserMedia.swf file
  • force force usage of flashGetUserMedia even if native getUserMedia is supported by the browser

Example implementation

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script type="text/javascript" src="vendor/recorder.js"></script>
    <script type="text/javascript" src="flashGetUserMedia.js"></script>
</head>
<body>

<script>

    var audioContext, mediaStreamSource, recorder;

    function onGetMediaSuccess(source) {

        mediaStreamSource = audioContext.createMediaStreamSource(source);
        setTimeout(function () {
            record();
        }, 1);

    }

    function onGetMediaFail() {

        console.log('media fail handler');

    }

    function record() {

        recorder = new Recorder(mediaStreamSource);
        recorder.record();

    }

    function stopAndPlay() {

        recorder.stop();
        recorder.exportWAV(function(s) {

            var audio = document.createElement( 'audio' );
            audio.src = window.URL.createObjectURL(s);
            audio.id = 'record';
            document.body.appendChild(audio);
            audio.play();

        });

    }

    flashGetUserMedia.init({swfPath: 'flashGetUserMedia.swf', force: true});

    audioContext = new AudioContext();
    navigator.getUserMedia({audio: true, video: false}, onGetMediaSuccess, onGetMediaFail);

</script>

</body>
</html>

Project Status

v. 0.1 (28/06/2013)

  • experimental implementation
  • Microphone implemented
  • allow / deny handling
  • possible to access microphone data via JS with idential interface to HTML5
  • possible to record and play back microphone data via JS with identical interface to HTML5
  • Camera implementation pending

flashgetusermedia's People

Contributors

maciejzasada 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.