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

hyperspeed.js

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperspeed.js - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

2

dist/client.d.ts

@@ -9,2 +9,3 @@ /// <reference types="node" />

manageStream?: boolean;
trackViewers?: boolean;
autoReconnect?: boolean;

@@ -16,2 +17,3 @@ }

private ws?;
private viewerCountChecker?;
private consumerTransport?;

@@ -18,0 +20,0 @@ private receiveMediaStream?;

64

dist/client.js

@@ -1,22 +0,26 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Client = void 0;
const mediasoup_client_1 = require("mediasoup-client");
const events_1 = __importDefault(require("events"));
class Client extends events_1.default {
import { Device } from "mediasoup-client";
import EventEmitter from 'events';
export class Client extends EventEmitter {
constructor(options) {
super();
this.device = new mediasoup_client_1.Device();
this.options = {
manageStream: true,
...options
};
this.device = new Device();
this.options = Object.assign({ manageStream: true, trackViewers: true }, options);
}
reset() {
var _a;
(_a = this.ws) === null || _a === void 0 ? void 0 : _a.close();
clearInterval(this.viewerCountChecker);
delete this.ws;
delete this.consumerTransport;
delete this.receiveMediaStream;
delete this.viewerCountChecker;
}

@@ -45,3 +49,9 @@ send(data) {

}
this.ws.onmessage = async (e) => {
if (this.options.trackViewers) {
this.send({ type: 'PollConnectedViewers' });
this.viewerCountChecker = setInterval(() => {
this.send({ type: 'PollConnectedViewers' });
}, 5e3);
}
this.ws.onmessage = (e) => __awaiter(this, void 0, void 0, function* () {
var _a;

@@ -56,5 +66,8 @@ if (typeof e.data === 'string') {

console.info('Server sent us Init');
await this.device.load({
routerRtpCapabilities: data.router_rtp_capabilities
});
try {
yield this.device.load({
routerRtpCapabilities: data.router_rtp_capabilities
});
}
catch (err) { }
if (this.options.debug)

@@ -67,2 +80,10 @@ console.info('Loaded mediasoup device.');

this.consumerTransport = this.device.createRecvTransport(data.transport);
this.consumerTransport.on('connectionstatechange', state => {
if (this.options.debug)
console.log('Transport connection state:', state);
if (state === 'disconnected') {
this.reset();
this.watch(channel_id);
}
});
this.consumerTransport.on('connect', ({ dtlsParameters: dtls_parameters }, success) => {

@@ -86,3 +107,3 @@ this.send({

for (const entry of data.consume) {
const consumer = await this.consumerTransport.consume(entry);
const consumer = yield this.consumerTransport.consume(entry);
if (this.options.debug)

@@ -111,7 +132,10 @@ console.info('Created new track of type:', consumer.kind);

}
case 'ViewerCount': {
this.emit('viewerCount', data.count);
break;
}
}
}
};
});
}
}
exports.Client = Client;

@@ -1,5 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Client = void 0;
var client_1 = require("./client");
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
export { Client } from './client';

@@ -29,2 +29,4 @@ import type { MediaKind, RtpCapabilities, RtpParameters } from "mediasoup-client/lib/RtpParameters";

id: string;
} | {
type: 'PollConnectedViewers';
});

@@ -41,2 +43,5 @@ export declare type ClientboundMessage = ({

consume: Consume[];
} | {
type: 'ViewerCount';
count: number;
});

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
{
"type": "module",
"name": "hyperspeed.js",
"version": "0.0.5",
"version": "0.0.6",
"description": "Library for connecting to Hyperspeed streams.",

@@ -18,3 +19,4 @@ "main": "dist/index.js",

"scripts": {
"build": "tsc"
"build": "tsc",
"build:watch": "tsc --watch"
},

@@ -21,0 +23,0 @@ "files": [

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