Debugging the integration process

This document is for PolyNetSDK version 3 for Android.

This section describes the steps required to verify that the PolyNet SDK was correctly integrated with the application.

Debugging the application requires the device under test to be connected to Android Studio, and have access to the Android console log. Access to the logging utility can be acomplished from Android Studio or externally from the adb logcat command.

The logs will appear in logcat tagged with D/com.system73.polynet.android.sdk.PolyNet@42080d9 where @42080d9 is a hex string representing the PolyNet instance. For example:

07-24 10:41:51.896 3505-3541/com.system73.android.polynet.demo D/com.system73.polynet.android.sdk.PolyNet@42080d9: Connected successfully to the Backend, with ID = dc825. Will fetch from CDN.

Enabling debug messages

In order to print debug messages to the Android console log you need to instruct the PolyNet SDK instance to enable logging. To do so, call the method polyNet.setDebugMode(true) before calling the polyNet.connect() method as follows:

PolyNet polyNet = new PolyNet(configuration);
polyNet.setListener(polyNetListener);
polyNet.setDebugMode(true);

Calling polyNet.setDebugMode(false) a second time will disable log messages.

Debugging the PolyNet configuration

As explained in the PolyNet SDK Configuration section, the build() method will return a PolyNetConfiguration instance, or throw an IllegalArgumentException if any parameter is invalid or missing.

Please pay close attention to any IllegalArgumentException shown in the console at this point.

Debugging the connection to PolyNet

If everything is correct, you should see one the following messages in the log:

You can look for the node ID, parent ID in the System73 Dashboard, to verify that the nodes are connected.

If the connection to the Backend can not be opened, search the console log for an exception containing the message: Problem with network access.

The trace will contain an embedded exception detailing the network problem that caused it. You should verify that networking is available, and that the PolyNet Backend URL that you provided is correct.

If the connection to the Backend was opened, but it was rejected, search the console log for an exception containing the message: Connection to the Backend was not accepted for channel ID = (...). Please, check that the channel ID is correct.

You should verify that the channel ID that you provided is correct.

Debugging PolyNet content requests

It is vital to verify that the video player is requesting content from the PolyNet, and not directly from the Internet.

The following messages must be in the console's log to ensure the proper operation of the PolyNet:

Content request URL = ...

If none is present in the log, it means that the player is not using the PolyNet to download content. Please verify that you initialized the video player with the correct manifest URL, passing the URL from the method polyNet.getLocalManifestUrl().

Debugging P2P

To verify that peers are able to connect to each other, look for the following messages in the console's log, that show connections and disconnections from peers:

Connected to P2P parent with ID = ...
Disconnected from P2P parent with ID = ...
Connected to P2P child with ID = ...
Disconnected from P2P child with ID = ...

You can see peers come and go by inspecting the parent ID and child ID in the System73 Dashboard.

Debugging reconnections

If the SDK needs to reconnect to the Backend, search the console log for an exception containing the message: Connection to the Backend was unexpectedly closed.

If the SDK is commanded to connect to a different parent by the Backend, search the console log for one of the following messages:

You can look for the node ID, parent ID in the System73 Dashboard, to verify that the nodes are connected.

Example of the debugging process

The following is an example of a debugging session where 2 devices are connected, and the operation is completed successfully:

  1. You will need an exclusive channel for debugging, which is not used by anyone else. Ensure no other device is connected to the channel. You can verify that in the System73 Dashboard.

  2. Connect the first device to the channel. The device should be playing video. Check that its node ID shows up in the System73 Dashboard, connected to the CDN. Look for the following messages in the console's log:

    Connected successfully to the Backend, with ID = (...). Will fetch from CDN.
    
    Content request URL = ...
    
  3. Connect a second device. The device should be playing video within a few seconds. It should become a child node of the first device. Check that its node ID shows up in the System73 Dashboard, and that it is connected to the first device. Look for the following messages in the console's log:

    In the parent's log:

    Connected to P2P child with ID = ...
    

    In the child's log:

    Connected successfully to the Backend, with ID = (...). Will fetch from P2P (parent ID = ...).
    
    Connected to P2P parent with ID = ...
    
    Content request URL = ...