UNPKG

@slashedcloud/player

Version:

A media player application utilizing Shaka Player for adaptive video streaming, capable of playing HLS, MPD and plain HTTP video streams.

38 lines (37 loc) 1.2 kB
import { default as Player, PlayerEvent } from '../../Player'; import { default as Plugin } from '../Base'; declare global { interface Window { gtag: any; } } export type AnalyticsProvider = 'google'; export interface AnalyticsPluginOption { provider: AnalyticsProvider; params: Record<string, string | number>; events: PlayerEvent[]; } /** * Represents the Analytics feature of the player. */ export default class AnalyticsPlugin extends Plugin { #private; readonly name = "AnalyticsPlugin"; params: Record<string, Record<string, string | number>>; options: AnalyticsPluginOption[]; /** * Creates an instance of AnalyticsFeature. * @param {Player} player - The player instance. */ constructor(player: Player, options: AnalyticsPluginOption[]); /** * Sets up the AnalyticsFeature. */ setup(): Promise<void>; /** * Sends an event to the analytics provider. * @param {string} event - The name of the event. * @param Record<string, string | number> options - The options for the provider. */ sendEvent(provider: string, event: string, args: Record<string, string | number>): Promise<void>; }