npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

volume-player-sdk

v3.2.1

Published

## Installation

Downloads

161

Readme

volume-player-sdk

Installation

npm install volume-player-sdk

Else with Yarn

yarn add volume-player-sdk

Usage

import { playPlaylist } from 'volume-player-sdk';

playPlaylist({
  slug: 'foobar'
});

Functions Available

Media Controls

import {
  PLAYLIST_TYPE_HD,
  PLAYLIST_TYPE_4K,
  PLAYLIST_TYPE_UHD,
  getVolumeLevel,
  isMuted,
  mute,
  playPlaylist,
  print,
  reboot,
  reload,
  resetVolume,
  resizeVideo,
  send,
  setDrawerButtonSettings
  setSetting,
  sizeDefault,
  skipTrack,
  stopPlaylist,
  sync,
  unmute,
  volumeDown,
  volumeSet,
  volumeUp,
} from 'volume-player-sdk';

playPlaylist({
  slug: 'foobar'
});

// To play the HD version of the playlist
playPlaylist({
  slug: 'foobar',
  type: PLAYLIST_TYPE_HD,
});

print('https://file/to/print.pdf');

stopPlaylist();

resizeVideo({
    width: 100,                 // width percent
    height: 100,                // height percent
    anchorHorizontal: 'right',  // horizontal anchor ('left' and 'centre' are the other options)
    anchorVertical: 'bottom',   // verticle anchor ('top' and 'centre' are the other options)
    paddingTop: 0,              // padding for the top
    paddingBottom: 0,           // padding for the bottom
    paddingLeft: 0,             // padding for the left
    paddingRight: 0,            // padding for the right
});

skipTrack();

setDrawerButtonSettings(x, y, width, height);

setSetting({
  key: "layer_extra",
  value: JSON.stringify({"foo": "bar"}),
});

sync({
  my: "syncing",
  data: ["object"]
});

sizeDefault();,

send({ bin: "baz" });

reboot(); // it reboots the device

reload(); // reload the layer

volumeUp({ step: 2 }); // turn volume up two levels on the player (Not CEC) - step is optional, defaults to 1
volumeDown({ step: 2 }); // turn volume down two levels on the player (Not CEC) - step is optional, defaults to 1

volumeSet({
  level: 5
});

const volumeLevel = getVolumeLevel(); 

resetVolume();


const isTheSoundOn = !isMuted();


mute(); // mutes the device (Not CEC)
unmute(); // unmutes the device (Not CEC)

CEC Commands

CEC Commands need to be queued else there is the risk of commands being ommitted if they are sent too quickly.

import { CEC: { start, CEC_DESTINATION_TV, volumeUp } } from 'volume-player-sdk';

start();
volumeUp(CEC_DESTINATION_TV);
Other CEC functions
import {
  CEC: {
    CEC_DESTINATION_TV,
    CEC_DESTINATION_SOUND_BAR,
    start,
    stop,
    volumeUp,
    volumeDown,
    volumeMute,
    getVolumeLevel,
    reset,
    isMuted,
    mute,
    unmute,
    standby,
    switchAudioToTv,
    switchAudioToSoundbar,    
  }
} from 'volume-player-sdk';

start();

volumeUp({ destination: CEC_DESTINATION_SOUND_BAR, step: 3 });
volumeDown({ destination: CEC_DESTINATION_SOUND_BAR, step: 3 });

reset({
  destination: CEC_DESTINATION_SOUND_BAR,
  level: 5,
  maxLevel: 10,
});

volumeMute({ destination: CEC_DESTINATION_SOUND_BAR });
volumeUnMute({ destination: CEC_DESTINATION_SOUND_BAR });

isMuted({
  destination: CEC_DESTINATION_SOUND_BAR,
  callback: (booleanValue) => console.log(booleanValue),
});

getVolumeLevel({
  destination: CEC_DESTINATION_SOUND_BAR,
  callback: (integer) => console.log(integer),
});

standby({ destination: CEC_DESTINATION_SOUND_BAR });

stop();

switchAudioToTv()

switchAudioToSoundbar()

Device Events

Volume players sends events to the layer by calling a function called deviceEvent, if declared in thewindow object:

type CustomEvent = DeviceEvent<'foo', { a: number }>

window.deviceEvent = (data: DeviceEventData | CustomEvent) => {
  const { actionType, actionDetails } = data
  if (actionType === 'startVideo') {
    // actionDetails here is type VideoDetails
    actionDetails.length
  }
  if (actionType === 'foo') {
    // a property here is type number, as declared before
    actionDetails.a
  }
}