Skip to main content
Skip table of contents

Broadpeak SmartLib support

To test this feature and view the example code, please see the Android SDK 5 Example Code Quick Start guide.

The smartbeam example code shows how an application can playback streams in conjunction with Broadpeak SmartBeam set-top box. This example depends on the SmartLib library, which detects and controls SmartBeam set-top boxes connected to the same LAN as the Android device.

The SmartLib library itself is not included in this example, but the build.gradle script of this project can fetch it as part of the build process. However, before the build, you will need to modify the build.gradle script with your Broadpeak credentials.

To run OTVVideoView with a smartbeam gateway box, you will need to use an external library that creates a SmartLib client for the current streaming session and attaches it to the player. The following values are required to initiate the SmartLib client:

  • analyticsAddress: The URL for analytics

  • nanCDNHost: The address inside the device's home network where the nanoCDN is embedded, or discover if the discovery is enabled on the nanoCDN.

  • broadpeakDomainNames: The domain name list used to identify URL(s) using the Broadpeak product

A specific value "*" is used to declare that all the given URLs are using the broadpeak product.
An empty value "" is used to declare that no given URLs are using the Broadpeak value.
Discovery will take place if the Android device is in the same sub-network as the SmartBeam box.

Prerequisites

A SmartBeam box and the library mentioned within the example code.

Example code

The following example code is used to configure SmartLib:

JAVA
if(!sSmartLibConfig.isEmpty()) {
      try {
        JSONObject json = new JSONObject(xConfigJson);
        SmartLib.getInstance().init(xApplicationContext,
            json.getString(ANALYTICS_ADDRESS_KEY),
            json.getString(NANO_CDN_HOST_KEY),
            json.getString(BROADPEAK_DOMAIN_NAMES_KEY));

        SmartLib.getInstance().registerNanoCDNReceiver(SmartLibClient.getInstance());
      } catch (JSONException e) {
        OTVLog.w(TAG, e.getMessage());
        sSmartLibConfig = "";
      }
    }

Once the nanoCDN is registered, the SmartLib and the OTVVideoView has been created, pass the stream URI to the client as shown:

JAVA
mOTVVideoView = new OTVVideoView(this);
// If discovery takes place, the following will translate to an address on the SmartBeam box
String url = SmartLibClient.getInstance().getUrl(STREAM_URI);
mOTVVideoView.setVideoPath(url);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.