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

@livepeer/core

Package Overview
Dependencies
Maintainers
6
Versions
126
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 1.1.5 to 1.2.0

dist/src-4bd2ea42.cjs.dev.js

2

dist/declarations/src/index.d.ts

@@ -11,3 +11,3 @@ export { createAsset, createStream, getAsset, getAssetMetrics, getLivepeerProvider, getPlaybackInfo, getStream, getStreamSession, getStreamSessions, updateAsset, updateStream, watchLivepeerProvider, } from './actions';

export type { ClientStorage as Storage } from './storage';
export type { Address, Asset, CreateAssetArgs, CreateStreamArgs, GetAssetArgs, GetAssetMetricsArgs, GetPlaybackInfoArgs, GetStreamArgs, GetStreamSessionArgs, GetStreamSessionsArgs, Hash, LivepeerProvider, LivepeerProviderConfig, Metrics, MultistreamTarget, MultistreamTargetRef, NativeFile, PlaybackInfo, Stream, StreamSession, TranscodingProfile, UpdateAssetArgs, UpdateStreamArgs, ViewsMetrics, } from './types';
export type { Address, Asset, CreateAssetArgs, CreateStreamArgs, GetAssetArgs, GetAssetMetricsArgs, GetPlaybackInfoArgs, GetStreamArgs, GetStreamSessionArgs, GetStreamSessionsArgs, Hash, LivepeerProvider, LivepeerProviderConfig, Metrics, MirrorSizeArray, MultistreamTarget, MultistreamTargetRef, NativeFile, PlaybackInfo, Stream, StreamSession, TranscodingProfile, UpdateAssetArgs, UpdateStreamArgs, ViewsMetrics, } from './types';
export { b64Decode, b64Encode, b64UrlDecode, b64UrlEncode, deepMerge, omit, pick, } from './utils';
import { StoreApi } from 'zustand/vanilla';
import { Src } from './src';
import { ClientStorage } from '../storage';

@@ -32,2 +33,4 @@ export declare const DEFAULT_VOLUME_LEVEL = 0.2;

isVolumeChangeSupported: boolean;
/** The Source that was passed in to Player */
src: Src | null;
/** If autoplay was passed in to Player */

@@ -37,2 +40,4 @@ autoplay: boolean;

priority: boolean;
/** The preload option passed in to Player */
preload: 'full' | 'metadata' | 'none';
/** If the media is current playing or paused */

@@ -134,2 +139,4 @@ playing: boolean;

priority?: boolean;
src?: Src | null;
preload?: 'full' | 'metadata' | 'none';
};
import { MediaControllerStore } from '../controller';
import { MimeType } from '../mime';
type RawMetrics = {
preloadTime: number;
ttff: number;

@@ -18,6 +20,7 @@ firstPlayback: number;

player: 'livepeer-js';
protocol: MimeType | 'unknown';
pageUrl: string;
sourceUrl: string;
duration: number | null;
autoplay: boolean;
autoplay: 'autoplay' | 'preload-full' | 'preload-metadata' | 'standard';
userAgent: string;

@@ -53,2 +56,3 @@ };

