Skip to content

The Anbox Streaming SDK empowers developers to create personalized streaming clients that interface with Anbox Cloud.

License

Notifications You must be signed in to change notification settings

canonical/anbox-streaming-sdk

Repository files navigation

Anbox Streaming SDK

Description

The Anbox Streaming SDK empowers developers to create personalized streaming clients that interface with Anbox Cloud.

Usage

The JS SDK library manages all streaming facets, from the intricate WebRTC protocol to the seamless integration of controls, gamepads, speakers, and screen resolutions. Additionally, it incorporates an Android library that provides user-friendly native components for Android application integration.

The Android library offers user-friendly native components, including AnboxWebView, an extension of the AOSP WebView. This library enhances text input handling for hybrid applications loading the Anbox Streaming JavaScript SDK within an embedded WebView for video streaming.

Please navigate to each library folder for instructions on compiling the Javascript or Android libraries and integrating it into your project.

Examples

Refer to the following examples to explore advanced usage scenarios and best practices:

Testing

The JS SDK library comes with two test suites: one for unit tests and another for end-to-end tests. Unit tests use Jest, and end-to-end tests use Playwright.

  • Unit tests are located in js/tests/unit.
  • End-to-end tests are located in js/tests/e2e.

Both these folders contain a run-tests.sh script, which runs the tests inside a Docker container. Check how to install Docker here.

If you want to run end-to-end tests, you need an Anbox Cloud deployment. The easiest way to set up one is by using the Anbox Cloud Appliance.

Once the appliance is ready, follow these steps to run the end-to-end tests:

  • In the js/tests/e2e folder, create a .env.local file.
  • Add the following environment variables in the .env.local file:
    • ASG_API_TOKEN=my-asg-api-token Token to access the stream gateway API. See reference here.
    • AMS_API_CERTIFICATE=./path-to-ams-cert.crt A certificate that is trusted by AMS. See reference here.
    • AMS_API_CERTIFICATE_KEY=./path-to-ams-cert.key The key for the certificate above.
    • AMS_API_URL=https://my-ams-url:8444 URL (including port) of the AMS back-end.
    • ASG_API_URL=https://my-asg-url:9031 URL (including port) of the ASG back-end.
  • Run the run-tests.sh script in the js/tests/e2e folder.

When you run tests with the run-tests.sh script, coverage data will be generated in the following folders:

  • js/tests/unit/coverage for unit tests.
  • js/tests/e2e/coverage for end-to-end tests.

To combine the coverage of the unit tests with that of the end-to-end tests, and generate a report using nyc, you can run the test-report-coverage script:

  • First, execute the run-tests.sh scripts in both the js/tests/unit and the js/tests/e2e folders. This will run the tests, and produce coverage data for both suites.
  • In the js/tests/e2e folder, execute npm run test-report-coverage. The report will be stored in the js/tests/e2e/coverage/combined-report folder.

Contributing

We welcome contributions from the community to enhance the Anbox Streaming SDK. To contribute, please follow these guidelines:

  1. Fork the repository and create your fork from the main branch.
  2. Ensure that your code adheres to the established coding standards and practices.
  3. Test your changes to ensure that automated tests pass with the modifications you made.
  4. Provide relevant documentation updates if needed.
  5. Sign the contributor agreement, submit a pull request, outlining the purpose and scope of your changes.

Our team will review your contribution and collaborate with you to integrate it into the SDK.

Bug report

To report issues, please submit a bug to Anbox Cloud project on launchpad.

License

The Anbox Streaming SDK is licensed under the Apache License 2.0. For more details, refer to the LICENSE file for details.

About

The Anbox Streaming SDK empowers developers to create personalized streaming clients that interface with Anbox Cloud.

Resources

License

Security policy

Stars

Watchers

Forks