New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@livepeer/core

Package Overview
Dependencies
Maintainers
6
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@livepeer/core - npm Package Compare versions

Comparing version 3.0.0-next.1 to 3.0.0-next.2

12

dist/cjs/crypto.js

@@ -47,8 +47,2 @@ Object.defineProperty(exports, '__esModule', { value: true });

}
if (typeof window !== "undefined") {
if (window?.crypto?.subtle) {
return window.crypto.subtle;
}
throw new Error("Browser is not in a secure context (HTTPS), cannot use SubtleCrypto: https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto");
}
try {

@@ -58,2 +52,8 @@ const nodeCrypto = await import('node:crypto');

} catch (error) {
if (typeof window !== "undefined") {
if (window?.crypto?.subtle) {
return window.crypto.subtle;
}
throw new Error("Browser is not in a secure context (HTTPS), cannot use SubtleCrypto: https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto");
}
throw new Error(`Failed to import Node.js crypto module: ${error?.message ?? ""}`);

@@ -60,0 +60,0 @@ }

declare const STREAM_OPEN_ERROR_MESSAGE = "stream open failed";
declare const STREAM_OFFLINE_ERROR_MESSAGE = "stream is offline";
declare const STREAM_WAITING_FOR_DATA_ERROR_MESSAGE = "stream is waiting for data";
declare const ACCESS_CONTROL_ERROR_MESSAGE = "shutting down since this session is not allowed to view this stream";
declare const BFRAMES_ERROR_MESSAGE = "metadata indicates that webrtc playback contains bframes";
declare const NOT_ACCEPTABLE_ERROR_MESSAGE = "response indicates unacceptable playback protocol";
declare const PERMISSIONS_ERROR_MESSAGE = "user did not allow the permissions request";
declare const isStreamOfflineError: (error: Error) => boolean;

@@ -11,3 +11,4 @@ declare const isAccessControlError: (error: Error) => boolean;

declare const isNotAcceptableError: (error: Error) => boolean;
declare const isPermissionsError: (error: Error) => boolean;
export { ACCESS_CONTROL_ERROR_MESSAGE, BFRAMES_ERROR_MESSAGE, NOT_ACCEPTABLE_ERROR_MESSAGE, STREAM_OFFLINE_ERROR_MESSAGE, STREAM_OPEN_ERROR_MESSAGE, STREAM_WAITING_FOR_DATA_ERROR_MESSAGE, isAccessControlError, isBframesError, isNotAcceptableError, isStreamOfflineError };
export { ACCESS_CONTROL_ERROR_MESSAGE, BFRAMES_ERROR_MESSAGE, NOT_ACCEPTABLE_ERROR_MESSAGE, PERMISSIONS_ERROR_MESSAGE, STREAM_OFFLINE_ERROR_MESSAGE, STREAM_OPEN_ERROR_MESSAGE, isAccessControlError, isBframesError, isNotAcceptableError, isPermissionsError, isStreamOfflineError };

@@ -9,2 +9,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

const NOT_ACCEPTABLE_ERROR_MESSAGE = "response indicates unacceptable playback protocol";
const PERMISSIONS_ERROR_MESSAGE = "user did not allow the permissions request";
const isStreamOfflineError = (error)=>error.message.toLowerCase().includes(STREAM_OPEN_ERROR_MESSAGE) || error.message.toLowerCase().includes(STREAM_WAITING_FOR_DATA_ERROR_MESSAGE) || error.message.toLowerCase().includes(STREAM_OFFLINE_ERROR_MESSAGE);

@@ -14,2 +15,3 @@ const isAccessControlError = (error)=>error.message.toLowerCase().includes(ACCESS_CONTROL_ERROR_MESSAGE);

const isNotAcceptableError = (error)=>error.message.toLowerCase().includes(NOT_ACCEPTABLE_ERROR_MESSAGE);
const isPermissionsError = (error)=>error.message.toLowerCase().includes(PERMISSIONS_ERROR_MESSAGE);

