81700409 by David LaPalomento

Merge pull request #107 from bparadie/fixes-101

Improper FLV header generation
2 parents 56520081 79249955
......@@ -45,7 +45,8 @@
headBytes = new Uint8Array(3 + 1 + 1 + 4),
head = new DataView(headBytes.buffer),
metadata,
result;
result,
metadataLength;
// default arguments
duration = duration || 0;
......@@ -80,9 +81,10 @@
metadata = new FlvTag(FlvTag.METADATA_TAG);
metadata.pts = metadata.dts = 0;
metadata.writeMetaDataDouble("duration", duration);
result = new Uint8Array(headBytes.byteLength + metadata.byteLength);
result.set(head);
result.set(head.bytesLength, metadata.finalize());
metadataLength = metadata.finalize().length;
result = new Uint8Array(headBytes.byteLength + metadataLength);
result.set(headBytes);
result.set(head.byteLength, metadataLength);
return result;
};
......