Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mux-embed

Package Overview
Dependencies
Maintainers
1
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mux-embed

Mux Javascript SDK and HTML5 Video element monitor

  • 5.4.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
144K
decreased by-8.86%
Maintainers
1
Weekly downloads
 
Created

What is mux-embed?

The mux-embed npm package is used to integrate Mux Data into video players for monitoring and analytics. It allows developers to track video performance, quality of experience, and viewer engagement by embedding Mux's tracking capabilities into their video players.

What are mux-embed's main functionalities?

Basic Integration

This code demonstrates how to initialize the mux-embed package with basic configuration options. It sets up the environment key, player name, video ID, title, series, duration, and stream type.

const mux = require('mux-embed');
mux.init({
  debug: true,
  data: {
    env_key: 'YOUR_ENV_KEY',
    player_name: 'My Video Player',
    player_init_time: Date.now(),
    video_id: 'video-id-12345',
    video_title: 'My Video Title',
    video_series: 'My Video Series',
    video_duration: 120000,
    video_stream_type: 'on-demand'
  }
});

Tracking Player Events

This code shows how to monitor a video element for player events using mux-embed. It attaches the Mux monitoring to a video element and provides necessary data for tracking.

const videoElement = document.getElementById('my-video');
mux.monitor(videoElement, {
  debug: true,
  data: {
    env_key: 'YOUR_ENV_KEY',
    player_name: 'My Video Player',
    video_id: 'video-id-12345',
    video_title: 'My Video Title'
  }
});

Custom Events

This code demonstrates how to emit custom events using mux-embed. It sends a custom event with specific data related to the video being tracked.

mux.emit('custom_event', {
  video_id: 'video-id-12345',
  event_name: 'custom_event_name',
  event_data: {
    key1: 'value1',
    key2: 'value2'
  }
});

Other packages similar to mux-embed

FAQs

Package last updated on 26 Nov 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc