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-alpha.48 to 0.2.0-alpha.49

dist/skyway_room-0.2.0-alpha.49.js

4

dist/index.d.ts

@@ -13,3 +13,5 @@ export * from './member';

export * from './subscription';
export { ChannelStatus, Event, Events, LocalAudioStream, LocalDataStream, LocalStream, LocalVideoStream, Logger, MediaDeviceManager, MemberSide, MemberStatus, MemberType, PublicationOptions, PublicationStatus, RemoteAudioStream, RemoteDataStream, RemoteStream, RemoteVideoStream, RtcApiConfig, RtcRpcApiConfig, SkyWayAuthToken, SkyWayConfigOptions, SkyWayContext, SkyWayMediaDevices, SubscriptionStatus, TurnPolicy, uuidV4, } from '@skyway-sdk/core';
export * from '@skyway-sdk/common';
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

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.uuidV4 = exports.SkyWayMediaDevices = exports.SkyWayContext = exports.SkyWayAuthToken = exports.RemoteVideoStream = exports.RemoteDataStream = exports.RemoteAudioStream = exports.MediaDeviceManager = exports.Logger = exports.LocalVideoStream = exports.LocalDataStream = exports.LocalAudioStream = exports.Events = exports.Event = void 0;
exports.SkyWayMediaDevices = exports.SkyWayContext = exports.RemoteVideoStream = exports.RemoteDataStream = exports.RemoteAudioStream = exports.MediaDeviceManager = exports.Logger = exports.LocalVideoStream = exports.LocalDataStream = exports.LocalAudioStream = exports.Events = exports.Event = void 0;
__exportStar(require("./member"), exports);

@@ -27,2 +27,3 @@ __exportStar(require("./member/local/base"), exports);

__exportStar(require("./subscription"), exports);
__exportStar(require("@skyway-sdk/common"), exports);
var core_1 = require("@skyway-sdk/core");

@@ -39,6 +40,5 @@ Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return core_1.Event; } });

Object.defineProperty(exports, "RemoteVideoStream", { enumerable: true, get: function () { return core_1.RemoteVideoStream; } });
Object.defineProperty(exports, "SkyWayAuthToken", { enumerable: true, get: function () { return core_1.SkyWayAuthToken; } });
Object.defineProperty(exports, "SkyWayContext", { enumerable: true, get: function () { return core_1.SkyWayContext; } });
Object.defineProperty(exports, "SkyWayMediaDevices", { enumerable: true, get: function () { return core_1.SkyWayMediaDevices; } });
Object.defineProperty(exports, "uuidV4", { enumerable: true, get: function () { return core_1.uuidV4; } });
__exportStar(require("@skyway-sdk/token"), exports);
//# sourceMappingURL=index.js.map
import { Event } from '@skyway-sdk/common';
import { LocalPerson, LocalPersonAdapter, PublicationOptions as BaseOptions, RemoteStream } from '@skyway-sdk/core';
import { LocalPerson, LocalPersonAdapter, PublicationOptions as BaseOptions, RemoteStream, SkyWayConnection } from '@skyway-sdk/core';
import { RoomPublication } from '../../publication';

@@ -45,7 +45,7 @@ import { Room, RoomImpl } from '../../room/base';

*/
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,4 +57,6 @@ stream: T;

*/
unsubscribe: (subscriptionId: string) => Promise<void>;
unsubscribe: (subscriptionId: string | RoomSubscription) => Promise<void>;
leave: () => Promise<void>;
getConnections: () => SkyWayConnection[];
filterConnections: (query: RoomSubscription | RoomPublication) => SkyWayConnection[];
}

@@ -80,13 +82,16 @@ /**@internal */

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>;
abstract _updateRoom(room: Room): void;
getConnections(): SkyWayConnection[];
filterConnections(query: RoomPublication | RoomSubscription): SkyWayConnection[];
}

@@ -93,0 +98,0 @@ export interface PublicationOptions extends BaseOptions {

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

const common_1 = require("@skyway-sdk/common");
const publication_1 = require("../../publication");
const subscription_1 = require("../../subscription");
const __1 = require("..");

@@ -29,2 +31,3 @@ /**@internal */

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

@@ -54,4 +57,16 @@ const roomSubscription = room._addSubscription(e.subscription);

}
getConnections() {
return this._local.getConnections();
}
filterConnections(query) {
if (query instanceof publication_1.RoomPublicationImpl) {
return this._local.filterConnections(query._publication);
}
else if (query instanceof subscription_1.RoomSubscriptionImpl) {
return this._local.filterConnections(query._subscription);
}
throw new common_1.SkyWayError({ type: 'invalidParameter', message: '' });
}
}
exports.LocalRoomMemberImpl = LocalRoomMemberImpl;
//# sourceMappingURL=base.js.map

@@ -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;

@@ -35,0 +35,0 @@ }

