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

shaka-player

Package Overview
Dependencies
Maintainers
3
Versions
348
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shaka-player

DASH/EME video player library

  • 4.8.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
249K
increased by10.47%
Maintainers
3
Weekly downloads
 
Created

What is shaka-player?

Shaka Player is an open-source JavaScript library for adaptive media streaming. It supports DASH and HLS formats and provides a wide range of features for media playback, including DRM support, offline storage, and live streaming.

What are shaka-player's main functionalities?

Basic Playback

This code demonstrates how to set up basic video playback using Shaka Player. It initializes the player with a video element and loads a DASH manifest.

const video = document.getElementById('video');
const player = new shaka.Player(video);

player.load('https://example.com/manifest.mpd').then(function() {
  console.log('The video has now been loaded!');
}).catch(function(error) {
  console.error('Error loading video', error);
});

DRM Support

This code demonstrates how to configure Shaka Player to support DRM (Digital Rights Management). It sets up license servers for Widevine and PlayReady and loads a DASH manifest.

const video = document.getElementById('video');
const player = new shaka.Player(video);

player.configure({
  drm: {
    servers: {
      'com.widevine.alpha': 'https://example.com/widevine_license',
      'com.microsoft.playready': 'https://example.com/playready_license'
    }
  }
});

player.load('https://example.com/manifest.mpd').then(function() {
  console.log('The video with DRM has now been loaded!');
}).catch(function(error) {
  console.error('Error loading video with DRM', error);
});

Offline Storage

This code demonstrates how to use Shaka Player's offline storage feature. It initializes the storage module and stores a DASH manifest for offline playback.

const video = document.getElementById('video');
const player = new shaka.Player(video);
const storage = new shaka.offline.Storage(player);

storage.store('https://example.com/manifest.mpd').then(function(content) {
  console.log('The content has been stored offline!', content);
}).catch(function(error) {
  console.error('Error storing content offline', error);
});

Live Streaming

This code demonstrates how to set up live streaming using Shaka Player. It initializes the player with a video element and loads a live DASH manifest.

const video = document.getElementById('video');
const player = new shaka.Player(video);

player.load('https://example.com/live.mpd').then(function() {
  console.log('The live stream has now been loaded!');
}).catch(function(error) {
  console.error('Error loading live stream', error);
});

Other packages similar to shaka-player

FAQs

Package last updated on 14 May 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