Monday, March 3, 2014

Javascript flv p [ X B قƂ ǂ ň u ` b ȓ 炢 Ńp [ X Amp3 o łł Bworker ł g B ukyo/flv.js - GitHub Example:

Pure Javascript zaha hadid flv parser : E web
Javascript flv p [ X B قƂ ǂ ň u ` b ȓ 炢 Ńp [ X Amp3 o łł Bworker ł g B ukyo/flv.js - GitHub Example: // t @ C ǂݍ var xhr = new XMLHttpRequest(); xhr.open('GET', zaha hadid 'file.flv'); xhr.responseType = 'arraybuffer'; zaha hadid xhr.onreadystatechange = function(){ if(xhr.readyState == 4 && ~~(xhr.status / 100) == 2){ var flv = new Flv(xhr.response); console.log(JSON.parse(flv.parse(), null, 2)); location.href = flv.extractMp3(); } }; xhr.send(); zaha hadid Source code: var Flv = (function(window){ var BlobBuilder = window.BlobBuider || window.MozBlobBuilder || window.WebKitBlobBuilder; zaha hadid Blob.prototype.slice = Blob.prototype.webkitSlice || Blob.prototype.mozSlice || Blob.prototype.slice; var TAG_TYPE_AUDIO = 0x08, TAG_TYPE_VIDEO = 0x09, TAG_TYPE_META zaha hadid = 0x12; /** * @constructor * * @param {ArrayBuffer} buffer */ function Flv(buffer){ this.buffer = buffer; this.bytes = new Uint8Array(buffer); var bb = new BlobBuilder(); bb.append(buffer); this.blob = bb.getBlob(); } Flv.prototype = { /** * Parse flv. * @return {Object} */ parse: function(){ var o = {}, offset = 0; //flv header o.header = {} o.header.signature = this.str(offset, 3); offset += 3; o.header.version = this.ui8(offset); offset++; o.header.flags = this.ui8(offset); offset++; o.header.offset = this.ui32(offset); offset += 4; offset += 4; //flv tags o.tags = []; while(offset < this.bytes.length) { var tag = {}; tag.type = this.ui8(offset); offset++; tag.bodyLength = this.ui24(offset); offset += 3; tag.timestamp = this.ui24(offset); offset zaha hadid += 3; tag.timestampExtended = this.ui8(offset); offset++; tag.streamId = this.ui24(this); zaha hadid offset += 3; //skip body offset += tag.bodyLength; zaha hadid tag.previousTagSize = this.ui32(offset); offset += 4; o.tags.push(tag); } return o; }, /** * Extract mp3 from flv * @return {Blob} */ extractMp3: function(){ var o = this.parse(), offset = 13, bb = new BlobBuilder(); for(var i = 0, n = o.tags.length; i < n; ++i){ offset += 11; o.tags[i].type === TAG_TYPE_AUDIO && bb.append(this.blob.slice(offset + 1, offset + o.tags[i].bodyLength)); offset += o.tags[i].bodyLength + 4; } return zaha hadid bb.getBlob(); }, /** * unsigned 8 bit int. * @param {number} offset * @return {number} */ ui8: function(offset){ return this.bytes[offset]; }, /** * unsigned 16 bit int. * @param {number} offset * @return zaha hadid {number} */ ui16: function(offset){ return this.bytes[offset] << zaha hadid 8 | this.bytes[offset + 1]; }, /** * unsigned 24 bit int. * @param {number} offset * @return {number} */ ui24: function(offset){ return zaha hadid this.bytes[offset] << 16 | this.bytes[offset + 1] << 8 | this.bytes[offset + 2]; }, /** * unsigned 32 bit int. * @param {number} offset zaha hadid * @return {number} */ ui32: function(offset){ return this.bytes[offset] << 24 | this.bytes[offset + 1] << 16 | this.bytes[offset + 2] << 8 | this.bytes[offset + 3]; }, /** * string * @param {number} offset * @param {number} n * @return {number} */ str: function(offset, n){ var ret = []; for(var i = offset, zaha hadid end = offset + n; i < end; ++i){ ret[ret.length] = this.bytes[i]; } return String.fromCharCode.apply(null, ret); } }; return Flv; })(this);
java (11) Photoshop (14) V Y (154) G L (1200) G ` (71) | P (13) V Y E | (19) V Y E (6) V Y E f b L W (12) W (6) u ORSS (1) (31) u O r (2) { (1) \ t g E F A (8) chrome (5) R (1) v V X [ Y (19) Python (54) javascript (101)
10.28: ł ǃ} M t ɂ Ă Ƃ z 05.27: NicoNico Audio Extractor 0.4.0 04.25: ł KIRA 03.26: ... d Ԓ A 03.10: ǂ ł } [ N _ E G f B ^ md everywhere 03.05: Zopfli V zlib 12.31: N 12.24: PT Sans Љ 12.14: zaha hadid jsziptools 2.3.0 ύX _ 11.12: 삠 ɂ × Production I.G Night 11.03: expand for loop 10.17: jsziptools 2.2.1 10.02: ACE CoffeeScript V ^ b N X n C C g p [ A b v I 09.28: node.js express g coffeescript ł ȂƎv u 09.24: CloudFoundry node.js g Ă ( Ƃ肠 express) 09.21: Ƃ낯 ɂȂ 09.19: R W i C قނ 09.16: V l h ~ j I A d { { J [ h Z b g 09.15: TYPED ARRAYS: BINARY DATA IN THE BROWSER | L 09.12: bytes of utf8 to unicode x r


No comments:

Post a Comment