Skip to content

Commit

Permalink
v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyoshiaki committed Jun 2, 2023
1 parent 3310df5 commit 3bf2591
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 52 deletions.
8 changes: 4 additions & 4 deletions THIRD_PARTY_LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@skyway-sdk/[email protected].3
@skyway-sdk/[email protected].4

MIT

Expand Down Expand Up @@ -29,7 +29,7 @@ SOFTWARE.

---

@skyway-sdk/core@1.3.0
@skyway-sdk/core@1.4.0

MIT

Expand Down Expand Up @@ -68,7 +68,7 @@ MIT

---

@skyway-sdk/room@1.3.0
@skyway-sdk/room@1.4.0

MIT

Expand Down Expand Up @@ -192,7 +192,7 @@ SOFTWARE.

---

@skyway-sdk/sfu-bot@1.3.0
@skyway-sdk/sfu-bot@1.4.0

MIT

Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@skyway-sdk/common",
"version": "1.2.3",
"version": "1.2.4",
"description": "The official Next Generation JavaScript SDK for SkyWay",
"homepage": "https://skyway.ntt.com/",
"repository": {
Expand Down
16 changes: 14 additions & 2 deletions packages/common/src/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ export class Event<T extends any> {
const timeout =
timeLimit &&
setTimeout(() => {
reject('Event asPromise timeout : ' + timeLimit);
reject(
new SerializableError('Event asPromise timeout : ' + timeLimit)
);
}, timeLimit);
this.once((arg) => {
if (timeout) clearTimeout(timeout);
Expand All @@ -95,7 +97,7 @@ export class Event<T extends any> {
const timeout =
timeLimit &&
setTimeout(() => {
reject('Event watch timeout : ' + timeLimit);
reject(new SerializableError('Event watch timeout : ' + timeLimit));
}, timeLimit);

const { removeListener } = this.add((arg) => {
Expand Down Expand Up @@ -143,3 +145,13 @@ export class EventDisposer {
this._disposer = [];
}
}

class SerializableError extends Error {
toJSON() {
return {
name: this.name,
message: this.message,
stack: this.stack,
};
}
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@skyway-sdk/core",
"version": "1.3.0",
"version": "1.4.0",
"description": "The official Next Generation JavaScript SDK for SkyWay",
"homepage": "https://skyway.ntt.com/",
"repository": {
Expand Down
58 changes: 32 additions & 26 deletions packages/core/src/media/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,30 +158,31 @@ export class StreamFactory {
/**
* @description [japanese]
* PCブラウザでのみ利用可能なAPI。
* ディスプレイのVideoStreamとオプションとしてAudioStreamを作成する。
* AudioStreamはWindowsのChromeでしか取得できない。
* VideoStreamは常に取得される(AudioStreamのみ取得することはできない)
* audioオプションを有効にするとAudioStreamを取得することができる。
* audioオプションはWindowsのChromeにしか対応しておらず、
* それ以外の環境では有効にしても戻り値のaudioにはundefinedが返される。
*/
async createDisplayStreams(options: {
audio?:
| boolean
| (AudioMediaTrackConstraints & Partial<LocalMediaStreamOptions>);
/**default enable */
video?: DisplayMediaTrackConstraints &
VideoMediaTrackConstraints &
Partial<LocalMediaStreamOptions>;
}) {
async createDisplayStreams<T extends DisplayStreamOptions>(
options: T = {} as T
): Promise<{
video: LocalVideoStream;
audio: T extends { audio: infer U }
? U extends false | undefined | null
? undefined
: LocalAudioStream | undefined
: undefined;
}> {
const videoOption = options.video ?? {};
videoOption.stopTrackWhenDisabled =
videoOption.stopTrackWhenDisabled ?? true;
videoOption.stopTrackWhenDisabled ??= true;

let audioOption = options.audio;
if (audioOption) {
audioOption = {};
audioOption.stopTrackWhenDisabled =
audioOption.stopTrackWhenDisabled ?? true;
audioOption = typeof audioOption === 'boolean' ? {} : audioOption;
audioOption.stopTrackWhenDisabled ??= true;
}

options = { audio: audioOption, video: videoOption };
options = { audio: audioOption, video: videoOption } as T;

const stream = await navigator.mediaDevices.getDisplayMedia(options);
const [video] = stream.getVideoTracks();
Expand All @@ -197,13 +198,14 @@ export class StreamFactory {
}

const videoStream = new LocalVideoStream(video, {
...options.video,
...videoOption,
isDisplayMedia: true,
});
videoStream._setLabel('displayVideo');

const audioStream = audio
? new LocalAudioStream(audio, {
...(typeof options.audio === 'boolean' ? {} : options.audio),
...audioOption,
isDisplayMedia: true,
})
: undefined;
Expand All @@ -213,7 +215,7 @@ export class StreamFactory {

return {
video: videoStream,
audio: audioStream,
audio: audioStream as any,
};
}

Expand Down Expand Up @@ -320,9 +322,13 @@ export type DisplayMediaTrackConstraints = VideoMediaTrackConstraints & {
// cursor?: CursorNever | CursorAlways | CursorMotion;
};

/** @description [japanese] キャプチャーしたディスプレイからカーソルを含まない。 */
// export type CursorNever = 'never';
/** @description [japanese] キャプチャーしたディスプレイからカーソルを含む。 */
// export type CursorAlways = 'always';
/** @description [japanese] カーソル/ポインタが動かされたとき、画面内のカーソルを含む。カーソルは、ある期間カーソルの更なる動きがないときに削除される。 */
// export type CursorMotion = 'motion';
export type DisplayStreamOptions = {
audio?:
| (AudioMediaTrackConstraints &
Partial<Pick<LocalMediaStreamOptions, 'stopTrackWhenDisabled'>>)
| boolean;
video?:
| DisplayMediaTrackConstraints &
VideoMediaTrackConstraints &
Partial<Pick<LocalMediaStreamOptions, 'stopTrackWhenDisabled'>>;
};
2 changes: 1 addition & 1 deletion packages/core/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const PACKAGE_VERSION = '1.3.0';
export const PACKAGE_VERSION = '1.4.0';
6 changes: 3 additions & 3 deletions packages/room/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@skyway-sdk/room",
"version": "1.3.0",
"version": "1.4.0",
"description": "The official Next Generation JavaScript SDK for SkyWay",
"homepage": "https://skyway.ntt.com/",
"repository": {
Expand Down Expand Up @@ -45,8 +45,8 @@
"watch:tsc": "tsc -p tsconfig.build.json -w"
},
"dependencies": {
"@skyway-sdk/core": "^1.3.0",
"@skyway-sdk/sfu-bot": "^1.3.0",
"@skyway-sdk/core": "^1.4.0",
"@skyway-sdk/sfu-bot": "^1.4.0",
"uuid": "^9.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/room/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const PACKAGE_VERSION = '1.3.0';
export const PACKAGE_VERSION = '1.4.0';
4 changes: 2 additions & 2 deletions packages/sfu-bot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@skyway-sdk/sfu-bot",
"version": "1.3.0",
"version": "1.4.0",
"description": "The official Next Generation JavaScript SDK for SkyWay",
"homepage": "https://skyway.ntt.com/",
"repository": {
Expand Down Expand Up @@ -41,7 +41,7 @@
"watch:tsc": "tsc -p tsconfig.build.json -w"
},
"dependencies": {
"@skyway-sdk/core": "^1.3.0",
"@skyway-sdk/core": "^1.4.0",
"@skyway-sdk/sfu-api-client": "^1.2.3",
"lodash": "4.17.21",
"mediasoup-client": "3.6.82"
Expand Down
2 changes: 1 addition & 1 deletion packages/sfu-bot/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const PACKAGE_VERSION = '1.3.0';
export const PACKAGE_VERSION = '1.4.0';

0 comments on commit 3bf2591

Please sign in to comment.