Learn how to collect device information, status and error reports, and logs with Wowza GoCoder™ SDK for Android.
Before you begin
Before adding the functionality below to your app, make sure you've set up the Wowza GoCoder SDK for your project:
- Request a free license and download the latest version of the SDK.
- Configure your Android Studio project to use the SDK.
See Download and install GoCoder SDK for Android for detailed instructions.
Video tutorial: Collect device and SDK information
Watch this video to see how to collect the device and SDK information for your setup.
Use the SDK_VERSION and PLATFORM_INFO APIs in the WowzaGoCoder class, respectively, to get information about the Wowza GoCoder SDK version and the device running the app.
// Get the SDK version information WOWZLog.info(TAG, "SDK Version Information: " + WowzaGoCoder.SDK_VERSION); // Get the device and platform information WOWZLog.info(TAG, "Platform and Device Information: " + WowzaGoCoder.PLATFORM_INFO);
Collect status and error reports
Many of the Wowza GoCoder SDK APIs use instances of the WOWZBroadcastStatus class and the WOWZPlayerStatus class to return the status of components and processes.
Collect status and errors for broadcast
The WOWZBroadcastStatus class contains two properties:
- State indicates that a component, such as a broadcast stream, is running or stopped.
- Error indicates that an error occurred. The getLastError() method in the WOWZBroadcastStatus class returns an instance of the WOWZError class.
The following example shows how to check the broadcast status for an error:
// Get the SDK status and check for an error if (mGoCoder.getStatus == BroadcastState.IDLE && mGoCoder.getStatus.getLastError() != null) { WOWZLog.error(TAG, "An SDK error occurred: " + mGoCoder.getStatus.getLastError().getErrorDescription()); }
Collect status and errors for playback
The WOWZPlayerStatus class contains two properties:
- State indicates that a component, such as a playback stream, is idle, connecting, buffering, playing, or stopping.
- Error indicates that an error occurred. The getLastError() method in the WOWZPlayerStatus class returns an instance of the WOWZError class.
The following example shows how to check the player status for an error:
// Get the SDK status and check for an error if (mGoCoder.getStatus == PlayerState.IDLE && mGoCoder.getStatus.getLastError() != null) { WOWZLog.error(TAG, "An SDK error occurred: " + mGoCoder.getStatus.getLastError().getErrorDescription()); }
Collect logs
Use the WOWZLog class to send log messages at various levels. In its default configuration, WOWZLog is a wrapper class for the Android SDK Log utility class. You can also use the WOWZLogger interface to integrate the Wowza GoCoder SDK with other logging facilities.
The following example shows how to extend the WOWZLogger interface to wrap the SysLogger class:
// A custom logger class for the GoCoder SDK public class MyLogger extends WZLogger { public MyLogger() { } @Override public void info(String tag, String message) { SysLogger.i(tag, message); } @Override public void debug(String tag, String message) { SysLogger.d(tag, message); } @Override public void warn(String tag, String message) { SysLogger.w(tag, message); } @Override public void error(String tag, String message) { SysLogger.e(tag, message); } @Override public void error(String tag, String message, Throwable throwable) { SysLogger.e(tag, message, throwable); } @Override public void error(String tag, Throwable throwable) { SysLogger.e(tag, throwable); } } // Create an instance of the custom logger class MyLogger customLogger = new MyLogger(); // Register the instance with the SDK logger WOWZLog.registerLogger(customLogger);