🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@glomex/integration-web-component

Package Overview
Dependencies
Maintainers
7
Versions
479
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glomex/integration-web-component

Web component and types to integrate the glomex player

latest
npmnpm
Version
1.1581.5
Version published
Weekly downloads
511
382.08%
Maintainers
7
Weekly downloads
 
Created
Source

@glomex/integration-web-component

Introduction

@glomex/integration-web-component exposes a Web Component and types to easily integrate the glomex player. In order to use this component, you need to have a glomex account. You can get one by following the instructions in the Getting Started section.

If you use React, you can install the @glomex/integration-react package instead.

About glomex

glomex operates Germany’s largest marketplace for premium video content. Our platform connects publishers, content creators, and advertisers, enabling the seamless distribution of high-quality video content across the web.

Our ecosystem is designed to create value for all participants:

  • Publishers gain access to premium video content and monetization opportunities
  • Content Owners receive wide distribution and revenue for their video assets
  • Advertisers reach targeted audiences across a network of quality websites

Usage

Loading & integrating the player (TypeScript)

For plain JavaScript projects, you can follow this guide. You though can use the @glomex/integration-web-component helper to load the integration component and styles also in JavaScript projects.

import {
  IntegrationEvent,
  ComponentName,
  loadIntegrationComponent,
  loadIntegrationStyles
} from '@glomex/integration-web-component';

// Get the container element where the player will be placed
const container = document.getElementById('player-container-on-site');
const integrationId = 'FILL_IN_INTEGRATION_ID';
const playlistId = 'FILL_IN_PLAYLIST_ID';
// It makes sense to load integration css
// as early as possible to reduce layout shifts.
// You also can get the CSS URL with this helper:
// `import { getIntegrationCssUrl } from '@glomex/integration/load';`
loadIntegrationStyles(integrationId);
// load the integration web component
loadIntegrationComponent();
// create the fully typed integration element
const tagName = 'glomex-integration';
const integration = document.createElement(tagName);
integration.setAttribute('integration-id', integrationId);
integration.setAttribute('playlist-id', playlistId);
integration.addEventListener(IntegrationEvent.CONTENT_START, () => {
  console.log('content start', integration.content);
});
// attach the integration element
container.appendChild(integration);
// wait until the integration was upgraded to access web component methods
await window.customElements.whenDefined(tagName);
integration.play();

Implementing a public API script (TypeScript)

import {
  IntegrationEvent,
  type ConnectIntegration
} from '@glomex/integration-web-component';

// with this you get a fully typed integration
export const connectIntegration: ConnectIntegration = (integration) => {
  integration.addEventListener(IntegrationEvent.CONTENT_PLAY, () => {
    console.log('play', integration.content);
  });
};

Shared Context

Use getSharedContext() to provide global application context and provider-specific user tokens to all <glomex-integration> instances on the page.

getSharedContext() waits for the integration component to be loaded and returns the same singleton instance that the running player uses.

import { getSharedContext } from '@glomex/integration-web-component';

const sharedContext = await getSharedContext();

sharedContext.set({
  // Plain values — used as-is
  appVersion: '2.3.0',
  appName: 'my-app',
  deviceId: { id: '...', name: 'idfa' },

  // Resolver functions — called each time the player needs the value,
  // so they can return fresh data (e.g. after consent changes)
  userIds: async () => await cmp.getConsentedUserIds(),

  // Provider-specific context (tokens, subscription state, ...)
  providers: {
    'my-provider': async () => ({
      token: await myAuth.getToken(),
      subscriptionState: userState
    })
  }
});

Calling set() multiple times merges incrementally — previously set values are preserved unless overwritten:

// Initial setup
sharedContext.set({ appVersion: '2.3.0', appName: 'my-app' });

// Later — adds providers without removing appVersion/appName
sharedContext.set({
  providers: {
    'my-provider': async () => ({ token: await myAuth.getToken() })
  }
});

Keywords

glomex

FAQs

Package last updated on 08 Jul 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts