How to modify error data on client side?

It is possible to dynamically modify the information that is tracked when an error in the player occurs.
Currently this is available on Android, iOS and Web. Roku is coming soon.

The analytics collectors offer an API to modify the error code, error message and error severity.
The error severity can be CRITICAL or INFO, and defaults to CRITICAL for all errors except the analytics error 10000 (too many quality changes).
An error with the error severity INFO is not counted towards the error metrics and alerts.

Examples for each platform

// Error transformer that marks first error with severity INFO
class ErrorTransformer : ErrorTransformerCallback {
    override fun transform(
        error: AnalyticsError,
        context: ErrorContext,
    ): AnalyticsError {
        return try {
            if (retryCounter < 1) {
                AnalyticsError(
                    code = error.code,
                    message = error.message,
                    severity = ErrorSeverity.INFO,
                )
            } else {
                error
            }
        } finally {
            retryCounter++
        }
    }

    companion object {
        var retryCounter = 0
    }
}


// Setting the callback in the AnalyticsConfig
val analyticsConfig = AnalyticsConfig(
  licenseKey = "<licenseKey>",
  errorTransformerCallback = ErrorTransformer()::transform
)
import CoreCollector
class ErrorTransformer {
    private var retryCounter: Int = 0

    func transform(
        error: AnalyticsError,
        context: ErrorContext
    ) -> AnalyticsError {
        retryCounter += 1
        if (retryCounter <= 1) {
            return AnalyticsError(
                code: error.code,
                message: error.message,
                severity: ErrorSeverity.info,
            )
        } else {
            return error
        }
    }
}

// Setting the callback in the AnalyticsConfig
let analyticsConfig = AnalyticsConfig(
  licenseKey: "<licenseKey>", 
	errorTransformerCallback: ErrorTransformer().transform
)
let retryCounter = 0;

var analyticsConfig = {
  key: <ANALYTICS_LICENSE_KEY>,
  config: {
    errorTransformerCallback: {
      transform: (error, context) => {
        retryCounter++;
        if (retryCounter <= 1) {
          return {...error, severity: 'INFO'};
        } else {
          return error;
        }
      },
    },
  },
};