Code Monkey home page Code Monkey logo

concatenateblobs's People

Contributors

muaz-khan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

concatenateblobs's Issues

Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'.

Hello. This is package is exactly what I need.
Unfortunately it is not working.
Is it still active the project?

I am passing the array of blobs but I am getting the following error:

Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'.

screen shot 2018-09-28 at 17 56 02

I am simply calling the function and passing my array of blobs:

ConcatenateBlobs([this.blobArray], 'audio/wav', function(resultingBlob) {
  console.log({resultingBlob})
});

Do you know why this is happening?

Thanks!

concatenateBuffers delete call doesn't work as intended.

An updated version. Let me know what you think. There are a few notes/TODOs. I'm not entirely confident in it, but I'm sure that the delete call from before was not working as intended.

    function concatenateBuffers() {
        var byteLength = 0;
        buffers.forEach(function(buffer) {
            byteLength += buffer.byteLength;
            // TODO(datermine): Figure out if this is necessary.
            if (buffer.byteLength % 2 != 0) {
              byteLength--;
            }
        });
        var tmp = new Uint16Array(byteLength);

        var lastOffset = 0;
        buffers.forEach(function(buffer) {
            // BYTES_PER_ELEMENT == 2 for Uint16Array
            var bufferByteLength = buffer.byteLength;
            if (bufferByteLength % 2 != 0) {
                // NOTE(datermine): Uses to delete, now we use slice.
                // delete buffer[bufferByteLength - 1];
                buffer = buffer.slice(0, bufferByteLength - 1)
                // NOTE(datermine): Once we slice instead of delete, this is really
                // no longer necessary as it's the same as buffer.byteLength
                bufferByteLength -= 1;
            }
            tmp.set(new Uint16Array(buffer), lastOffset);
            // NOTE(datermine): We could just use buffer.byteLength here.
            lastOffset += bufferByteLength;
        });

        var blob = new Blob([tmp.buffer], {
            type: type
        });

        callback(blob);
    }

Concat not working...

I tried to concat my webm blobs but doesn't work...

ConcatenateBlobs(window.arrVideoBlob, document.getElementById('video').getAttribute('data-type'), function(resultingBlob) {
    console.log(bytesToSize(resultingBlob.size));
    document.getElementById('video').src = URL.createObjectURL(resultingBlob);
    document.getElementById('video').play();
});

this is the code

i'm just curious

Why would you need a lib for this?

isn't this enought?

a = new Blob(["a"])
b = new Blob(["b"])
ab = new Blob([a,b])

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.