I am trying to create Blob
from ArrayBuffer
using .slice()
, because I need to copy ArrayBuffer
since I know that it will be changed in future (its byteLength
will be 0) by code which I don't have control/want to change.
new Blob([data2.payload.slice()], {type: "video/MP2T"})
And I get error
Cannot perform ArrayBuffer.prototype.slice on a detached ArrayBuffer
on
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
on Windows 7 x64.
Is there any other ways to copy ArrayBuffer
?
This way not does actual copy, other ways does not seems to be pretty straightforward.
ArrayBuffer.transfer() looks good, but theirs polyfill produce error
Source and destination must be ArrayBuffer instances