@@ -19,8 +21,9 @@ exports.ACCESS_CONTROL_ERROR_MESSAGE = ACCESS_CONTROL_ERROR_MESSAGE;

exports.NOT_ACCEPTABLE_ERROR_MESSAGE = NOT_ACCEPTABLE_ERROR_MESSAGE;
exports.PERMISSIONS_ERROR_MESSAGE = PERMISSIONS_ERROR_MESSAGE;
exports.STREAM_OFFLINE_ERROR_MESSAGE = STREAM_OFFLINE_ERROR_MESSAGE;
exports.STREAM_OPEN_ERROR_MESSAGE = STREAM_OPEN_ERROR_MESSAGE;
exports.STREAM_WAITING_FOR_DATA_ERROR_MESSAGE = STREAM_WAITING_FOR_DATA_ERROR_MESSAGE;
exports.isAccessControlError = isAccessControlError;
exports.isBframesError = isBframesError;
exports.isNotAcceptableError = isNotAcceptableError;
exports.isPermissionsError = isPermissionsError;
exports.isStreamOfflineError = isStreamOfflineError;
import { StoreApi } from 'zustand/vanilla';
import { ClientStorage } from './storage.mjs';

@@ -237,2 +236,8 @@ type MimeType = keyof typeof mime;

type ClientStorage = {
getItem: <T>(key: string, defaultState?: T | null) => Promise<T | null>;
setItem: <T>(key: string, value: T | null) => Promise<void>;
removeItem: (key: string) => Promise<void>;
};
declare const DEFAULT_VOLUME_LEVEL = 1;

@@ -266,3 +271,3 @@ declare const DEFAULT_AUTOHIDE_TIME = 3000;

*/
hotkeys: boolean;
hotkeys: boolean | "broadcast";
/**

@@ -282,3 +287,3 @@ * The JWT (JSON Web Token) which is passed along to allow playback of an asset. Used for authentication and information exchange.

/**
* The default playback rate for the media. Determines the speed at which the media is played, e.g., 0.5 for half-speed, 2 for double speed.
* The default playback rate for the media. Determines the speed at which the media is played, e.g. 0.5 for half-speed, 2 for double speed.
*

@@ -365,2 +370,4 @@ * This can be overridden during playback by the user with `RateSelect`.

requestedPictureInPictureLastTime: number;
/** The last time that the element was measured */
requestedMeasureLastTime: number;
/** Internal value when a user requests an update to the progress of the media */

@@ -393,3 +400,3 @@ requestedRangeToSeekTo: number;

type PlaybackError = {
type: "offline" | "access-control" | "fallback" | "unknown";
type: "offline" | "access-control" | "fallback" | "permissions" | "unknown";
message: string;

@@ -400,2 +407,3 @@ };

media?: ElementSize;
window?: ElementSize;
};

