JSFiddle - React, Tailwind, and code Playground

by Manna

JavaScript

var Recorder = {
    swfObject: null,
    _callbacks: {},
    _events: {},
    _initialized: false,
    options: {},
    initialize: function(options) {
        debugger
        this.options = options || {};
        if (!this.options.flashContainer) {
            this._setupFlashContainer()
        }
        this.bind("initialized", function() {
            Recorder._initialized = true;
            options.initialized()
        });
        this.bind("showFlash", this.options.onFlashSecurity || this._defaultOnShowFlash);
        this._loadFlash()
    },
    clear: function() {
        Recorder._events = {}
    },
    record: function(options) {
        options = options || {};
        this.clearBindings("recordingStart");
        this.clearBindings("recordingProgress");
        this.clearBindings("recordingCancel");
        this.bind("recordingStart", this._defaultOnHideFlash);
        this.bind("recordingCancel", this._defaultOnHideFlash);
        this.bind("recordingCancel", this._loadFlash);
        this.bind("recordingStart", options["start"]);
        this.bind("recordingProgress", options["progress"]);
        this.bind("recordingCancel", options["cancel"]);
        this.flashInterface().record()
    },
    stop: function() {
        return this.flashInterface()._stop()
    },
    play: function(options) {
        options = options || {};
        this.clearBindings("playingProgress");
        this.bind("playingProgress", options["progress"]);
        this.bind("playingStop", options["finished"]);
        this.flashInterface()._play()
    },
    upload: function(options) {
        options.audioParam = options.audioParam || "audio";
        options.params = options.params || {};
        this.clearBindings("uploadSuccess");
        this.bind("uploadSuccess", function(responseText) {
            options.success(Recorder._externalInterfaceDecode(responseText))
        });
        this.flashInterface().upload(options.url, options.audioParam, options.params)
   ...