New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

ncplayer

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ncplayer

A video player with support for preview on track hover.

Source
npmnpm
Version
0.0.7
Version published
Weekly downloads
134
482.61%
Maintainers
1
Weekly downloads
 
Created
Source

ncplayer

Usage

import { NCPlayer, sig } from "ncplayer";

const source = sig("./video.mp4");
const previewSource = sig("./preview.mp4");
const poster = sig("./poster.jpg");

// each prop can be either a raw value or a signal
const player = NCPlayer({
  source: source,
  preview: previewSource,
  poster: poster,
  preload: "metadata",
  width: 640,
  height: 360,
});

document.body.appendChild(player);

function changeSource() {
  source.dispatch("./video2.mp4");
  previewSource.dispatch("./preview2.mp4");
  poster.dispatch("./poster2.jpg");
}

UI Elements size

The size of all UI elements of the NCPlayer can be controlled by setting the CSS font-size of the root element (.ncplayer). Font size however does not affect the width or height of the player itself. To control the dimensions of the player doing so via either the width and height props or CSS rules on the inner <video> tag is recommended (ex. .ncplayer video.main-player { width: 16em; }.)

Properties

All properties, except for dismounter, can be provided to the NCPlayer as either a value of the supported type, or a signal containing a value of that same type. (ex. width can be either a number or a Signal<number>)

Property NameTypeDescriptionDefault Value
sourcestringURL(s) of the video to play. If provided multiple sources, the player will allow the user to select the source.undefined
previewstringURL of the video to use as the preview. Preview will be displayed above the progress bar as the user hovers over it.undefined
subtitlesArray<SubtitleTrack>Array of subtitle tracks to allow user to select. See SubtitleTrack definition here.[]
widthnumberWidth of the player when not in the fullscreen mode.undefined
heightnumberHeight of the player when not in the fullscreen mode.undefined
previewWidthnumberWidth of the preview video.320
previewHeightnumberHeight of the preview video.undefined
previewUpdateThrottlenumberDetermines how often the preview video timestamp should be updated as the user hovers over the progress bar.250 (ms)
controlsTimeoutnumberTime in milliseconds after which the controls should be hidden.1000 (ms)
swipeControlRangenumberMaximum time range (in ms) it's possible to seek forward or backward by swiping on a mobile device.60_000 (ms)
persistentVolumebooleanWhether the player volume should persist between reloads.false
autoplaybooleanWhether the video should start playing as soon as it is ready. (same as the native <video> property)false
mutedbooleanWhether the video should be muted. (same as the native <video> property)false
posterstringURL of the image to use as the poster. (same as the native <video> property)undefined
preloadstringWhether the video should be preloaded. Possible values are none, metadata and auto. (same as the native <video> property)undefined
loopbooleanWhether the video should loop. (same as the native <video> property)false
stylesfalse | stringWhen set to false, no styles will be added to the DOM, resulting in the unstyled player. (you will need to add styles yourself). When given a string, that string will be inserted into the DOM as a style tag instead of the default styles.undefined
keySeekDurationnumberThe duration in seconds that the player should seek when the user presses the left or right arrow keys.5
globalKeyListenerbooleanBy default player will listen to all key events that don't have an interactable target. If set to false only events with a target within the player will be listened to.true
dismounterDismounterAn interface that should expose a ondismount method that registers a listener. NCPlayer will register teardown callbacks to this interface. See Dismounter definition here.undefined

SubtitleTrack

type SubtitleTrack = {
  id: string;
  src: string;
  srclang: string;
  label: string;
  default?: boolean;
};

Dismounter

type Dismounter = {
  ondismount(fn: Function): void;
};

Keywords

player

FAQs

Package last updated on 30 Aug 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