as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support

IPlayerClientFactory

Component that provides a Kepler player client instance.

Methods

getOrMakeClient()

getOrMakeClient(serviceComponentId): IPlayerClient

Get or make an instance of Kepler player client.

Parameters

serviceComponentId

string

is componentID of the service component which would launch by App to host the playback session in service. example : serviceComponentID: "com.x.y.z.headlessservice"

Returns

IPlayerClient

A Kepler player client instance.

Example

// Sample usage

import {PlayerClientFactory, IPlayerClient} from '@amazon-devices/kepler-player-client';
import {PackageInfo, PackageManager} from '@amazon-devices/package-manager-lib';

const parseClientPackageManifest = async (): Promise<string> => {
  try {
    const selfPackageInfo: PackageInfo =
      await PackageManager.getSelfPackageInfo();
    for (const component of selfPackageInfo.components) {
      if (component.type === 'service') {
        return component.id;
      }
    }
    return '';
  } catch (error) {
    console.warn(
      `Interactive: Unable to retrieve info from Package manager, ${error.message}`,
    );
    return '';
  }
};

const playerClientRef = useRef<IPlayerClient | null>(null);
const playerClientFactory = new PlayerClientFactory();
let serviceComponentId: string | undefined =
  await this.parseClientPackageManifest();

if (playerClientRef.current == null) {
  playerClientRef.current =
    playerClientFactory.getOrMakeClient(serviceComponentId);
}

Last updated: Oct 02, 2025