; (function (window) {
    var target = null;
    function initByIframeId(iframeId) {
        var iframe = window.document.getElementById(iframeId);
        if (!!iframe) {
            target = iframe.contentWindow.rtmpCapturer;
            var result = target.init("video1");
            // 这里必须指定类型，不然dart callMethod返回结果都是JSObject
            return Array.from(result);
        } else {
            return [0, 0];
        }
    }
    window.rtmpCapturer = {
        init: initByIframeId,
        setClipSize: function (width, height) {
            target.setClipSize(width, height);
        },
        captureOne: async function () {
            var result = await target.captureOne();
            // 指定类型 Uint8Array
            return new Uint8Array(result);
        },
        release: function () {
            target.release();
        },
    };
})(window);