Debugging Your Video Application
Overview
This guide explains how to effectively debug your video application. Both during development and after deployment, you and your end users may run into issues. There are a variety of ways that you can help track down bugs and issues with your application.
Debugging During Development
Since video applications can be written in a variety of applications, debugging during development will depend on which language you have written your application in.
JavaScript
Logging to the console
When you're developing your application, place the code below somewhere in your application. Doing so will produce more logging output to your console, allowing you to better trace your program and understand what is happening behind the scenes.
You can also log messages to the console by calling the OT.log() method:
(Call OT.setLogLevel(OT.DEBUG) or OT.setLogLevel(OT.LOG) before calling OT.log().)
Testing multiple client connections on one machine
You cannot subscribe to a stream you publish in the same browser page. However, you can open the page in a second tab (or browser window) and subscribe to a stream published in the other tab (or window).
Using completion handlers
For many methods that complete asynchronously, the final parameter you pass in is a completion handler function. This function is called when the method completes or fails. If it fails, the function is passed an error object as a parameter.
For example, the following code calls the Session.connect() method, passing in a completion handler:
For more information, see Handling exceptions.
Reporting an issue
You can call the OT.reportIssue() method to programmatically report when your app experiences an issue. This method provides you with an issue ID, which you can use with the Session Inspector or when discussing the issue with the Vonage API support team.
The OT.reportIssue() method takes one parameter, a completion handler function, which is called when the call to OT.reportIssue() succeeds or fails. The completion handler function has two parameters.
The first parameter is an error object that is set when the call to the reportIssue() method fails (for example, if the client is not connected to the network) or null when the call to the reportIssue() method succeeds. The second parameter is set to the reported issue ID (a unique string) when the call succeeds.
Java
Reporting an Issue
You can call the Session.reportIssue() method to programmatically report when your app experiences an issue. This method provides you with an issue ID, which you can use with the Inspector or when discussing the issue with the Vonage API support team.
You may want to send the issue ID to a server that can store it in a database for later reference.
Objective-C
Reporting an Issue
You can call the OTSession reportIssue() method to programmatically report when your app experiences an issue. This method provides you with an issue ID, which you can use with the Inspector or when discussing the issue with the Vonage API support team.
The issueId parameter is a pointer to a string that will be set the unique identifier for the reported issue. If the call to the method fails (for example, because of no network connection), this value is set to nil.
You may want to send the issue ID to a server that can store it in a database for later reference.
React Native
Listening for exception events
To detect all exception events, add an event handlers for otrnError and error events:
Reporting an issue
You can call the reportIssue() method of the OTSession object to programmatically report when your app experiences an issue. This method returns Promise that resolves with a an issue ID (string), which you can use with the Inspector tool or when the Vonage API support team.
Swift
Reporting an Issue
You can call the OTSession reportIssue(_:) method to programmatically report when your app experiences an issue. This method provides you with an issue ID, which you can use with the Inspector or when discussing the issue with the Vonage API support team.
The issueId parameter is a pointer to a string that will be set the unique identifier for the reported issue. If the call to the method fails (for example, because of no network connection), this value is set to nil.
You may want to send the issue ID to a server that can store it in a database for later reference.
Using the Playground
The Vonage Video API Playground lets you easily connect to a session in a web client. This can be useful in debugging and app that uses the Vonage Video React Native SDK (or another client SDK).
For details, see the Playground documentation.
Troubleshooting sessions with Inspector
The Session Inspector tool provides post-mortem diagnostic information about Vonage Video sessions. Enter a session ID or a reported issue ID into Inspector to view raw information at stream and user levels to help pinpoint errors, failures, and quality issues.