@@ -415,5 +423,2 @@ type ElementSize = {

type PlaybackRate = number | "constant";
declare const omittedKeys: readonly ["__initialProps", "__device", "__controls", "__metadata", "__controlsFunctions"];
declare const sanitizeMediaControllerState: (state: MediaControllerState) => MediaControllerCallbackState;
type MediaControllerCallbackState = Omit<MediaControllerState, (typeof omittedKeys)[number]>;
type AriaText = {

@@ -495,2 +500,3 @@ progress: string;

requestClip: () => void;
requestMeasure: () => void;
requestSeek: (time: number) => void;

@@ -644,2 +650,2 @@ requestSeekBack: (difference?: number) => void;

export { type AccessControlParams, type AriaText, type AudioSrc, type AudioTrackSelector, type Base64Src, type ClipLength, type ClipParams, type ControlsOptions, type ControlsState, DEFAULT_AUTOHIDE_TIME, DEFAULT_VOLUME_LEVEL, type DeviceInformation, type ElementSize, type HlsSrc, type InitialProps, type MediaControllerCallbackState, type MediaControllerState, type MediaControllerStore, type MediaMetrics, type MediaSizing, type Metadata, MetricsStatus, type ObjectFit, type PlaybackError, PlaybackMonitor, type PlaybackRate, type SingleAudioTrackSelector, type SingleTrackSelector, type SingleVideoTrackSelector, type Src, type VideoQuality, type VideoSrc, type VideoTrackSelector, type WebRTCSrc, addMediaMetricsToStore, calculateVideoQualityDimensions, createControllerStore, getBoundedVolume, getMediaSourceType, sanitizeMediaControllerState };
export { type AccessControlParams, type AriaText, type AudioSrc, type AudioTrackSelector, type Base64Src, type ClipLength, type ClipParams, type ControlsOptions, type ControlsState, DEFAULT_AUTOHIDE_TIME, DEFAULT_VOLUME_LEVEL, type DeviceInformation, type ElementSize, type HlsSrc, type InitialProps, type MediaControllerState, type MediaControllerStore, type MediaMetrics, type MediaSizing, type Metadata, MetricsStatus, type ObjectFit, type PlaybackError, PlaybackMonitor, type PlaybackRate, type SingleAudioTrackSelector, type SingleTrackSelector, type SingleVideoTrackSelector, type Src, type VideoQuality, type VideoSrc, type VideoTrackSelector, type WebRTCSrc, addMediaMetricsToStore, calculateVideoQualityDimensions, createControllerStore, getBoundedVolume, getMediaSourceType };

@@ -5,6 +5,51 @@ Object.defineProperty(exports, '__esModule', { value: true });

var vanilla = require('zustand/vanilla');
var storage = require('@livepeer/core/storage');
var errors = require('@livepeer/core/errors');
var utils = require('@livepeer/core/utils');
const STREAM_OPEN_ERROR_MESSAGE = "stream open failed";
const STREAM_OFFLINE_ERROR_MESSAGE = "stream is offline";
const STREAM_WAITING_FOR_DATA_ERROR_MESSAGE = "stream is waiting for data";
const ACCESS_CONTROL_ERROR_MESSAGE = "shutting down since this session is not allowed to view this stream";
const BFRAMES_ERROR_MESSAGE = "metadata indicates that webrtc playback contains bframes";
const NOT_ACCEPTABLE_ERROR_MESSAGE = "response indicates unacceptable playback protocol";
const PERMISSIONS_ERROR_MESSAGE = "user did not allow the permissions request";
const isStreamOfflineError = (error)=>error.message.toLowerCase().includes(STREAM_OPEN_ERROR_MESSAGE) || error.message.toLowerCase().includes(STREAM_WAITING_FOR_DATA_ERROR_MESSAGE) || error.message.toLowerCase().includes(STREAM_OFFLINE_ERROR_MESSAGE);
const isAccessControlError = (error)=>error.message.toLowerCase().includes(ACCESS_CONTROL_ERROR_MESSAGE);
const isBframesError = (error)=>error.message.toLowerCase().includes(BFRAMES_ERROR_MESSAGE);
const isNotAcceptableError = (error)=>error.message.toLowerCase().includes(NOT_ACCEPTABLE_ERROR_MESSAGE);
const isPermissionsError = (error)=>error.message.toLowerCase().includes(PERMISSIONS_ERROR_MESSAGE);
const noopStorage = {
getItem: (_key)=>"",
setItem: (_key, _value)=>{
//
},
removeItem: (_key)=>{
//
}
};
function createStorage({ storage = noopStorage, key: prefix = "livepeer" }) {
return {
getItem: async (key, defaultState = null)=>{
try {
const value = await storage.getItem(`${prefix}.${key}`);
return value ? JSON.parse(value) : defaultState;
} catch (error) {
console.warn(error);
return defaultState;
}
},
setItem: async (key, value)=>{
if (value === null) {
await storage.removeItem(`${prefix}.${key}`);
} else {
try {
await storage.setItem(`${prefix}.${key}`, JSON.stringify(value));
} catch (err) {
console.error(err);
}
}
},
removeItem: async (key)=>storage.removeItem(`${prefix}.${key}`)
};
}
const LP_DOMAINS = [

@@ -625,14 +670,6 @@ "livepeer",

const DEFAULT_AUTOHIDE_TIME = 3000; // milliseconds to wait before hiding controls
const omittedKeys = [
"__initialProps",
"__device",
"__controls",
"__metadata",
"__controlsFunctions"
];
const sanitizeMediaControllerState = (state)=>utils.omit(state, ...omittedKeys);
const createControllerStore = ({ device, storage: storage$1, src, initialProps })=>{
const resolvedStorage = initialProps?.storage === null ? storage.createStorage({
storage: storage.noopStorage
}) : initialProps?.storage ?? storage$1;
const createControllerStore = ({ device, storage, src, initialProps })=>{
const resolvedStorage = initialProps?.storage === null ? createStorage({
storage: noopStorage
}) : initialProps?.storage ?? storage;
const initialPlaybackRate = initialProps?.playbackRate ?? 1;

@@ -662,2 +699,3 @@ const initialVolume = getBoundedVolume(initialProps.volume ?? DEFAULT_VOLUME_LEVEL);

lastInteraction: Date.now(),
requestedMeasureLastTime: 0,
muted: initialVolume === 0,

@@ -784,3 +822,2 @@ playbackId: parsedSource?.playbackId ?? null,

hidden: false,
// TODO check if these should be getting set when pause event is fired (this was pulled from metrics)
stalled: false,

@@ -892,2 +929,10 @@ waiting: false,

})),
requestMeasure: ()=>set(({ __controls })=>{
return {
__controls: {
...__controls,
requestedMeasureLastTime: Date.now()
}
};
}),
setSize: (size)=>set(({ __controls })=>{

@@ -899,3 +944,3 @@ return {

...__controls.size,
size
...size
}

@@ -987,3 +1032,3 @@ }

const error = rawError ? {
type: errors.isAccessControlError(rawError) ? "access-control" : errors.isBframesError(rawError) || errors.isNotAcceptableError(rawError) ? "fallback" : errors.isStreamOfflineError(rawError) ? "offline" : "unknown",
type: isAccessControlError(rawError) ? "access-control" : isBframesError(rawError) || isNotAcceptableError(rawError) ? "fallback" : isStreamOfflineError(rawError) ? "offline" : isPermissionsError(rawError) ? "permissions" : "unknown",
message: rawError?.message ?? "Error with playback."

@@ -1017,3 +1062,3 @@ } : null;

// we increment the source only on a bframes or unknown error
if (error.type === "offline" || error.type === "access-control") {
if (error.type === "offline" || error.type === "access-control" || error.type === "permissions") {
return base;

@@ -1511,2 +1556,1 @@ }

exports.getMediaSourceType = getMediaSourceType;
exports.sanitizeMediaControllerState = sanitizeMediaControllerState;
declare const version: {
readonly core: "@livepeer/core@3.0.0-next.1";
readonly react: "@livepeer/react@4.0.0-next.1";
readonly core: "@livepeer/core@3.0.0-next.2";
readonly react: "@livepeer/react@4.0.0-next.2";
};
export { version };
Object.defineProperty(exports, '__esModule', { value: true });
const core = "@livepeer/core@3.0.0-next.1";
const react = "@livepeer/react@4.0.0-next.1";
const core = "@livepeer/core@3.0.0-next.2";
const react = "@livepeer/react@4.0.0-next.2";
const version = {

@@ -6,0 +6,0 @@ core,

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "3.0.0-next.1",
"version": "3.0.0-next.2",
"repository": {

@@ -21,12 +21,2 @@ "type": "git",

"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/es/index.d.mts",
"default": "./dist/es/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
},
"./crypto": {

@@ -137,4 +127,5 @@ "import": {

"clean": "rimraf .turbo node_modules dist",
"dev": "bunchee --watch"
"dev": "bunchee --watch",
"lint": "tsc --noEmit"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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