mercredi 28 septembre 2016

AS3 MediaPromise for CameraUI doesn't get back to me on iOS

I need to capture an image using CameraUI on AS3/Air/Starling framework. I get the CameraUI, it opens, the image gets selected and I receive a MediaPromise object.

The samples in the documentation mentions the following code to capture the Image from an async media promise on iOS but I do not hear any callbacks in neither onMediaLoaded function nor the ioError function.

BTW the log line "Asynchronous Mode Media Promise." is displayed when I choose a photo.

private function imageSelected(evt:MediaEvent):void
{
    this.feedbackText.text = "Image Selected\n";

    // Create a new imagePromise
    var imagePromise:MediaPromise = evt.data;

    // Open our data source
    dataSource = imagePromise.open();

    if(imagePromise.isAsync)
    {
        this.feedbackText.text += "Asynchronous Mode Media Promise.\n";

        var eventSource:IEventDispatcher = dataSource as IEventDispatcher;

        eventSource.addEventListener( Event.COMPLETE, onMediaLoaded );
        eventSource.addEventListener( IOErrorEvent.IO_ERROR, ioError );
    }
    else
    {
        this.feedbackText.text += "Synchronous Mode Media Promise.\n";
        readMediaData();
    }
}

Aucun commentaire:

Enregistrer un commentaire