Skip to content

Commit

Permalink
Merge branch 'release/2022.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuki Ito committed Jun 22, 2022
2 parents 7572fc6 + 0ade5a2 commit 4a1d142
Show file tree
Hide file tree
Showing 42 changed files with 5,322 additions and 4,646 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
70 changes: 70 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ develop ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ develop ]
schedule:
- cron: '41 3 * * 2'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
27 changes: 27 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,33 @@
- FIX
- バグ修正

## 2022.1.0
- [CHANGE] 切断処理時に MediaStream の停止処理をしないように変更する
- @yuitowest
- [CHANGE] ConnectionOptions からシグナリング type: connect メッセージを生成する仕組みを変更する
- multistream オプションが false の場合、シグナリングメッセージに multistream: false を含めるように変更する
- spotlight オプションは multistream: true の場合のみシグナリングメッセージに含まれていたが、multistream フラグに関係なく含まれるように変更する
- spotlightFocusRid オプションは spotlight: true の場合のみシグナリングメッセージに含まれていたが、spotlight フラグに関係なく含まれるように変更する
- spotlightUnfocusRid オプションは spotlight: true の場合のみシグナリングメッセージに含まれていたが、spotlight フラグに関係なく含まれるように変更する
- spotlightNumber オプションは spotlight: true の場合のみシグナリングメッセージに含まれていたが、spotlight フラグに関係なく含まれるように変更する
- simulcastRid オプションは simulcast: true の場合のみシグナリングメッセージに含まれていたが、simulcast フラグに関係なく含まれるように変更する
- @yuitowest
- [ADD] sendrecv オブジェクトのオプションに bundle_id を追加する
- @yuitowest
- [UPDATE] sendrecv API を使用して接続する場合に multistream option の初期値が true になるよう修正する
- @yuitowest
- [UPDATE] sendrecv API を使用して multistream: false で接続した場合、Sora との接続前に例外が発生するように修正する
- @yuitowest
- [UPDATE] パッケージを更新する
- fflate "0.7.1" -> "0.7.2"
- typescript "4.4.3" -> "4.5.4"
- @yuitowest
- [CHANGE] connectedSignalingUrl は現在接続中の WebSocket の URL ではなく type offer メッセージを受信した URL を返すようにする
- ignoreDisconnectWebSocket を使用して WebSocket を切断した場合にも URL を返すように修正する
- @yuitowest
- [UPDATE] SendRecv オブジェクト に contactSignalingUrl プロパティを追加する
- @yuitowest

## 2021.2.3
- [FIX] メッセージング機能で文字列データが送信されてきた場合にそのまま message callback に渡していた問題を修正する
- @yuitowest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Please read https://github.com/shiguredo/oss before use.

## システム条件

- WebRTC SFU Sora 2021.1 以降
- WebRTC SFU Sora 2022.1 以降
- TypeScript 3.8 以降

