Socket
Socket
Sign inDemoInstall

@skyway-sdk/room

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@skyway-sdk/room - npm Package Compare versions

Comparing version 0.2.0-beta.26 to 0.3.0-beta.0

dist/skyway_room-0.3.0-beta.0.js

2

dist/index.d.ts

@@ -14,4 +14,4 @@ export * from './member';

export * from '@skyway-sdk/common';
export { ChannelStatus, Event, Events, LocalAudioStream, LocalDataStream, LocalStream, LocalVideoStream, Logger, MediaDeviceManager, MemberSide, MemberStatus, MemberType, PublicationOptions, PublicationStatus, RemoteAudioStream, RemoteDataStream, RemoteStream, RemoteVideoStream, RtcApiConfig, RtcRpcApiConfig, SkyWayConfigOptions, SkyWayContext, SkyWayMediaDevices, SubscriptionStatus, TurnPolicy, } from '@skyway-sdk/core';
export { ChannelStatus, Codec, Event, Events, LocalAudioStream, LocalDataStream, LocalStream, LocalVideoStream, Logger, MediaDeviceManager, MemberSide, MemberStatus, MemberType, PublicationOptions, PublicationStatus, RemoteAudioStream, RemoteDataStream, RemoteStream, RemoteVideoStream, RtcApiConfig, RtcRpcApiConfig, SkyWayConfigOptions, SkyWayContext, SkyWayMediaDevices, SubscriptionStatus, TurnPolicy, } from '@skyway-sdk/core';
export * from '@skyway-sdk/token';
//# sourceMappingURL=index.d.ts.map

@@ -45,7 +45,7 @@ import { Event } from '@skyway-sdk/common';

