amfUtils.js
function amf3decUI29(buf) {
    var val = 0;
    var len = 1;
    var b;

    do {
        b = buf.readUInt8(len++);
        val = (val << 7) + (b & 0x7F);
    } while (len < 5 || b > 0x7F);

    if (len == 5) val = val | b; // Preserve the major bit of the last byte

    return { len: len, value: val }
}
function amf3decUI29(buf) {
    var val = 0;
    var len = 1;
    var b;

    do {
        b = buf.readUInt8(len++);
        val = (val << 7) + (b & 0x7F);
    } while (len < 5 || b > 0x7F);

    if (len == 5) val = val | b; // Preserve the major bit of the last byte

    return { len: len, value: val }
}
function amf3decUI29 ( buf ) { var val = 0 ; var len = 1 ; var b ; do { b = buf . readUInt8 ( len ++ ) ; val = ( val << 7 ) + ( b & 0x7F ) ; } while ( len < 5 || b > 0x7F ) ; if ( len == 5 ) val = val | b ; // Preserve the major bit of the last byte return { len : len , value : val } }
Generic decode of AMF3 UInt29 values
@param buf
@returns {{len: number, value: number}}
Generic decode of AMF3 UInt29 values