export declare class MetricsStatus<TElement> {
preloadTime: number;
requestedPlayTime: number;

@@ -55,0 +59,0 @@ retryCount: number;

@@ -79,9 +79,13 @@ import { Asset, CreateStreamArgs, MultistreamTargetRef, Stream, StreamSession, TranscodingProfile, ViewsMetrics } from '../../types';

export type StudioPlaybackInfo = {
type: string;
type: 'live' | 'vod' | 'recording';
meta: {
live?: 0 | 1;
source: {
hrn: string;
type: string;
hrn: 'HLS (TS)' | 'MP4';
type: 'html5/application/vnd.apple.mpegurl' | 'html5/video/mp4';
url: string;
size?: number;
width?: number;
height?: number;
bitrate?: number;
}[];

@@ -88,0 +92,0 @@ };

@@ -1,3 +0,3 @@

export declare const core = "@livepeer/core@1.1.5";
export declare const react = "@livepeer/react@2.1.5";
export declare const reactNative = "@livepeer/react-native@1.1.5";
export declare const core = "@livepeer/core@1.2.0";
export declare const react = "@livepeer/react@2.2.0";
export declare const reactNative = "@livepeer/react-native@1.2.0";

@@ -173,4 +173,6 @@ /// <reference types="node" />

};
export type NativeFile = File & {
export type NativeFile = {
uri: string;
name: string;
exif?: string | null;
};

@@ -477,9 +479,13 @@ export type CreateAssetSourceFile = CreateAssetSourceBase & {

export type PlaybackInfo = {
type: string;
type: 'live' | 'vod' | 'recording';
meta: {
live?: boolean;
live: boolean;
source: {
hrn: string;
type: string;
hrn: 'HLS (TS)' | 'MP4';
type: 'html5/application/vnd.apple.mpegurl' | 'html5/video/mp4';
url: string;
size?: number;
width?: number;
height?: number;
bitrate?: number;
}[];

@@ -486,0 +492,0 @@ };

@@ -10,3 +10,3 @@ 'use strict';

var provider = require('./provider-838e9dd9.cjs.dev.js');
var src = require('./src-a8b8d361.cjs.dev.js');
var src = require('./src-4bd2ea42.cjs.dev.js');
var string = require('./string-0759efb1.cjs.dev.js');

@@ -13,0 +13,0 @@ var omick = require('./omick-69c95136.cjs.dev.js');

@@ -10,3 +10,3 @@ 'use strict';

var provider = require('./provider-f763db3e.cjs.prod.js');
var src = require('./src-6eb9f34b.cjs.prod.js');
var src = require('./src-eeb4b2d4.cjs.prod.js');
var string = require('./string-7bb3bb00.cjs.prod.js');

@@ -13,0 +13,0 @@ var omick = require('./omick-088c0789.cjs.prod.js');

@@ -6,3 +6,3 @@ export { HttpError } from '../errors/dist/livepeer-core-errors.esm.js';

export { d as defaultStudioConfig, a as defaultTranscodingProfiles } from './provider-3254bb2f.esm.js';
export { c as createControllerStore, g as getMediaSourceType } from './src-e4278ceb.esm.js';
export { c as createControllerStore, g as getMediaSourceType } from './src-6007c27b.esm.js';
export { b as b64Decode, a as b64Encode, c as b64UrlDecode, d as b64UrlEncode } from './string-9a973b0a.esm.js';

@@ -9,0 +9,0 @@ export { d as deepMerge, o as omit, p as pick } from './omick-f3e60faa.esm.js';

@@ -5,3 +5,3 @@ 'use strict';

var src = require('../../dist/src-a8b8d361.cjs.dev.js');
var src = require('../../dist/src-4bd2ea42.cjs.dev.js');
var fetch = require('cross-fetch');

@@ -16,3 +16,2 @@ require('zustand/middleware');

const LP_DOMAINS = ['livepeer', 'livepeercdn', 'lp-playback'];
const PLAYLIST_NAME = 'index.m3u8';
const ASSET_URL_PART_VALUE = 'hls';

@@ -28,3 +27,2 @@ const RECORDING_URL_PART_VALUE = 'recordings';

const parts = parsedUrl.pathname.split('/');
const playlistPartIndex = parts.indexOf(PLAYLIST_NAME);
const includesAssetUrl = parts.includes(ASSET_URL_PART_VALUE);

@@ -34,3 +32,3 @@ const includesRecording = parts.includes(RECORDING_URL_PART_VALUE);

// Check if the url is valid
const playbackId = (includesAssetUrl || includesRecording) && playlistPartIndex !== -1 ? parts?.[playlistPartIndex - 1] ?? null : null;
const playbackId = includesRecording || includesAssetUrl ? parts?.[(parts?.length ?? 0) - 2] ?? null : null;
const splitHost = parsedUrl.host.split('.');

@@ -156,2 +154,3 @@ const includesDomain = LP_DOMAINS.includes(splitHost?.[splitHost.length - 2] ?? '');

class MetricsStatus {
preloadTime = 0;
requestedPlayTime = 0;

@@ -165,24 +164,32 @@ retryCount = 0;

constructor(store) {
this.requestedPlayTime = store.getState().autoplay ? Date.now() : 0;
const currentState = store.getState();
if (currentState.autoplay) {
this.requestedPlayTime = Date.now();
this.preloadTime = this.requestedPlayTime - bootMs;
} else {
this.requestedPlayTime = 0;
}
this.store = store;
this.currentMetrics = {
autoplay: currentState.priority && currentState.autoplay ? 'autoplay' : currentState.preload === 'full' ? 'preload-full' : currentState.preload === 'metadata' ? 'preload-metadata' : 'standard',
duration: null,
firstPlayback: 0,
nError: 0,
nStalled: 0,
nWaiting: 0,
timeWaiting: 0,
nStalled: 0,
pageUrl: typeof window !== 'undefined' ? window?.location?.href ?? '' : '',
playbackScore: null,
player: 'livepeer-js',
playerHeight: null,
playerWidth: null,
preloadTime: 0,
protocol: currentState?.src?.mime ?? 'unknown',
sourceUrl: '',
timeStalled: 0,
timeUnpaused: 0,
nError: 0,
timeWaiting: 0,
ttff: 0,
userAgent: currentState.device.userAgent,
videoHeight: null,
videoWidth: null,
playerHeight: null,
playerWidth: null,
player: 'livepeer-js',
pageUrl: '',
sourceUrl: '',
playbackScore: null,
duration: null,
autoplay: store.getState().autoplay,
userAgent: store.getState().device.userAgent,
ttff: 0
videoWidth: null
};

@@ -192,2 +199,5 @@ store.subscribe((state, prevState) => {

this.requestedPlayTime = state._requestedPlayPauseLastTime;
if (this.preloadTime === 0) {
this.preloadTime = Date.now() - bootMs;
}
}

@@ -257,3 +267,4 @@ if (state.playing !== prevState.playing) {

timeStalled: this.timeStalled.getTotalTime(),
timeUnpaused: this.timeUnpaused.getTotalTime()
timeUnpaused: this.timeUnpaused.getTotalTime(),
preloadTime: this.preloadTime
};

@@ -291,2 +302,7 @@ const previousMetrics = this.previousMetrics;

}
// set the src from the source URL
store.setState({
src: src.getMediaSourceType(sourceUrl)
});
const metricsStatus = new MetricsStatus(store);

@@ -293,0 +309,0 @@ try {

@@ -5,3 +5,3 @@ 'use strict';

var src = require('../../dist/src-6eb9f34b.cjs.prod.js');
var src = require('../../dist/src-eeb4b2d4.cjs.prod.js');
var fetch = require('cross-fetch');

@@ -16,3 +16,2 @@ require('zustand/middleware');

const LP_DOMAINS = ['livepeer', 'livepeercdn', 'lp-playback'];
const PLAYLIST_NAME = 'index.m3u8';
const ASSET_URL_PART_VALUE = 'hls';

@@ -28,3 +27,2 @@ const RECORDING_URL_PART_VALUE = 'recordings';

const parts = parsedUrl.pathname.split('/');
const playlistPartIndex = parts.indexOf(PLAYLIST_NAME);
const includesAssetUrl = parts.includes(ASSET_URL_PART_VALUE);

@@ -34,3 +32,3 @@ const includesRecording = parts.includes(RECORDING_URL_PART_VALUE);

// Check if the url is valid
const playbackId = (includesAssetUrl || includesRecording) && playlistPartIndex !== -1 ? parts?.[playlistPartIndex - 1] ?? null : null;
const playbackId = includesRecording || includesAssetUrl ? parts?.[(parts?.length ?? 0) - 2] ?? null : null;
const splitHost = parsedUrl.host.split('.');

@@ -156,2 +154,3 @@ const includesDomain = LP_DOMAINS.includes(splitHost?.[splitHost.length - 2] ?? '');

class MetricsStatus {
preloadTime = 0;
requestedPlayTime = 0;

@@ -165,24 +164,32 @@ retryCount = 0;

constructor(store) {
this.requestedPlayTime = store.getState().autoplay ? Date.now() : 0;
const currentState = store.getState();
if (currentState.autoplay) {
this.requestedPlayTime = Date.now();
this.preloadTime = this.requestedPlayTime - bootMs;
} else {
this.requestedPlayTime = 0;
}
this.store = store;
this.currentMetrics = {
autoplay: currentState.priority && currentState.autoplay ? 'autoplay' : currentState.preload === 'full' ? 'preload-full' : currentState.preload === 'metadata' ? 'preload-metadata' : 'standard',
duration: null,
firstPlayback: 0,
nError: 0,
nStalled: 0,
nWaiting: 0,
timeWaiting: 0,
nStalled: 0,
pageUrl: typeof window !== 'undefined' ? window?.location?.href ?? '' : '',
playbackScore: null,
player: 'livepeer-js',
playerHeight: null,
playerWidth: null,
preloadTime: 0,
protocol: currentState?.src?.mime ?? 'unknown',
sourceUrl: '',
timeStalled: 0,
timeUnpaused: 0,
nError: 0,
timeWaiting: 0,
ttff: 0,
userAgent: currentState.device.userAgent,
videoHeight: null,
videoWidth: null,
playerHeight: null,
playerWidth: null,
player: 'livepeer-js',
pageUrl: '',
sourceUrl: '',
playbackScore: null,
duration: null,
autoplay: store.getState().autoplay,
userAgent: store.getState().device.userAgent,
ttff: 0
videoWidth: null
};

@@ -192,2 +199,5 @@ store.subscribe((state, prevState) => {

this.requestedPlayTime = state._requestedPlayPauseLastTime;
if (this.preloadTime === 0) {
this.preloadTime = Date.now() - bootMs;
}
}

@@ -257,3 +267,4 @@ if (state.playing !== prevState.playing) {

timeStalled: this.timeStalled.getTotalTime(),
timeUnpaused: this.timeUnpaused.getTotalTime()
timeUnpaused: this.timeUnpaused.getTotalTime(),
preloadTime: this.preloadTime
};

@@ -291,2 +302,7 @@ const previousMetrics = this.previousMetrics;

}
// set the src from the source URL
store.setState({
src: src.getMediaSourceType(sourceUrl)
});
const metricsStatus = new MetricsStatus(store);

@@ -293,0 +309,0 @@ try {

@@ -1,2 +0,3 @@

export { D as DEFAULT_AUTOHIDE_TIME, a as DEFAULT_VOLUME_LEVEL, c as createControllerStore, g as getMediaSourceType } from '../../dist/src-e4278ceb.esm.js';
import { g as getMediaSourceType } from '../../dist/src-6007c27b.esm.js';
export { D as DEFAULT_AUTOHIDE_TIME, a as DEFAULT_VOLUME_LEVEL, c as createControllerStore, g as getMediaSourceType } from '../../dist/src-6007c27b.esm.js';
import fetch from 'cross-fetch';

@@ -7,3 +8,2 @@ import 'zustand/middleware';

const LP_DOMAINS = ['livepeer', 'livepeercdn', 'lp-playback'];
const PLAYLIST_NAME = 'index.m3u8';
const ASSET_URL_PART_VALUE = 'hls';

@@ -19,3 +19,2 @@ const RECORDING_URL_PART_VALUE = 'recordings';

const parts = parsedUrl.pathname.split('/');
const playlistPartIndex = parts.indexOf(PLAYLIST_NAME);
const includesAssetUrl = parts.includes(ASSET_URL_PART_VALUE);

@@ -25,3 +24,3 @@ const includesRecording = parts.includes(RECORDING_URL_PART_VALUE);

// Check if the url is valid
const playbackId = (includesAssetUrl || includesRecording) && playlistPartIndex !== -1 ? parts?.[playlistPartIndex - 1] ?? null : null;
const playbackId = includesRecording || includesAssetUrl ? parts?.[(parts?.length ?? 0) - 2] ?? null : null;
const splitHost = parsedUrl.host.split('.');

@@ -147,2 +146,3 @@ const includesDomain = LP_DOMAINS.includes(splitHost?.[splitHost.length - 2] ?? '');

class MetricsStatus {
preloadTime = 0;
requestedPlayTime = 0;

@@ -156,24 +156,32 @@ retryCount = 0;

constructor(store) {
this.requestedPlayTime = store.getState().autoplay ? Date.now() : 0;
const currentState = store.getState();
if (currentState.autoplay) {
this.requestedPlayTime = Date.now();
this.preloadTime = this.requestedPlayTime - bootMs;
} else {
this.requestedPlayTime = 0;
}
this.store = store;
this.currentMetrics = {
autoplay: currentState.priority && currentState.autoplay ? 'autoplay' : currentState.preload === 'full' ? 'preload-full' : currentState.preload === 'metadata' ? 'preload-metadata' : 'standard',
duration: null,
firstPlayback: 0,
nError: 0,
nStalled: 0,
nWaiting: 0,
timeWaiting: 0,
nStalled: 0,
pageUrl: typeof window !== 'undefined' ? window?.location?.href ?? '' : '',
playbackScore: null,
player: 'livepeer-js',
playerHeight: null,
playerWidth: null,
preloadTime: 0,
protocol: currentState?.src?.mime ?? 'unknown',
sourceUrl: '',
timeStalled: 0,
timeUnpaused: 0,
nError: 0,
timeWaiting: 0,
ttff: 0,
userAgent: currentState.device.userAgent,
videoHeight: null,
videoWidth: null,
playerHeight: null,
playerWidth: null,
player: 'livepeer-js',
pageUrl: '',
sourceUrl: '',
playbackScore: null,
duration: null,
autoplay: store.getState().autoplay,
userAgent: store.getState().device.userAgent,
ttff: 0
videoWidth: null
};

@@ -183,2 +191,5 @@ store.subscribe((state, prevState) => {

this.requestedPlayTime = state._requestedPlayPauseLastTime;
if (this.preloadTime === 0) {
this.preloadTime = Date.now() - bootMs;
}
}

@@ -248,3 +259,4 @@ if (state.playing !== prevState.playing) {

timeStalled: this.timeStalled.getTotalTime(),
timeUnpaused: this.timeUnpaused.getTotalTime()
timeUnpaused: this.timeUnpaused.getTotalTime(),
preloadTime: this.preloadTime
};

@@ -282,2 +294,7 @@ const previousMetrics = this.previousMetrics;

}
// set the src from the source URL
store.setState({
src: getMediaSourceType(sourceUrl)
});
const metricsStatus = new MetricsStatus(store);

@@ -284,0 +301,0 @@ try {

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

"license": "MIT",
"version": "1.1.5",
"version": "1.2.0",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

@@ -33,5 +33,5 @@ 'use strict';

const core = `@livepeer/core@1.1.5`;
const react = `@livepeer/react@2.1.5`;
const reactNative = `@livepeer/react-native@1.1.5`;
const core = `@livepeer/core@1.2.0`;
const react = `@livepeer/react@2.2.0`;
const reactNative = `@livepeer/react-native@1.2.0`;

@@ -216,3 +216,3 @@ class BaseLivepeerProvider {

},
...(typeof File !== 'undefined' && source instanceof File ? null : {
...(typeof File !== 'undefined' && source?.file instanceof File ? null : {
chunkSize: 5 * 1024 * 1024

@@ -398,7 +398,5 @@ }),

meta: {
live: studioPlaybackInfo?.['meta']?.['live'] ? Boolean(studioPlaybackInfo?.['meta']['live']) : false,
live: Boolean(studioPlaybackInfo?.['meta']?.['live']),
source: studioPlaybackInfo?.['meta']?.['source']?.map(source => ({
hrn: source?.['hrn'],
type: source?.['type'],
url: source?.['url']
...source
}))

@@ -405,0 +403,0 @@ }

@@ -33,5 +33,5 @@ 'use strict';

const core = `@livepeer/core@1.1.5`;
const react = `@livepeer/react@2.1.5`;
const reactNative = `@livepeer/react-native@1.1.5`;
const core = `@livepeer/core@1.2.0`;
const react = `@livepeer/react@2.2.0`;
const reactNative = `@livepeer/react-native@1.2.0`;

@@ -216,3 +216,3 @@ class BaseLivepeerProvider {

},
...(typeof File !== 'undefined' && source instanceof File ? null : {
...(typeof File !== 'undefined' && source?.file instanceof File ? null : {
chunkSize: 5 * 1024 * 1024

@@ -398,7 +398,5 @@ }),

meta: {
live: studioPlaybackInfo?.['meta']?.['live'] ? Boolean(studioPlaybackInfo?.['meta']['live']) : false,
live: Boolean(studioPlaybackInfo?.['meta']?.['live']),
source: studioPlaybackInfo?.['meta']?.['source']?.map(source => ({
hrn: source?.['hrn'],
type: source?.['type'],
url: source?.['url']
...source
}))

@@ -405,0 +403,0 @@ }

@@ -6,5 +6,5 @@ import * as tus from 'tus-js-client';

const core = `@livepeer/core@1.1.5`;
const react = `@livepeer/react@2.1.5`;
const reactNative = `@livepeer/react-native@1.1.5`;
const core = `@livepeer/core@1.2.0`;
const react = `@livepeer/react@2.2.0`;
const reactNative = `@livepeer/react-native@1.2.0`;

@@ -189,3 +189,3 @@ class BaseLivepeerProvider {

},
...(typeof File !== 'undefined' && source instanceof File ? null : {
...(typeof File !== 'undefined' && source?.file instanceof File ? null : {
chunkSize: 5 * 1024 * 1024

@@ -371,7 +371,5 @@ }),

meta: {
live: studioPlaybackInfo?.['meta']?.['live'] ? Boolean(studioPlaybackInfo?.['meta']['live']) : false,
live: Boolean(studioPlaybackInfo?.['meta']?.['live']),
source: studioPlaybackInfo?.['meta']?.['source']?.map(source => ({
hrn: source?.['hrn'],
type: source?.['type'],
url: source?.['url']
...source
}))

@@ -378,0 +376,0 @@ }

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