You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Becky Gibson <gi...@gmail.com> on 2012/03/06 18:59:28 UTC

Unified JS: Media onStatus

Maybe I should work my way through all of the issues in an object before
posting!

The functionality of media.onStatus has changed (at least for iOS).   The
unified version takes an id,  message type, and value.  Message type is a
MEDIA.code identifying the type of message - Media.MEDIA_STATE, etc.  The
behavior that has changed is for Media.MEDIA_ERROR.   The MediaError object
has a code and message parameter.   In the Unified JS version, the message
parameter is lost as it assumes the value input into onStatus is a media
error code:

else if (msg === Media.MEDIA_ERROR) {

        if (media.errorCallback) {

            media.errorCallback({"code":value});

        }

    }

Previously, iOS was passing back a MediaError object as the value parameter
with code and message values.

else if (msg == Media.MEDIA_ERROR) {

        if (media.errorCallback) {

            media.errorCallback(value); // value is a MediaError object

        }

    }

 I believe that an onStatus call with a msg parameter with a value of
Media.MEDIA_ERROR should be passing back a MediaError object as the value
parameter. This allows the device to pass back a more detailed error
message.  If you want to avoid having to modify the Android code we could
add an additional parameter to the onStatus method to allow the error
message to be provided and update the else if (msg == Media.MEDIA_ERROR)
clause to include it in the MediaError object if it was available.

What is the preferred way to resolve this?


thanks,

-becky

Re: Unified JS: Media onStatus

Posted by Filip Maj <fi...@adobe.com>.
Let's do it, let's also add the tests to mobile spec (and to the
cordova-js unit tests where applicable).

I can open up/fix any issues that arise on Android.

On 3/20/12 12:11 PM, "Becky Gibson" <gi...@gmail.com> wrote:

>Sending this out again as no one commented and I think we should fix.
>The
>docs indicates that Media error callback returns a MediaError object with
>a
>code and message parameter. In unified JS we are only returning a code
>parameter.
>
>iOS DID pass back a MediaError object in the Media.onStatus value
>parameter
>that included a message.  I'd like to update the unified JS code to
>maintain the message by passing back a MediaError object as the value
>paremter for status of MEDIA_ERROR.  If I do this Android will need to
>update.
>
>any objections?
>-becky
>
>
>
>On Tue, Mar 6, 2012 at 12:59 PM, Becky Gibson
><gi...@gmail.com>wrote:
>
>> Maybe I should work my way through all of the issues in an object before
>> posting!
>>
>> The functionality of media.onStatus has changed (at least for iOS).
>>The
>> unified version takes an id,  message type, and value.  Message type is
>>a
>> MEDIA.code identifying the type of message - Media.MEDIA_STATE, etc.
>>The
>> behavior that has changed is for Media.MEDIA_ERROR.   The MediaError
>>object
>> has a code and message parameter.   In the Unified JS version, the
>>message
>> parameter is lost as it assumes the value input into onStatus is a media
>> error code:
>>
>> else if (msg === Media.MEDIA_ERROR) {
>>
>>         if (media.errorCallback) {
>>
>>             media.errorCallback({"code":value});
>>
>>         }
>>
>>     }
>>
>> Previously, iOS was passing back a MediaError object as the value
>> parameter with code and message values.
>>
>> else if (msg == Media.MEDIA_ERROR) {
>>
>>         if (media.errorCallback) {
>>
>>             media.errorCallback(value); // value is a MediaError object
>>
>>         }
>>
>>     }
>>
>>  I believe that an onStatus call with a msg parameter with a value of
>> Media.MEDIA_ERROR should be passing back a MediaError object as the
>>value
>> parameter. This allows the device to pass back a more detailed error
>> message.  If you want to avoid having to modify the Android code we
>>could
>> add an additional parameter to the onStatus method to allow the error
>> message to be provided and update the else if (msg == Media.MEDIA_ERROR)
>> clause to include it in the MediaError object if it was available.
>>
>> What is the preferred way to resolve this?
>>
>>
>> thanks,
>>
>> -becky
>>
>>
>>
>>
>>


Re: Unified JS: Media onStatus

Posted by Becky Gibson <gi...@gmail.com>.
Sending this out again as no one commented and I think we should fix.   The
docs indicates that Media error callback returns a MediaError object with a
code and message parameter. In unified JS we are only returning a code
parameter.

iOS DID pass back a MediaError object in the Media.onStatus value parameter
that included a message.  I'd like to update the unified JS code to
maintain the message by passing back a MediaError object as the value
paremter for status of MEDIA_ERROR.  If I do this Android will need to
update.

any objections?
-becky



On Tue, Mar 6, 2012 at 12:59 PM, Becky Gibson <gi...@gmail.com>wrote:

> Maybe I should work my way through all of the issues in an object before
> posting!
>
> The functionality of media.onStatus has changed (at least for iOS).   The
> unified version takes an id,  message type, and value.  Message type is a
> MEDIA.code identifying the type of message - Media.MEDIA_STATE, etc.  The
> behavior that has changed is for Media.MEDIA_ERROR.   The MediaError object
> has a code and message parameter.   In the Unified JS version, the message
> parameter is lost as it assumes the value input into onStatus is a media
> error code:
>
> else if (msg === Media.MEDIA_ERROR) {
>
>         if (media.errorCallback) {
>
>             media.errorCallback({"code":value});
>
>         }
>
>     }
>
> Previously, iOS was passing back a MediaError object as the value
> parameter with code and message values.
>
> else if (msg == Media.MEDIA_ERROR) {
>
>         if (media.errorCallback) {
>
>             media.errorCallback(value); // value is a MediaError object
>
>         }
>
>     }
>
>  I believe that an onStatus call with a msg parameter with a value of
> Media.MEDIA_ERROR should be passing back a MediaError object as the value
> parameter. This allows the device to pass back a more detailed error
> message.  If you want to avoid having to modify the Android code we could
> add an additional parameter to the onStatus method to allow the error
> message to be provided and update the else if (msg == Media.MEDIA_ERROR)
> clause to include it in the MediaError object if it was available.
>
> What is the preferred way to resolve this?
>
>
> thanks,
>
> -becky
>
>
>
>
>