## サンプル
Expand Down
5 changes: 3 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
- npm run test を実行する
- npm run release:canary を実行する
- Next version を確認する
- コミットメッセージをバージョンにして差分をコミットする(例. git commit -m "2020.1.0-canary.0")
- git push -u origin develop master
- git commit をするか聞かれるので確認して yes を選択する
- git tag をするか聞かれるので確認して yes を選択する
- git push -u origin develop
- git push origin <tag>
- npm publish --tag canary を実行する
19 changes: 8 additions & 11 deletions dist/base.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ export default class ConnectionBase {
* サイマルキャストで使用する RTCRtpEncodingParameters のリスト
*/
encodings: RTCRtpEncodingParameters[];
/**
* WS シグナリングで type offer メッセージを受信したシグナリング URL
*/
connectedSignalingUrl: string;
/**
* WS シグナリングで最初に type connect を送信したシグナリング URL
*/
contactSignalingUrl: string;
/**
* WebSocket インスタンス
*/
Expand Down Expand Up @@ -231,10 +239,6 @@ export default class ConnectionBase {
* @public
*/
replaceVideoTrack(stream: MediaStream, videoTrack: MediaStreamTrack): Promise<void>;
/**
* stream を停止するメソッド
*/
private stopStream;
/**
* connect 処理中に例外が発生した場合の切断処理をするメソッド
*/
Expand Down Expand Up @@ -452,9 +456,6 @@ export default class ConnectionBase {
/**
* createOffer 処理をするメソッド
*
* @param eventType - イベントタイプ
* @param data - イベントデータ
*
* @returns
* 生成した RTCSessionDescription を返します
*/
Expand Down Expand Up @@ -595,10 +596,6 @@ export default class ConnectionBase {
* @deprecated
*/
get signalingUrl(): string | string[];
/**
* 接続中のシグナリング URL
*/
get connectedSignalingUrl(): string;
/**
* DataChannel メッセージング用の DataChannel 情報のリスト
*/
Expand Down
6 changes: 3 additions & 3 deletions dist/sora.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ declare class SoraConnection {
*/
get signalingUrl(): string | string[];
}
/**
* Sora JS SDK package
*/
declare const _default: {
/**
* E2EE で使用する WASM の読み込みを行うメソッド
Expand Down Expand Up @@ -127,8 +130,5 @@ declare const _default: {
applyMediaStreamConstraints: typeof applyMediaStreamConstraints;
};
};
/**
* Sora JS SDK package
*/
export default _default;
export type { AudioCodecType, Callbacks, ConnectionBase, ConnectionOptions, ConnectionPublisher, ConnectionSubscriber, DataChannelConfiguration, DataChannelDirection, DataChannelEvent, DataChannelMessageEvent, JSONType, Role, SignalingEvent, SignalingNotifyConnectionCreated, SignalingNotifyConnectionDestroyed, SignalingNotifyConnectionUpdated, SignalingNotifyMessage, SignalingNotifyMetadata, SignalingNotifyNetworkStatus, SignalingNotifySpotlightChanged, SignalingNotifySpotlightFocused, SignalingNotifySpotlightUnfocused, SignalingPushMessage, Simulcast, SimulcastRid, SoraAbendTitle, SoraCloseEvent, SoraCloseEventInitDict, SoraCloseEventType, SoraConnection, SpotlightFocusRid, TimelineEvent, TimelineEventLogType, TransportType, VideoCodecType, };
282 changes: 143 additions & 139 deletions dist/sora.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/sora.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/sora.min.js.map

Large diffs are not rendered by default.

282 changes: 143 additions & 139 deletions dist/sora.mjs

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions dist/subscriber.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,15 @@ export default class ConnectionSubscriber extends ConnectionBase {
* await recvonly.connect();
* ```
*
* @param stream - メディアストリーム
*
* @public
*/
connect(): Promise<MediaStream | void>;
/**
* シングルストリームで Sora へ接続するメソッド
*
* @param stream - メディアストリーム
*/
private singleStream;
/**
* マルチストリームで Sora へ接続するメソッド
*
* @param stream - メディアストリーム
*/
private multiStream;
}
3 changes: 3 additions & 0 deletions dist/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export declare type SignalingConnectMessage = {
role: Role;
channel_id: string;
client_id?: string;
bundle_id?: string;
metadata?: JSONType;
signaling_notify_metadata?: JSONType;
multistream?: boolean;
Expand Down Expand Up @@ -73,6 +74,7 @@ export declare type SignalingOfferMessage = {
sdp: string;
client_id: string;
connection_id: string;
bundle_id?: string;
metadata?: JSONType;
config?: RTCConfiguration;
encodings?: RTCRtpEncodingParameters[];
Expand Down Expand Up @@ -248,6 +250,7 @@ export declare type ConnectionOptions = {
disconnectWaitTimeout?: number;
signalingCandidateTimeout?: number;
dataChannels?: DataChannelConfiguration[];
bundleId?: string;
};
export declare type Callbacks = {
disconnect: (event: SoraCloseEvent) => void;
Expand Down
1 change: 1 addition & 0 deletions dist/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ export declare function createDataChannelData(channel: RTCDataChannel): Record<s
export declare function createTimelineEvent(eventType: string, data: unknown, logType: TimelineEventLogType, dataChannelId?: number | null, dataChannelLabel?: string): TimelineEvent;
export declare function createDataChannelMessageEvent(label: string, data: ArrayBuffer): DataChannelMessageEvent;
export declare function createDataChannelEvent(channel: DataChannelConfiguration): DataChannelEvent;
export declare function parseDataChannelEventData(eventData: unknown, compress: boolean): string;
99 changes: 99 additions & 0 deletions example/e2ee.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<html lang="ja">
<head>
<meta charset="utf-8">
<title>E2EE test</title>
</head>
<body>
<div class="container">
<h1>E2EE test</h1>
<p id="error-message" style="color: red;"></p>
<div style="display: flex;">
<div>
<h2>local</h2>
<button id="start-sendrecv">start</button>
<button id="stop-sendrecv">stop</button><br />
<p id="local-connection-id"></p>
<p id="local-fingerprint"></p>
<video id="sendrecv-local-video" autoplay="" playsinline="" controls="" style="width: 320px; height: 240px; border: 1px solid black;"></video>

<h2>remote</h2>
<div id="sendrecv-remote-videos"></div>
</div>
</div>
</div>

<script src="./sora.js"></script>
<script type="text/javascript">
const channelId = 'Sora';
const debug = false;
Sora.initE2EE("https://sora-e2ee-wasm.shiguredo.jp/2020.2/wasm.wasm").catch((e) => {
document.querySelector("#error-message").textContent = "E2EE用 wasm ファイルの読み込みに失敗しました";
});
const sora = Sora.connection('ws://127.0.0.1:5000/signaling', debug);
const sendrecv = sora.sendrecv(channelId, null, {
multistream: true,
e2ee: true
});
sendrecv.on('track', (event) => {
const stream = event.streams[0];
if (!stream) return;
const remoteVideoBoxId = 'remote-video-box-' + stream.id;
const remoteVideos = document.querySelector('#sendrecv-remote-videos');
if (!remoteVideos.querySelector('#' + remoteVideoBoxId)) {
const remoteVideoBox = document.createElement('div');
remoteVideoBox.id = remoteVideoBoxId;
const connectionIdElement = document.createElement('p');
connectionIdElement.id = remoteVideoBoxId + "-connection-id";
connectionIdElement.textContent = 'connectionId: ' + stream.id;
remoteVideoBox.appendChild(connectionIdElement);
const fingerprintElement = document.createElement('p');
fingerprintElement.id = remoteVideoBoxId + "-fingerprint";
remoteVideoBox.appendChild(fingerprintElement);
const remoteVideo = document.createElement('video');
remoteVideo.style.border = '1px solid red';
remoteVideo.autoplay = true;
remoteVideo.playsinline = true;
remoteVideo.controls = true;
remoteVideo.width = '160';
remoteVideo.height = '120';
remoteVideo.srcObject = stream;
remoteVideoBox.appendChild(remoteVideo);
remoteVideos.appendChild(remoteVideoBox);
}
});
sendrecv.on('removetrack', (event) => {
const remoteVideo = document.querySelector('#remote-video-box-' + event.target.id);
if (remoteVideo) {
document.querySelector('#sendrecv-remote-videos').removeChild(remoteVideo);
}
});
sendrecv.on('notify', (event) => {
if (event.event_type === "connection.created") {
const remoteFingerprints = sendrecv.e2eeRemoteFingerprints;
Object.keys(remoteFingerprints).forEach((connectionId) => {
const fingerprintElement = document.querySelector('#remote-video-box-' + connectionId + '-fingerprint');
if (fingerprintElement) {
fingerprintElement.textContent = "fingerprint: " + remoteFingerprints[connectionId];
}
});
}
});

document.querySelector('#start-sendrecv').addEventListener('click', async () => {
const mediaStream = await navigator.mediaDevices.getUserMedia({audio: true, video: true})
await sendrecv.connect(mediaStream);
document.querySelector('#local-connection-id').textContent = "connectionId: " + sendrecv.connectionId;
document.querySelector('#local-fingerprint').textContent = "fingerprint: " + sendrecv.e2eeSelfFingerprint;
document.querySelector('#sendrecv-local-video').srcObject = mediaStream;
});

document.querySelector('#stop-sendrecv').addEventListener('click', () => {
sendrecv.disconnect()
.then(function() {
document.querySelector('#sendrecv-local-video').srcObject = null;
document.querySelector('#sendrecv-remote-videos').innerHTML = null;
});
});
</script>
</body>
</html>
9 changes: 4 additions & 5 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
<body>
<div class="container">
<ul>
<li><a href="sendonly_recvonly.html">配信/視聴サンプル</a></li>
<li><a href="multistream_sendrecv.html">マルチストリーム配信視聴サンプル</a></li>
<li><a href="multistream_sendonly.html">マルチストリーム配信サンプル</a></li>
<li><a href="multistream_recvonly.html">マルチストリーム視聴サンプル</a></li>
<li><a href="multistream_sendrecv_e2ee.html">マルチストリームE2EE配信視聴サンプル</a></li>
<li><a href="sendrecv.html">配信視聴サンプル</a></li>
<li><a href="sendonly.html">配信サンプル</a></li>
<li><a href="recvonly.html">視聴サンプル</a></li>
<li><a href="e2ee.html">E2EE配信視聴サンプル</a></li>
<li><a href="spotlight_sendrecv.html">スポットライト配信視聴サンプル</a></li>
<li><a href="spotlight_recvonly.html">スポットライト視聴サンプル</a></li>
<li><a href="simulcast.html">サイマルキャスト配信/視聴サンプル</a></li>
Expand Down
Loading

0 comments on commit 4a1d142

Please sign in to comment.