I am trying to chase down a few failing tests, here is one of the
simpler cases I am having to deal with.
I need to know which of the following is correct.
( note that there are numerous other similar cases like this
throughout our code base )

The W3 Spec for MediaError is [1] :

interface MediaError {
  const unsigned short MEDIA_ERR_ABORTED = 1;
  const unsigned short MEDIA_ERR_NETWORK = 2;
  const unsigned short MEDIA_ERR_DECODE = 3;
  const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
  readonly attribute unsigned short code;
};

The phonegap edge docs state [2]:

MediaError.MEDIA_ERR_ABORTED
MediaError.MEDIA_ERR_NETWORK
MediaError.MEDIA_ERR_DECODE
MediaError.MEDIA_ERR_NONE_SUPPORTED

The tests are testing for [3] :

expect(MediaError.MEDIA_ERR_NONE_ACTIVE).toBe(0);
expect(MediaError.MEDIA_ERR_ABORTED).toBe(1);
expect(MediaError.MEDIA_ERR_NETWORK).toBe(2);
expect(MediaError.MEDIA_ERR_DECODE).toBe(3);
expect(MediaError.MEDIA_ERR_NONE_SUPPORTED).toBe(4);

The cordova js repo defines this [4] :

MediaError.MEDIA_ERR_NONE_ACTIVE    = 0;
MediaError.MEDIA_ERR_ABORTED        = 1;
MediaError.MEDIA_ERR_NETWORK        = 2;
MediaError.MEDIA_ERR_DECODE         = 3;
MediaError.MEDIA_ERR_NONE_SUPPORTED = 4;

How should I resolve this?
Can we remove MEDIA_ERR_NONE_ACTIVE ?
Can we re-define 4 as MEDIA_ERR_SRC_NOT_SUPPORTED instead of
MEDIA_ERR_NONE_SUPPORTED ?
Can we change our js code to only write the MediaError interface if it
does not exist?

[1] http://dev.w3.org/html5/spec-author-view/video.html#error-codes
[2] http://docs.phonegap.com/en/edge/cordova_media_media.md.html#mediaError
[3] 
https://github.com/apache/incubator-cordova-mobile-spec/blob/master/autotest/tests/media.tests.js
[4] 
https://github.com/apache/incubator-cordova-js/blob/master/lib/common/plugin/MediaError.js
-- 
@purplecabbage
risingj.com

Reply via email to