Merge pull request #107 from bparadie/fixes-101
Improper FLV header generation
Showing
1 changed file
with
6 additions
and
4 deletions
... | @@ -45,7 +45,8 @@ | ... | @@ -45,7 +45,8 @@ |
45 | headBytes = new Uint8Array(3 + 1 + 1 + 4), | 45 | headBytes = new Uint8Array(3 + 1 + 1 + 4), |
46 | head = new DataView(headBytes.buffer), | 46 | head = new DataView(headBytes.buffer), |
47 | metadata, | 47 | metadata, |
48 | result; | 48 | result, |
49 | metadataLength; | ||
49 | 50 | ||
50 | // default arguments | 51 | // default arguments |
51 | duration = duration || 0; | 52 | duration = duration || 0; |
... | @@ -80,9 +81,10 @@ | ... | @@ -80,9 +81,10 @@ |
80 | metadata = new FlvTag(FlvTag.METADATA_TAG); | 81 | metadata = new FlvTag(FlvTag.METADATA_TAG); |
81 | metadata.pts = metadata.dts = 0; | 82 | metadata.pts = metadata.dts = 0; |
82 | metadata.writeMetaDataDouble("duration", duration); | 83 | metadata.writeMetaDataDouble("duration", duration); |
83 | result = new Uint8Array(headBytes.byteLength + metadata.byteLength); | 84 | metadataLength = metadata.finalize().length; |
84 | result.set(head); | 85 | result = new Uint8Array(headBytes.byteLength + metadataLength); |
85 | result.set(head.bytesLength, metadata.finalize()); | 86 | result.set(headBytes); |
87 | result.set(head.byteLength, metadataLength); | ||
86 | 88 | ||
87 | return result; | 89 | return result; |
88 | }; | 90 | }; | ... | ... |
-
Please register or sign in to post a comment