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 2.0.4 to 2.0.5

dist/controller-950eb69f.cjs.dev.js

1

dist/declarations/src/media/metrics/utils.d.ts
export declare const getMetricsReportingUrl: (playbackId: string, playbackDomain: string, sessionToken?: string | null) => Promise<string | null>;
export declare const getPlaybackIdFromSourceUrl: (sourceUrl: string) => string | null | undefined;

6

dist/declarations/src/version.d.ts
export declare const version: {
readonly core: "@livepeer/core@2.0.4";
readonly react: "@livepeer/react@3.0.4";
readonly reactNative: "@livepeer/react-native@2.0.4";
readonly core: "@livepeer/core@2.0.5";
readonly react: "@livepeer/react@3.0.5";
readonly reactNative: "@livepeer/react-native@2.0.5";
};

@@ -7,7 +7,7 @@ 'use strict';

var client = require('./client-7e4fd284.cjs.dev.js');
var version = require('./version-b67eed53.cjs.dev.js');
var version = require('./version-512cb114.cjs.dev.js');
var updateStream = require('./updateStream-26465265.cjs.dev.js');
var getStream = require('./getStream-a1e88460.cjs.dev.js');
var provider = require('./provider-56b1ec78.cjs.dev.js');
var controller = require('./controller-6c71c4f9.cjs.dev.js');
var controller = require('./controller-950eb69f.cjs.dev.js');
var string = require('./string-0759efb1.cjs.dev.js');

@@ -18,2 +18,3 @@ var deepMerge = require('./deepMerge-cb091110.cjs.dev.js');

require('zustand/vanilla');
require('cross-fetch');

@@ -20,0 +21,0 @@

@@ -7,7 +7,7 @@ 'use strict';

var client = require('./client-b49d615d.cjs.prod.js');
var version = require('./version-a0b662c5.cjs.prod.js');
var version = require('./version-62d3c7cd.cjs.prod.js');
var updateStream = require('./updateStream-7eba57a6.cjs.prod.js');
var getStream = require('./getStream-03a26cdc.cjs.prod.js');
var provider = require('./provider-68cbe4e6.cjs.prod.js');
var controller = require('./controller-1e1031e1.cjs.prod.js');
var controller = require('./controller-b1912b08.cjs.prod.js');
var string = require('./string-7bb3bb00.cjs.prod.js');

@@ -18,2 +18,3 @@ var deepMerge = require('./deepMerge-87fd8395.cjs.prod.js');

require('zustand/vanilla');
require('cross-fetch');

@@ -20,0 +21,0 @@

export { ACCESS_CONTROL_ERROR_MESSAGE, BFRAMES_ERROR_MESSAGE, HttpError, NOT_ACCEPTABLE_ERROR_MESSAGE, STREAM_OFFLINE_ERROR_MESSAGE, STREAM_OPEN_ERROR_MESSAGE, isAccessControlError, isBframesError, isNotAcceptableError, isStreamOfflineError } from '../errors/dist/livepeer-core-errors.esm.js';
export { C as Client, c as clearClient, a as createClient, b as createStorage, n as noopStorage } from './client-8a4dc167.esm.js';
export { v as version } from './version-0dd21e13.esm.js';
export { v as version } from './version-e14eff34.esm.js';
export { c as createAsset, a as createClip, b as createStream, g as getAsset, d as getAssetMetrics, e as getPlaybackInfo, f as getStreamSession, h as getStreamSessions, u as updateAsset, i as updateStream, w as watchLivepeerProvider } from './updateStream-c0096efd.esm.js';
export { g as getLivepeerProvider, a as getStream } from './getStream-fd5ec1b5.esm.js';
export { d as defaultStudioConfig, a as defaultTranscodingProfiles } from './provider-a18dabb6.esm.js';
export { c as createControllerStore, g as getMediaSourceType, s as sanitizeMediaControllerState } from './controller-6eaacb96.esm.js';
export { c as createControllerStore, g as getMediaSourceType, s as sanitizeMediaControllerState } from './controller-9bf6e68a.esm.js';
export { b as b64Decode, a as b64Encode, c as b64UrlDecode, d as b64UrlEncode } from './string-9a973b0a.esm.js';

@@ -13,1 +13,2 @@ export { d as deepMerge } from './deepMerge-577dcbf6.esm.js';

