-
Notifications
You must be signed in to change notification settings - Fork 1.7k
MDN says FileReader.result is a String or ArrayBuffer, but Dartium says it's a Uint8List #17956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Related to https://code.google.com/p/dart/issues/detail?id=10136 it looks like. |
Marked this as being blocked by #10136. |
Removed Area-HTML label. |
Apparently I made the change: https://code.google.com/p/dart/issues/detail?id=17058 The 'fix' is to pass result.buffer. This assumes you know that the FileReader result is a Uint8List that is a total view of a buffer. I am not totally happy with this change, since a Uint8List might be a view of a piece of the buffer. It is an act of faith that the view is total. Passing result.buffer would pass more data than intended if the view was a partial view. decodeAudioData is also a problem. The W3 spec http://www.w3.org/TR/webaudio/ says the ArrayBuffer is temporarily neutered during the asynchronous decoding. AFAIK there is no way to do this with the VM types. The point-change is to document the new behaviour. It is more discoverable than the old in the editor (.buffer has a matching type, harder to discover The bigger change that needs to happen is to light a fire under issue #10136 and review all uses typed data to ensure the browser platform can properly be supported. Set owner to @sethladd. |
Removed the owner. |
Removed Type-Task label. |
Please re-open if this is still the case with the latest |
MDN docs say FileReader.result is "A string or an ArrayBuffer which depends on the method used to initiate the read operation.": https://developer.mozilla.org/en-US/docs/Web/API/FileReader.result
The API docs say result is an object: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart-dom-html.FileReader#id_result
In dartium, apparently FileReader.result is a Uint8List: (see screenshot)
Dart does not have a ArrayBuffer, but it does have a ByteBuffer.
decodeAudioData needs a ByteBuffer (previously, ArrayBuffer in JS world). See https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart-dom-web_audio.AudioContext#id_decodeAudioData
In JS code, I would get an ArrayBuffer from FileReader, and pass that decodeAudioData. Now, I get Uint8List from FileReader, so I need to convert.
Attachment:
[Screen Shot 2014-04-01 at 6.19.17 PM.png](https://storage.googleapis.com/google-code-attachments/dart/issue-17956/comment-0/Screen Shot 2014-04-01 at 6.19.17 PM.png) (208.11 KB)
The text was updated successfully, but these errors were encountered: