1.1.2. Included samples

The Proximie SDK includes a set of sample applications that demonstrate how to integrate the Proximie SDK into your application, and use its various features. They are also a useful way to verify that your runtime or build environment is set up correctly; see Preparing your environment for details on how to set up your build environment.

After extracting the Proximie SDK archive, the included samples can be found in the samples directory. Pre-built binaries for the samples are also available in the samples/bin directory, so you can run them without building if you just want to test your runtime environment. See the Included sample applications section below for details on how to run the samples.

The samples include a CMake project that can be built using any standard CMake build toolset. Bear in mind that the included CMakeLists.txt files expect the directory structure of the SDK archive; i.e. they use a relative path between the samples directory and the lib and include directories. You can specify the location of the SDK installation by setting the PX_SDK_INCLUDE_DIR and PX_SDK_LIB_DIR variables in the CMake configuration.

1.1.2.1. Building methods

Visual Studio Code

Our recommendation would be to open the samples directory in Visual Studio Code, and install the C++ extension pack; this includes the CMake Tools extension, and will allow you to simply click the “Build” button in the VS Code interface to build the samples.

Command Line

To build from the command line, simply:

  1. Create a build directory within the samples directory

    cd samples
    mkdir build
    cd build
    
  2. Run CMake to configure and run the build

    cmake ..
    make
    

The created executables will be in the samples/bin directory.

1.1.2.2. Included sample applications

Hello SDK

The hello-sdk application is a minimal example demonstrating how to integrate and use the Proximie SDK for basic video preview functionality. It is intended as a starting point for new projects and for testing SDK installation and linking.

Features:

  • Prints the Proximie SDK version to the console.

  • Accepts a --videosrc command-line option to select the video source (e.g., test for a test pattern, screen for screen capture, or a V4L2 device path).

  • Creates a video input and displays it in a preview window for a short period.

  • Writes a DOT file representing the video pipeline graph.

  • Exits automatically after a demonstration period.

Usage:

./hello-sdk --videosrc=test

Replace test with another source as needed (e.g., /dev/video0 for a webcam).

Source: samples/src/hello-sdk/hello.cpp

This app is useful for verifying your SDK build and environment, and as a template for more advanced applications.

Authentication

The auth application demonstrates how to perform authentication with the Proximie SDK using various supported methods. It does not perform any video or session operations, focusing solely on authentication logic.

Features:

  • Uses the example Authentication class to handle authentication.

  • Accepts multiple authentication options via command-line arguments (client ID, client secret, username, password, refresh token, domain).

  • Attempts each authentication mode in turn until one succeeds.

  • Prints authentication status and errors to the console.

Usage:

./auth --client-id=YOUR_ID --client-secret=YOUR_SECRET --username=YOUR_USER --password=YOUR_PASS --domain=YOUR_DOMAIN

You can supply different combinations of authentication options. The app will try each mode until successful.

Source: samples/src/auth/main.cpp

This app is useful for verifying authentication credentials and SDK connectivity, and as a reference for integrating authentication into your own applications.

Sessions

The sessions application demonstrates how to authenticate with the Proximie SDK and fetch or create a session for the authenticated user. It is focused on REST API usage and session management, without any video streaming or GStreamer dependencies.

Features:

  • Authenticates using the example Authentication class.

  • Retrieves an active session for the user, or creates a new one if none exist.

  • Demonstrates use of the PxRestApi::ProximieServices class for session management.

  • Accepts various authentication and session options via command-line arguments (such as domain and organisation).

Usage:

./sessions --client-id=YOUR_ID --client-secret=YOUR_SECRET --username=YOUR_USER --password=YOUR_PASS --domain=YOUR_DOMAIN --organisation=ORG_ID

You can supply different authentication options; the app will try each mode until successful. If no active session is found, a new session will be created in the specified organisation.

Source: samples/src/sessions/main.cpp

This app is useful for testing authentication and REST API access, and as a reference for integrating session management in your own applications.

Complete

This sample brings together many of the available functions in the SDK into one place. As such, it can be harder to follow and break down into individual components.

Features used include:
  • Logging

  • Adaptive streaming

  • Preview

  • Starting feeds

  • Writing DOT files

  • recording

  • Authentication

  • Sessions

  • Getting and creating media server session

  • Feed notifications

  • Rotate and crop

  • Audio