import 'zustand/vanilla';
import 'cross-fetch';

@@ -5,48 +5,8 @@ 'use strict';

var controller = require('../../dist/controller-6c71c4f9.cjs.dev.js');
var fetch = require('cross-fetch');
var controller = require('../../dist/controller-950eb69f.cjs.dev.js');
require('zustand/middleware');
require('zustand/vanilla');
require('cross-fetch');
require('../../dist/omick-042aa9a4.cjs.dev.js');
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
var fetch__default = /*#__PURE__*/_interopDefault(fetch);
const LP_DOMAINS = ['livepeer', 'livepeercdn', 'lp-playback'];
// Finds the metrics reporting URL from a playback ID and a playback domain
const getMetricsReportingUrl = async (playbackId, playbackDomain, sessionToken) => {
try {
const parsedUrl = new URL(playbackDomain);
const splitHost = parsedUrl.host.split('.');
const includesDomain = LP_DOMAINS.includes(splitHost?.[splitHost.length - 2] ?? '');
const tld = splitHost?.[splitHost?.length - 1] ?? null;
// map to known TLDs, with .com => .studio
const tldMapped = tld === 'com' ? 'studio' : tld === 'studio' ? 'studio' : tld === 'fun' ? 'fun:20443' : tld === 'monster' ? 'monster' : null;
// if not a known TLD, then do not return a URL
if (playbackId && includesDomain && tldMapped) {
try {
const response = await fetch__default["default"](`https://playback.livepeer.${tldMapped}/json_video+${playbackId}.js`);
// parse the url which we're redirected to
const redirectedUrl = response?.url?.replace('https:', 'wss:');
const url = redirectedUrl ? new URL(redirectedUrl) : null;
if (url && sessionToken) {
url.searchParams.set('tkn', sessionToken);
}
return url?.toString?.() ?? null;
} catch (error) {
console.log(`Could not fetch metrics reporting URL.`, error);
}
}
} catch (error) {
console.error(error?.message);
return null;
}
return null;
};
class PlaybackMonitor {

@@ -356,3 +316,3 @@ active = false;

const createNewWebSocket = async (numRetries = 0) => {
const reportingWebsocketUrl = await getMetricsReportingUrl(playbackId, playbackDomain, sessionToken);
const reportingWebsocketUrl = await controller.getMetricsReportingUrl(playbackId, playbackDomain, sessionToken);
if (reportingWebsocketUrl) {

@@ -359,0 +319,0 @@ const newWebSocket = new WebSocket(reportingWebsocketUrl);

@@ -5,48 +5,8 @@ 'use strict';

var controller = require('../../dist/controller-1e1031e1.cjs.prod.js');
var fetch = require('cross-fetch');
var controller = require('../../dist/controller-b1912b08.cjs.prod.js');
require('zustand/middleware');
require('zustand/vanilla');
require('cross-fetch');
require('../../dist/omick-75157746.cjs.prod.js');
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
var fetch__default = /*#__PURE__*/_interopDefault(fetch);
const LP_DOMAINS = ['livepeer', 'livepeercdn', 'lp-playback'];
// Finds the metrics reporting URL from a playback ID and a playback domain
const getMetricsReportingUrl = async (playbackId, playbackDomain, sessionToken) => {
try {
const parsedUrl = new URL(playbackDomain);
const splitHost = parsedUrl.host.split('.');
const includesDomain = LP_DOMAINS.includes(splitHost?.[splitHost.length - 2] ?? '');
const tld = splitHost?.[splitHost?.length - 1] ?? null;
// map to known TLDs, with .com => .studio
const tldMapped = tld === 'com' ? 'studio' : tld === 'studio' ? 'studio' : tld === 'fun' ? 'fun:20443' : tld === 'monster' ? 'monster' : null;
// if not a known TLD, then do not return a URL
if (playbackId && includesDomain && tldMapped) {
try {
const response = await fetch__default["default"](`https://playback.livepeer.${tldMapped}/json_video+${playbackId}.js`);
// parse the url which we're redirected to
const redirectedUrl = response?.url?.replace('https:', 'wss:');
const url = redirectedUrl ? new URL(redirectedUrl) : null;
if (url && sessionToken) {
url.searchParams.set('tkn', sessionToken);
}
return url?.toString?.() ?? null;
} catch (error) {
console.log(`Could not fetch metrics reporting URL.`, error);
}
}
} catch (error) {
console.error(error?.message);
return null;
}
return null;
};
class PlaybackMonitor {

@@ -356,3 +316,3 @@ active = false;

const createNewWebSocket = async (numRetries = 0) => {
const reportingWebsocketUrl = await getMetricsReportingUrl(playbackId, playbackDomain, sessionToken);
const reportingWebsocketUrl = await controller.getMetricsReportingUrl(playbackId, playbackDomain, sessionToken);
if (reportingWebsocketUrl) {

@@ -359,0 +319,0 @@ const newWebSocket = new WebSocket(reportingWebsocketUrl);

@@ -1,43 +0,8 @@

export { D as DEFAULT_AUTOHIDE_TIME, a as DEFAULT_VOLUME_LEVEL, c as createControllerStore, g as getMediaSourceType, s as sanitizeMediaControllerState } from '../../dist/controller-6eaacb96.esm.js';
import fetch from 'cross-fetch';
import { a as getMetricsReportingUrl } from '../../dist/controller-9bf6e68a.esm.js';
export { D as DEFAULT_AUTOHIDE_TIME, b as DEFAULT_VOLUME_LEVEL, c as createControllerStore, g as getMediaSourceType, s as sanitizeMediaControllerState } from '../../dist/controller-9bf6e68a.esm.js';
import 'zustand/middleware';
import 'zustand/vanilla';
import 'cross-fetch';
import '../../dist/omick-8a6e6439.esm.js';
const LP_DOMAINS = ['livepeer', 'livepeercdn', 'lp-playback'];
// Finds the metrics reporting URL from a playback ID and a playback domain
const getMetricsReportingUrl = async (playbackId, playbackDomain, sessionToken) => {
try {
const parsedUrl = new URL(playbackDomain);
const splitHost = parsedUrl.host.split('.');
const includesDomain = LP_DOMAINS.includes(splitHost?.[splitHost.length - 2] ?? '');
const tld = splitHost?.[splitHost?.length - 1] ?? null;
// map to known TLDs, with .com => .studio
const tldMapped = tld === 'com' ? 'studio' : tld === 'studio' ? 'studio' : tld === 'fun' ? 'fun:20443' : tld === 'monster' ? 'monster' : null;
// if not a known TLD, then do not return a URL
if (playbackId && includesDomain && tldMapped) {
try {
const response = await fetch(`https://playback.livepeer.${tldMapped}/json_video+${playbackId}.js`);
// parse the url which we're redirected to
const redirectedUrl = response?.url?.replace('https:', 'wss:');
const url = redirectedUrl ? new URL(redirectedUrl) : null;
if (url && sessionToken) {
url.searchParams.set('tkn', sessionToken);
}
return url?.toString?.() ?? null;
} catch (error) {
console.log(`Could not fetch metrics reporting URL.`, error);
}
}
} catch (error) {
console.error(error?.message);
return null;
}
return null;
};
class PlaybackMonitor {

@@ -44,0 +9,0 @@ active = false;

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

"license": "MIT",
"version": "2.0.4",
"version": "2.0.5",
"repository": {

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

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

var errors_dist_livepeerCoreErrors = require('../../../errors/dist/livepeer-core-errors.cjs.dev.js');
var version = require('../../../dist/version-b67eed53.cjs.dev.js');
var version = require('../../../dist/version-512cb114.cjs.dev.js');
var provider = require('../../../dist/provider-56b1ec78.cjs.dev.js');

@@ -11,0 +11,0 @@

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

var errors_dist_livepeerCoreErrors = require('../../../errors/dist/livepeer-core-errors.cjs.prod.js');
var version = require('../../../dist/version-a0b662c5.cjs.prod.js');
var version = require('../../../dist/version-62d3c7cd.cjs.prod.js');
var provider = require('../../../dist/provider-68cbe4e6.cjs.prod.js');

@@ -11,0 +11,0 @@

import * as tus from 'tus-js-client';
import fetch from 'cross-fetch';
import { HttpError } from '../../../errors/dist/livepeer-core-errors.esm.js';
import { v as version } from '../../../dist/version-0dd21e13.esm.js';
import { v as version } from '../../../dist/version-e14eff34.esm.js';
import { d as defaultStudioConfig } from '../../../dist/provider-a18dabb6.esm.js';

@@ -6,0 +6,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