Skip to content

v2.0.0

Compare
Choose a tag to compare
@jeffswartz jeffswartz released this 14 Aug 21:57
· 98 commits to develop since this release
37d0be7

New features:

  • Added Safari support for the NetworkTest.testQuality() method.

  • The NetworkTest.testConnectivity() and NetworkTest.testQuality() methods no longer takes a
    completionHandler parameter. Use the Promise returned by these methods to monitor completion
    and failure. (Note that if you need to support Internet Explorer, you will need to use a
    Promise polyfill.)

  • The results object for NetworkTest.testQuality() now includes separate MOS results for
    audio and video:

    otNetworkTest.testQuality().then((results) => {
      console.log('Audio MOS:', results.audio.mos);
      console.log('Video MOS', results.video.mos);
    });

    These two MOS results replace the single MOS result (results.mos) in v1.

  • Added support for audio-only tests and setting a time limit on the NetworkTest.testQuality()
    method.

    The NetworkTest constructor function now has an optoinal third parameter -- options. This
    options object has two properties, audioOnly and timeout. Set audioOnly to true to
    have the test run in audio-only mode. Set timeout to a number specifying the timeout for the
    NetworkTest.testQuality() method, in millisecond (set this to a value between 5000 and 30000 --
    5 and 30 seconds):

    const sessionInfo = {
      apiKey: '123456', // Add the API key for your OpenTok project here.
      sessionId: '1_MX40NzIwMzJ-fjE1MDElGQkJJfn4', // Add a test session ID for that project
      token: 'T1==cGFydG5lcXN0PQ==' // Add a token for that session here
    }
    const options = { audioOnly: true, timeout: 15000 };
    const otNetworkTest = new NetworkTest(OT, sessionInfo, options);
  • Added a NetworkTest.stop() method. Calling this method causes the quality test to stop
    as soon as it is able to obtain results. (Running the test for the complete duration should
    produce more accurate MOS results.)

  • The module now exports two objects: NetworkTest (the default) and ErrorNames.

    The new ErrorNames enumerates error name values. Use these values to determine the type
    of error received:

    import NetworkTest, { ErrorNames }  from 'opentok-network-test-js';
    // ...
    otNetworkTest.testQuality().then(() => {
      // Display results
    }).catch((error) => {
      switch (error.name) {
        case ErrorNames.INIT_PUBLISHER_ERROR:
          // Notify the user to grant access to the camera and microphone
          break;
        // ...
      }
    });