@@ -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(() => {

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

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

}>;
readonly onSubscriptionChanged: Event<void>;
/**@description {japanese} この RemoteRoomMember にPublicationをSubscribeさせる */

@@ -33,2 +34,3 @@ subscribe: (publicationId: string) => Promise<{

}>;
readonly onSubscriptionChanged: Event<void>;
private _remotePerson;

@@ -35,0 +37,0 @@ constructor(member: Member, room: RoomImpl);

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

this.onPublicationUnsubscribed = new common_1.Event();
this.onSubscriptionChanged = new common_1.Event();
this._remotePerson = this._member;

@@ -30,9 +31,13 @@ this.subscribe = (publicationId) => new Promise((r, f) => {

room.onStreamSubscribed.add((e) => {
if (e.subscription.subscriber._member.id === member.id) {
if (e.subscription.subscriber._member.id ===
member.id) {
this.onPublicationSubscribed.emit(e);
this.onSubscriptionChanged.emit();
}
});
room.onStreamUnsubscribed.add((e) => {
if (e.subscription.subscriber._member.id === member.id) {
if (e.subscription.subscriber._member.id ===
member.id) {
this.onPublicationUnsubscribed.emit(e);
this.onSubscriptionChanged.emit();
}

@@ -39,0 +44,0 @@ });

@@ -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 @@ }

import { Event } from '@skyway-sdk/common';
import { ChannelStatus, Publication, SkyWayChannelImpl, Subscription } from '@skyway-sdk/core';
import { ChannelStatus, Publication, SkyWayChannelImpl, SubscriptionImpl } from '@skyway-sdk/core';
import { RemoteRoomMember, RemoteRoomMemberImpl, RoomMember, RoomPublication, RoomPublicationImpl, RoomSubscription, RoomSubscriptionImpl } from '..';

@@ -96,3 +96,4 @@ import { LocalRoomMember } from '../member/local/base';

/**@private */
_addSubscription(s: Subscription): RoomSubscriptionImpl<import("@skyway-sdk/core").RemoteStream>;
_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({

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

import { ContentType, Event, RemoteStream, Subscription, SubscriptionStatus } from '@skyway-sdk/core';
import { RoomMember } from '../member';
import { ContentType, Event, RemoteStream, SubscriptionImpl, SubscriptionStatus } from '@skyway-sdk/core';
import { RemoteRoomMember } from '../member/remote/base';
import { RoomPublication } from '../publication';

@@ -10,3 +10,3 @@ import { RoomImpl } from '../room/base';

readonly onStreamAttached: Event<void>;
subscriber: RoomMember;
readonly subscriber: RemoteRoomMember;
/**

@@ -26,13 +26,14 @@ * @description {japanese} subscribeしているStreamの実体。

/**@private */
_subscription: Subscription<T>;
_subscription: SubscriptionImpl<T>;
private _room;
readonly id: string;
readonly contentType: ContentType;
readonly publication: RoomPublication;
readonly subscriber: RemoteRoomMember;
readonly _context: import("@skyway-sdk/core").SkyWayContext;
readonly onStreamAttached: Event<void>;
constructor(
/**@private */
_subscription: Subscription<T>, _room: RoomImpl);
_subscription: SubscriptionImpl<T>, _room: RoomImpl);
get stream(): T | undefined;
get publication(): import("../publication").RoomPublicationImpl<import("@skyway-sdk/core").LocalStream>;
get subscriber(): import("..").RemoteRoomMemberImpl;
get status(): SubscriptionStatus;

@@ -39,0 +40,0 @@ cancel(): Promise<void>;

@@ -22,5 +22,8 @@ "use strict";

this._room = _room;
this._context = this._room._context;
this.onStreamAttached = new core_1.Event();
this.id = _subscription.id;
this.contentType = _subscription.contentType;
this.publication = this._room._getPublication(_subscription.publicationId);
this.subscriber = this._room._getMember(_subscription.subscriberId);
_subscription.onStreamAttached.pipe(this.onStreamAttached);

@@ -31,10 +34,2 @@ }

}
get publication() {
const publicationId = this._subscription.publication.id;
const publication = this._room._getPublication(publicationId);
return publication;
}
get subscriber() {
return this._room._getMember(this._subscription.subscriber.id);
}
get status() {

@@ -47,3 +42,3 @@ return this._subscription.status;

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(() => {

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

{
"name": "@skyway-sdk/room",
"version": "0.2.0-alpha.48",
"version": "0.2.0-alpha.49",
"description": "The official Next Generation JavaScript SDK for SkyWay",

@@ -37,10 +37,7 @@ "homepage": "https://beta.skyway.ntt.com/",

"dependencies": {
"@skyway-sdk/common": "^0.2.0-beta.0",
"@skyway-sdk/core": "^0.2.0-beta.0",
"@skyway-sdk/sfu-client": "^0.2.0-beta.0",
"@skyway-sdk/common": "^0.2.0-beta.9",
"@skyway-sdk/core": "^0.2.0-beta.22",
"@skyway-sdk/sfu-client": "^0.2.0-beta.15",
"uuid": "^8.3.2"
},
"devDependencies": {
"@skyway-sdk/token": "^0.2.0-beta.0"
}
}

@@ -338,2 +338,17 @@ # Room

### MediaStreamTrack から AudioStream / VideoStream を作成する
任意の MediaStreamTrack から Stream を作成することが出来ます。
```ts
const displayStream = await navigator.mediaDevices.getDisplayMedia();
const [displayTrack] = displayStream.getVideoTracks();
const stream = new LocalVideoStream('label', displayTrack);
const [audioTrack] = (
await navigator.mediaDevices.getUserMedia({ audio: true })
).getTracks();
const stream = new LocalAudioStream('label', audioTrack);
```
### AudioStream / VideoStream の利用方法

@@ -340,0 +355,0 @@

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 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