ooyala/ooyala-web-uploader — pull request #7 by deviantintegral (2012-09-17 17:52:03+00:00)
Title: Fixing progress and duplicate elements

This PR contains a few bug fixes, but there is one issue I'm stuck on and could use some feedback with.

Currently, a new ChunkProvider object is created for every single chunk as it's created. This breaks the page as in the constructor multiple input elements are created, one for each chunk of the asset being uploaded. I thought I had a decent solution in storing a reference to the current chunk provider in the HTMLUploader object, as you can see in: https://github.com/Lullabot/ooyala-web-uploader/commit/aacd3ef77c0c8fdb34509272eb523803ee4a0f9a

However, this seems to break uploading and causes multiple requests to be sent at once. My guess is that it's related to storing the current chunk in the same object instance, as at the end multiple "complete" events are fired leading to extra brokeness.

Is there a reason why the chunk provider needs to know about the browse button, and why it's part of the constructor? If not, can that be refactored into the HTMLUploader object? That would ensure that only one input element is created per HTMLUploader instantiation.