If JPEGEncoder is an actionscript encoder, you could switch to using the
native encoding support. It is much faster.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html#encode()



On Tue, Apr 25, 2017 at 6:45 AM, Erik J. Thomas <[email protected]> wrote:

> Hey all:
>
> My flex mobile app posts social chat messages with an optional image. It
> uses CameraRoll to allow the user to select any image on their phone. But
> modern phones take HUGE pics. We don't need full res photos for the chat
> and don't want to use up the bandwidth uploading full images and resizing
> on the server.
>
> The API we hit accepts an octet stream of bytes that represents the file.
> All this functions fine, but it takes about 10 seconds to upload an HDR
> rear camera photo on an iPhone 6 Plus.
>
> I'd like to resize it on the client. But using both PNG and JPG encoders
> are far too slow:
>
> var bitmapData:BitmapData = new BitmapData(photo.width, photo.height,
> true, 0xffffff);
> var jpegEncoder:JPEGEncoder = new JPEGEncoder();
> urlRequest.data = jpegEncoder.encode(bitmapData); // this takes like 12
> seconds for a 13 MB iPhone 6 photo.
>
> So uploading is the better solution from a user experience perspective
> because UI can remain responsive while the async upload occurs. Resizing
> the image using an encoder cannot be done asynchronously so it blocks UI
> and we can do nothing but show a busy cursor.
>
> I don't like either solution. Someone out there have any ideas?
>
> Thanks.
>
> Erik
>
>

Reply via email to