1.1337.4 • Published 4 months ago

@glomex/integration-web-component v1.1337.4

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

@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 integration = document.createElement(ComponentName.INTEGRATION);
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(ComponentName.INTEGRATION);
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);
  });
};
1.1337.4

4 months ago

1.1337.3

4 months ago

1.1337.1

4 months ago

1.1337.0

4 months ago

1.1336.1

5 months ago

1.1336.0

5 months ago

1.1335.0

5 months ago

1.1334.0

5 months ago

1.1333.1

5 months ago

1.1333.0

5 months ago

1.1332.0

5 months ago

1.1331.2

5 months ago

1.1331.1

5 months ago

1.1331.0

5 months ago

1.1330.0

5 months ago

1.1329.0

5 months ago

1.1328.0

5 months ago

1.1327.3

5 months ago

1.1327.2

5 months ago

1.1327.1

5 months ago

1.1327.0

5 months ago

1.1326.1

5 months ago

1.1326.0

5 months ago

1.1325.1

5 months ago

1.1325.0

5 months ago

1.1324.0

5 months ago

1.1323.0

5 months ago

1.1322.0

5 months ago

1.1321.1

5 months ago

1.1321.0

5 months ago

1.1320.1

5 months ago

1.1320.0

5 months ago

1.1319.1

5 months ago

1.1319.0

5 months ago

1.1318.0

5 months ago

1.1317.0

5 months ago

1.1316.1

5 months ago

1.1316.0

5 months ago

1.1315.2

5 months ago

1.1315.1

5 months ago

1.1315.0

5 months ago

1.1314.5

5 months ago

1.1314.4

6 months ago

1.1313.0

6 months ago

1.1312.4

6 months ago

1.1312.2

6 months ago

1.1312.1

6 months ago

1.1311.1

6 months ago

1.1310.1

6 months ago

1.1310.0

6 months ago

1.1308.7

6 months ago

1.1308.6

6 months ago

1.1308.5

6 months ago

1.1308.4

6 months ago

1.1308.3

6 months ago

1.1308.2

6 months ago

1.1308.1

6 months ago

1.1308.0

6 months ago

1.1307.0

6 months ago

1.1306.0

6 months ago

1.1305.0

6 months ago

1.1304.0

6 months ago

1.1302.1

6 months ago

1.1302.0

6 months ago

1.1301.6

6 months ago

1.1301.5

6 months ago

1.1301.4

6 months ago

1.1301.3

7 months ago

1.1301.2

7 months ago

1.1301.1

7 months ago

1.1301.0

7 months ago

1.1300.0

7 months ago

1.1299.1

7 months ago

1.1299.0

7 months ago

1.1298.4

7 months ago

1.1298.3

7 months ago

1.1298.2

7 months ago

1.1298.1

7 months ago

1.1298.0

7 months ago

1.1297.1

7 months ago