I'm trying to build a webcam snapshot recorder. It should take a picture and upload it to the WP media library via ajax / async-upload. 

Already managed to add a view to the media library. Recording also works. 
I can either store the raw image data in blob or in base 64 encoded string (like data url)

How can I put this data into the upload queue?

Any suggestion / further reading / well explained reasons why this won't work appreciated.

Thanks a lot, joern

EDIT: 
This is my code so far. It


adds a panel to WP media library. 
displays an image with
src="data:image/
Tries to generate a file-like object and put it in the upload queue. (That's where I'm failing) 


JS-Dependency: Needs github repo blueimp/JavaScript-Canvas-to-Blob

&lt;script type="text/javascript"&gt;
(function($){
var media = wp.media,
    l10n = media.view.l10n = typeof _wpMediaViewsL10n === 'undefined' ? {} : _wpMediaViewsL10n;

// override router creation
media.view.MediaFrame.Post.prototype.browseRouter = function( view ) {
    view.set({
        upload: {
            text:     l10n.uploadFilesTitle,
            priority: 20
        },
        dataurltest: {
            text:     'DataUrl Test', 
            priority: 30
        },
        browse: {
            text:     l10n.mediaLibraryTitle,
            priority: 40
        }
    });
};

var bindHandlers = media.view.MediaFrame.Post.prototype.bindHandlers,
    dataUrlTest, frame;

media.view.MediaFrame.Post.prototype.bindHandlers = function() {
    // bind parent object handlers
    bindHandlers.apply( this, arguments );
    // bind our create handler.
    this.on( 'content:create:dataurltest', this.dataurltestContent, this );
    frame = this;
};
media.view.MediaFrame.Post.prototype.dataurltestContent = function( content ){
    // generate test content
    var state = this.state();
    this.$el.removeClass('hide-toolbar');
    dataUrlTest = new media.view.dataUrlTest({});
    content.view = dataUrlTest;
}


media.view.dataUrlTest = media.View.extend({
    // our test view
    tagName:   'div',
    className: 'data-url-test',

    initialize: function() {
        _.defaults( this.options, {

        });
        var self = this, 
            blob;


        // add image with data-url to panel content
        var b64Data = 'R0lGODdhUAA8AIABAAAAAP///ywAAAAAUAA8AAACS4SPqcvtD6' +
                'OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofE' +
                'ovGITCqXzKbzCY1Kp9Sq9YrNarfcrvcLDovH5PKsAAA7',
            imageUrl = 'data:image/gif;base64,' + b64Data,
            $img = $('&lt;img src="'+imageUrl+'" /&gt;')
                .appendTo(this.$el);
        // add a submit link
        $('&lt;a href="#" class="test-send"&gt;Okay&lt;/a&gt;')
            .insertAfter($img)
            .on('click',null,function(){
                // creating a blob would go like this:
                //blob = window.dataURLtoBlob &amp;&amp; window.dataURLtoBlob($img.get(0).src)

                var file = new plupload.File(null,b64Data);
                file.name = 'test.gif';
                file.id = 'id'+(new Date()).getTime(); 

                var attributes = _.extend({
                    file:      file,
                    uploading: true,
                    date:      new Date(),
                    filename:  'test.gif',
                    menuOrder: 0,
                    uploadedTo: wp.media.model.settings.post.id,
                    type : 'image',
                    subtype : 'gif'
                }, _.pick( file, 'loaded', 'size', 'percent' ) );

                file.attachment = wp.media.model.Attachment.create( attributes );
                wp.Uploader.queue.add(file.attachment);
                frame.uploader.uploader.uploader.refresh();
                frame.uploader.uploader.uploader.start();
            });

    },
});

return;




})(jQuery);
&lt;/script&gt;



Question: How best can I discover what is up with my electrical bill?
Answer: You could invest in a clamp on Ammeter like this



Then open up your electrical panel and measure the draw on each circuit, this will show you which circuits are drawing the most.

Also as Mike Powell pointed out, you could clamp on to the main lines and then turn off each breaker noting how much the value drops. (You will have to do this for each leg of the main). 

Once you know which circuits are drawing the most power, you can start eliminating devices on that circuit until you find the largest consumers. 

If you want you can figure out how much your devices cost to run like this.

 Watts = Amps * Volts
 Kilowatts = Watts/1000
 Kilowatt-hours = kilowatts * Hours used
 Cost = kilowatt-hours * cost per kilowatt-hour


Or

 Cost = (((Amps * Volts)/1000) * Hours Used) * Cost per Kilowatt


You could also do like I did and split an old extension cord (so you can clamp on to a single wire), then plug one end into the wall, and your device into the other end. Then you can measure the draw of just that device.