SOURCE

console 命令行工具 X clear

                    
>
console
function makeRequest(method, url) {
    return new Promise(function (resolve, reject) {
        let xhr = new XMLHttpRequest();
        xhr.responseType = 'arraybuffer';
        xhr.open(method, url);
        xhr.onload = function () {
            if (this.status >= 200 && this.status < 300) {
                resolve(xhr.response);
            } else {
                reject({
                    status: this.status,
                    statusText: xhr.statusText
                });
            }
        };
        xhr.onerror = function () {
            reject({
                status: this.status,
                statusText: xhr.statusText
            });
        };
        xhr.send();
    });
}

function loadFromBuffer(file, buffer) {
    return new Promise(function (resolve, reject) {
        file.onError = function (e) {
            reject(e);
        };
        file.onReady = function (info) {
            resolve(info);
        };
        let tempBuffer = buffer;
        tempBuffer.fileStart = 0;
        if (!tempBuffer.fileStart) {
            // IE does not support adding properties to an ArrayBuffer generated by XHR
            tempBuffer = buffer.slice(0);
            tempBuffer.fileStart = 0;
        }
        file.appendBuffer(tempBuffer, true);
        file.flush();
    });
}

var videoUrl = "https://editor-engine.test.bhbapp.cn/videos/b.mp4";

async function start() {

    let videoBuffer = await makeRequest("GET", videoUrl);
    let videofile = MP4Box.createFile();
    let videoInfo = await loadFromBuffer(videofile, videoBuffer);

    // videofile.save("test.mp4");
}

start();  
<html>
    <head></head>
    <body>
	
</body>
</html>

本项目引用的自定义外部资源