*/
unpublish: (publicationId: string) => Promise<void>;
unpublish: (publicationId: string | RoomPublication) => Promise<void>;
/**
* @description {japanese} StreamのPublicationをSubscribeする
*/
subscribe: <T extends RemoteStream = RemoteStream>(publicationId: string) => Promise<{
subscribe: <T extends RemoteStream = RemoteStream>(publicationId: string | RoomPublication) => Promise<{
subscription: RoomSubscription<T>;

@@ -57,3 +57,3 @@ stream: T;

*/
unsubscribe: (subscriptionId: string) => Promise<void>;
unsubscribe: (subscriptionId: string | RoomSubscription) => Promise<void>;
leave: () => Promise<void>;

@@ -82,11 +82,12 @@ getConnections: () => SkyWayConnection[];

readonly onSubscriptionChanged: Event<void>;
readonly _context: import("@skyway-sdk/core").SkyWayContext;
/**@private */
constructor(member: LocalPersonAdapter, room: RoomImpl);
protected _listenRoomEvent(): void;
abstract unpublish(publicationId: string): Promise<void>;
abstract subscribe<T extends RemoteStream = RemoteStream>(publicationId: string): Promise<{
abstract unpublish(publicationId: string | RoomPublication): Promise<void>;
abstract subscribe<T extends RemoteStream = RemoteStream>(publicationId: string | RoomPublication): Promise<{
subscription: RoomSubscription<T>;
stream: T;
}>;
abstract unsubscribe(subscriptionId: string): Promise<void>;
abstract unsubscribe(subscriptionId: string | RoomSubscription): Promise<void>;
leave(): Promise<void>;

@@ -93,0 +94,0 @@ abstract _updateRoom(room: Room): void;

@@ -30,2 +30,3 @@ "use strict";

this.onSubscriptionChanged = new common_1.Event();
this._context = this.room._context;
this._local.onStreamSubscribed.add((e) => __awaiter(this, void 0, void 0, function* () {

@@ -32,0 +33,0 @@ const roomSubscription = room._addSubscription(e.subscription);

@@ -17,10 +17,10 @@ import { LocalPersonAdapter, LocalStream, RemoteStream } from '@skyway-sdk/core';

publish(stream: LocalStream, options?: PublicationOptions): Promise<RoomPublication>;
unpublish(publicationId: string): Promise<void>;
subscribe<T extends RemoteStream = RemoteStream>(publicationId: string): Promise<{
unpublish(target: string | RoomPublication): Promise<void>;
subscribe<T extends RemoteStream = RemoteStream>(target: string | RoomPublication): Promise<{
subscription: RoomSubscription<T>;
stream: T;
}>;
unsubscribe(subscriptionId: string): Promise<void>;
unsubscribe(target: string | RoomSubscription): Promise<void>;
_updateRoom(room: P2PRoomImpl): void;
}
//# sourceMappingURL=p2p.d.ts.map

@@ -14,3 +14,2 @@ "use strict";

const common_1 = require("@skyway-sdk/common");
const core_1 = require("@skyway-sdk/core");
const base_1 = require("./base");

@@ -32,7 +31,8 @@ const log = new common_1.Logger('packages/room/src/member/local/p2p.ts');

}
unpublish(publicationId) {
unpublish(target) {
return __awaiter(this, void 0, void 0, function* () {
const publicationId = typeof target === 'string' ? target : target.id;
this._local.unpublish(publicationId);
const { publication } = yield this.room.onStreamUnpublished
.watch((e) => e.publication.id === publicationId, core_1.SkyWayConfig.get.rtcApi.timeout)
.watch((e) => e.publication.id === publicationId, this._context.config.rtcApi.timeout)
.catch(() => {

@@ -47,4 +47,5 @@ throw new common_1.SkyWayError({

}
subscribe(publicationId) {
subscribe(target) {
return __awaiter(this, void 0, void 0, function* () {
const publicationId = typeof target === 'string' ? target : target.id;
const { subscription, stream } = yield this._local.subscribe(publicationId);

@@ -58,7 +59,8 @@ const roomSubscription = this.room._addSubscription(subscription);

}
unsubscribe(subscriptionId) {
unsubscribe(target) {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = typeof target === 'string' ? target : target.id;
this._local.unsubscribe(subscriptionId);
yield this.room.onStreamUnsubscribed
.watch((e) => e.subscription.id === subscriptionId, core_1.SkyWayConfig.get.rtcApi.timeout)
.watch((e) => e.subscription.id === subscriptionId, this._context.config.rtcApi.timeout)
.catch(() => {

@@ -65,0 +67,0 @@ throw new common_1.SkyWayError({

@@ -20,7 +20,7 @@ import { LocalPersonAdapter, LocalStream, RemoteStream } from '@skyway-sdk/core';

*/
unpublish(publicationId: string): Promise<void>;
unpublish(target: string | RoomPublication): Promise<void>;
/**
* @description {japanese} MemberがRoom上のStreamのPublicationをSubscribeする
*/
subscribe<T extends RemoteStream = RemoteStream>(publicationId: string): Promise<{
subscribe<T extends RemoteStream = RemoteStream>(target: string | RoomPublication): Promise<{
subscription: RoomSubscription<T>;

@@ -32,3 +32,3 @@ stream: T;

*/
unsubscribe(subscriptionId: string): Promise<void>;
unsubscribe(target: string | RoomSubscription): Promise<void>;
_updateRoom(room: SfuRoomImpl): void;

@@ -38,4 +38,3 @@ }

maxSubscribers?: number;
policy?: 'tile' | 'normal';
}
//# sourceMappingURL=sfu.d.ts.map

@@ -26,3 +26,3 @@ "use strict";

publish(stream, options = {}) {
var _a, _b;
var _a;
return __awaiter(this, void 0, void 0, function* () {

@@ -35,27 +35,2 @@ if (stream instanceof core_1.LocalDataStream) {

options.maxSubscribers = (_a = options.maxSubscribers) !== null && _a !== void 0 ? _a : const_1.defaultMaxSubscribers;
options.policy = (_b = options.policy) !== null && _b !== void 0 ? _b : 'tile';
if (options.policy === 'tile') {
let short = stream.track.getSettings().width;
if (short > stream.track.getSettings().height) {
short = stream.track.getSettings().height;
}
const res = calcResolutionByMaxSubscribers(options.maxSubscribers);
let ratio = 1;
if (short > res) {
ratio = Math.floor(short / res);
}
log.debug('original encodings', JSON.stringify(options.encodings));
if (options.encodings) {
options.encodings = options.encodings.map((e) => {
var _a;
if ((_a = e.scaleResolutionDownBy) !== null && _a !== void 0 ? _a : 0 > ratio)
return e;
return Object.assign(Object.assign({}, e), { scaleResolutionDownBy: ratio });
});
}
else {
options.encodings = [{ scaleResolutionDownBy: ratio }];
}
log.debug('new encodings', JSON.stringify(options.encodings));
}
const origin = yield this._local.publish(stream, options);

@@ -87,4 +62,5 @@ const bot = this.room._channel.members.find((m) => m.subtype === sfu_client_1.SfuBotMember.subtype);

*/
unpublish(publicationId) {
unpublish(target) {
return __awaiter(this, void 0, void 0, function* () {
const publicationId = typeof target === 'string' ? target : target.id;
const publication = this.room._getPublication(publicationId);

@@ -100,3 +76,3 @@ const origin = publication._publication.origin;

yield this.room.onStreamUnpublished
.watch((e) => e.publication.id === publicationId, core_1.SkyWayConfig.get.rtcApi.timeout)
.watch((e) => e.publication.id === publicationId, this._context.config.rtcApi.timeout)
.catch(() => {

@@ -114,4 +90,5 @@ throw new common_1.SkyWayError({

*/
subscribe(publicationId) {
subscribe(target) {
return __awaiter(this, void 0, void 0, function* () {
const publicationId = typeof target === 'string' ? target : target.id;
const { subscription, stream } = yield this._local.subscribe(publicationId);

@@ -128,7 +105,8 @@ const roomSubscription = this.room._addSubscription(subscription);

*/
unsubscribe(subscriptionId) {
unsubscribe(target) {
return __awaiter(this, void 0, void 0, function* () {
const subscriptionId = typeof target === 'string' ? target : target.id;
this._local.unsubscribe(subscriptionId);
yield this.room.onStreamUnsubscribed
.watch((e) => e.subscription.id === subscriptionId, core_1.SkyWayConfig.get.rtcApi.timeout)
.watch((e) => e.subscription.id === subscriptionId, this._context.config.rtcApi.timeout)
.catch(() => {

@@ -149,8 +127,2 @@ throw new common_1.SkyWayError({

exports.LocalSFURoomMemberImpl = LocalSFURoomMemberImpl;
function calcResolutionByMaxSubscribers(max) {
const baseResolution = 1080;
const row = Math.floor(Math.sqrt(max));
const resolution = Math.floor(baseResolution / row);
return resolution;
}
//# sourceMappingURL=sfu.js.map

@@ -5,2 +5,3 @@ import { Event } from '@skyway-sdk/common';

import { RoomImpl } from '../room/base';
import { StreamSubscribedEvent, StreamUnsubscribedEvent } from '../room/event';
import { RoomSubscription } from '../subscription';

@@ -22,6 +23,8 @@ export interface RoomPublication<T extends LocalStream = LocalStream> {

readonly onUnpublished: Event<void>;
readonly onSubscribed: Event<void>;
readonly onUnsubscribed: Event<void>;
readonly onSubscribed: Event<StreamSubscribedEvent>;
readonly onUnsubscribed: Event<StreamUnsubscribedEvent>;
readonly onSubscriptionChanged: Event<void>;
readonly onMetadataUpdated: Event<string>;
readonly onMetadataUpdated: Event<{
metadata: string;
}>;
/**

@@ -51,6 +54,8 @@ * @description {japanese} Metadataの更新

readonly onUnpublished: Event<void>;
readonly onSubscribed: Event<void>;
readonly onUnsubscribed: Event<void>;
readonly onSubscribed: Event<StreamSubscribedEvent>;
readonly onUnsubscribed: Event<StreamUnsubscribedEvent>;
readonly onSubscriptionChanged: Event<void>;
readonly onMetadataUpdated: Event<string>;
readonly onMetadataUpdated: Event<{
metadata: string;
}>;
constructor(_publication: Publication, _room: RoomImpl);

@@ -57,0 +62,0 @@ private _setEvents;

@@ -43,3 +43,3 @@ "use strict";

if (e.subscription.publication.id === this.id) {
this.onSubscribed.emit();
this.onSubscribed.emit({ subscription: e.subscription });
this.onSubscriptionChanged.emit();

@@ -50,3 +50,3 @@ }

if (e.subscription.publication.id === this.id) {
this.onUnsubscribed.emit();
this.onUnsubscribed.emit({ subscription: e.subscription });
this.onSubscriptionChanged.emit();

@@ -53,0 +53,0 @@ }

@@ -97,2 +97,3 @@ import { Event } from '@skyway-sdk/common';

_addSubscription(s: SubscriptionImpl): RoomSubscriptionImpl<import("@skyway-sdk/core").RemoteStream>;
readonly _context: import("@skyway-sdk/core").SkyWayContext;
private readonly _events;

@@ -99,0 +100,0 @@ readonly onClosed: Event<event.RoomClosedEvent>;

@@ -14,3 +14,2 @@ "use strict";

const common_1 = require("@skyway-sdk/common");
const core_1 = require("@skyway-sdk/core");
const uuid_1 = require("uuid");

@@ -25,2 +24,3 @@ const __1 = require("..");

this._subscriptions = {};
this._context = this._channel._context;
this._events = new common_1.Events();

@@ -122,3 +122,3 @@ this.onClosed = this._events.make();

return e.member._member.id === local.id;
}, core_1.SkyWayConfig.get.rtcApi.timeout)
}, this._context.config.rtcApi.timeout)
.catch((error) => {

@@ -125,0 +125,0 @@ throw new common_1.SkyWayError({

@@ -31,2 +31,3 @@ import { ContentType, Event, RemoteStream, SubscriptionImpl, SubscriptionStatus } from '@skyway-sdk/core';

readonly subscriber: RemoteRoomMember;
readonly _context: import("@skyway-sdk/core").SkyWayContext;
readonly onStreamAttached: Event<void>;

@@ -33,0 +34,0 @@ constructor(

@@ -22,2 +22,3 @@ "use strict";

this._room = _room;
this._context = this._room._context;
this.onStreamAttached = new core_1.Event();

@@ -40,3 +41,3 @@ this.id = _subscription.id;

yield this._room.onStreamUnsubscribed
.watch((e) => e.subscription.id === this.id, core_1.SkyWayConfig.get.rtcApi.timeout)
.watch((e) => e.subscription.id === this.id, this._context.config.rtcApi.timeout)
.catch(() => {

@@ -43,0 +44,0 @@ throw new common_1.SkyWayError({

{
"name": "@skyway-sdk/room",
"version": "0.2.0-beta.26",
"version": "0.3.0-beta.0",
"description": "The official Next Generation JavaScript SDK for SkyWay",

@@ -38,9 +38,7 @@ "homepage": "https://beta.skyway.ntt.com/",

"@skyway-sdk/common": "^0.2.0-beta.9",
"@skyway-sdk/core": "^0.2.0-beta.23",
"@skyway-sdk/sfu-client": "^0.2.0-beta.16",
"@skyway-sdk/core": "^0.2.0-beta.24",
"@skyway-sdk/sfu-client": "^0.3.0-beta.0",
"uuid": "^8.3.2"
},
"devDependencies": {
"@skyway-sdk/token": "^0.2.0-beta.8"
}
"devDependencies": {}
}

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

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 too big to display

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