Skip to content

Commit

Permalink
Merge pull request #499 from shiguredo/feature/remove-lyra-support
Browse files Browse the repository at this point in the history
オーディオコーデック LYRA のサポートを削除する
  • Loading branch information
tnamao authored Mar 7, 2024
2 parents 32fc31a + 0adb720 commit fa443e0
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 828 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

## develop

- [CHANGE] オーディオコーデック `LYRA` のサポートを削除する
- @tnamao
- [CHANGE] シグナリングオプションの `multistream` は false の時のみレガシーストリームを使用する
- レガシーストリームを使用したい場合は `multistream: false` の指定が必須となる
- @tnamao
Expand Down
96 changes: 31 additions & 65 deletions examples/check.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,7 @@ <h4>sendrecv, Opus</h4>
<h4>recvonly</h4>
<div id="multistream-recvonly-videos" class="multistream"></div>

<h2><u>チャネル ID: sora-js-sdk:check:multistream:lyra</u></h2>

要確認ブラウザ:
<ul>
<li>Chrome / Edge: (Linux or macOS or Windows) and Android</li>
<li>Safari: macOS and iOS</li>
</ul>

<button onclick="startMultistreamLyraCheck()">接続</button>
<button onclick="stopMultistreamLyraCheck()">切断</button>

<h4>multistream, sendrecv, Opus</h4>
<div id="multistream-lyra-sendrecv-opus-videos" class="multistream-lyra"></div>

<h4>multistream, sendrecv, Lyra</h4>
<div id="multistream-lyra-sendrecv-lyra-videos" class="multistream-lyra"></div>

<h4>multistream, recvonly</h4>
<div id="multistream-lyra-recvonly-videos" class="multistream-lyra"></div>

<h2><u>チャネル ID: sora-js-sdk:check:multistream:e2ee:lyra</u></h2>
<h2><u>チャネル ID: sora-js-sdk:check:multistream:e2ee:opus</u></h2>

要確認ブラウザ:
<ul>
Expand All @@ -86,19 +66,19 @@ <h2><u>チャネル ID: sora-js-sdk:check:multistream:e2ee:lyra</u></h2>

現在は E2EE は1ページ1コネクションまでなので、以下のパターンを別々のページで実行すること。
<h4>multistream, E2EE, sendrecv, Opus</h4>
<button onclick="startMultistreamE2eeLyraCheck('multistream-e2ee-lyra-sendrecv-opus-videos', 'sendrecv', 'OPUS')">接続</button>
<button onclick="stopMultistreamE2eeLyraCheck()">切断</button><br />
<div id="multistream-e2ee-lyra-sendrecv-opus-videos" class="multistream-e2ee-lyra"></div>
<button onclick="startMultistreamE2eeOpusCheck('multistream-e2ee-opus-sendrecv-opus-videos', 'sendrecv', 'OPUS')">接続</button>
<button onclick="stopMultistreamE2eeOpusCheck()">切断</button><br />
<div id="multistream-e2ee-opus-sendrecv-opus-videos" class="multistream-e2ee-opus"></div>

<h4>multistream, E2EE, sendrecv, Lyra</h4>
<button onclick="startMultistreamE2eeLyraCheck('multistream-e2ee-lyra-sendrecv-lyra-videos', 'sendrecv', 'OPUS')">接続</button>
<button onclick="stopMultistreamE2eeLyraCheck()">切断</button><br />
<div id="multistream-e2ee-lyra-sendrecv-lyra-videos" class="multistream-e2ee-lyra"></div>
<h4>multistream, E2EE, sendrecv, Opus</h4>
<button onclick="startMultistreamE2eeOpusCheck('multistream-e2ee-opus-sendrecv-opus-videos', 'sendrecv', 'OPUS')">接続</button>
<button onclick="stopMultistreamE2eeOpusCheck()">切断</button><br />
<div id="multistream-e2ee-opus-sendrecv-opus-videos" class="multistream-e2ee-opus"></div>

<h4>multistream, E2EE, recvonly</h4>
<button onclick="startMultistreamE2eeLyraCheck('multistream-e2ee-lyra-recvonly-videos', 'recvonly')">接続</button>
<button onclick="stopMultistreamE2eeLyraCheck()">切断</button><br />
<div id="multistream-e2ee-lyra-recvonly-videos" class="multistream-e2ee-lyra"></div>
<button onclick="startMultistreamE2eeOpusCheck('multistream-e2ee-opus-recvonly-videos', 'recvonly')">接続</button>
<button onclick="stopMultistreamE2eeOpusCheck()">切断</button><br />
<div id="multistream-e2ee-opus-recvonly-videos" class="multistream-e2ee-opus"></div>
</div>

<script src="./sora.js"></script>
Expand All @@ -121,44 +101,40 @@ <h4>multistream, E2EE, recvonly</h4>
document.getElementById('signalingUrl').value = searchParams.get('signalingUrl');
}

let multistreamE2eeLyraCheckConnections = [];
async function startMultistreamE2eeLyraCheck(videoId, role, audioCodecType) {
stopMultistreamE2eeLyraCheck();
let multistreamE2eeOpusCheckConnections = [];
async function startMultistreamE2eeOpusCheck(videoId, role, audioCodecType) {
stopMultistreamE2eeOpusCheck();
await Sora.initE2EE("https://sora-e2ee-wasm.shiguredo.app/2020.2/wasm.wasm");
initLyra();

const channelId = 'sora-js-sdk:check:multistream:e2ee:lyra';
multistreamE2eeLyraCheckConnections = [
const channelId = 'sora-js-sdk:check:multistream:e2ee:opus';
multistreamE2eeOpusCheckConnections = [
await connect(channelId, videoId, role, {multistream: true, e2ee: true, audioCodecType})
];
}

function stopMultistreamE2eeLyraCheck() {
multistreamE2eeLyraCheckConnections.forEach(x => x.disconnect());
multistreamE2eeLyraCheckConnections = [];
document.querySelectorAll('.multistream-e2ee-lyra').forEach(x => x.innerHTML = null);
function stopMultistreamE2eeOpusCheck() {
multistreamE2eeOpusCheckConnections.forEach(x => x.disconnect());
multistreamE2eeOpusCheckConnections = [];
document.querySelectorAll('.multistream-e2ee-opus').forEach(x => x.innerHTML = null);
}

let multistreamLyraCheckConnections = [];
async function startMultistreamLyraCheck() {
stopMultistreamLyraCheck();
initLyra();
let multistreamOpusCheckConnections = [];
async function startMultistreamOpusCheck() {
stopMultistreamOpusCheck();

const channelId = 'sora-js-sdk:check:multistream:lyra';
multistreamLyraCheckConnections = [
await connect(channelId, 'multistream-lyra-sendrecv-opus-videos', 'sendrecv',
const channelId = 'sora-js-sdk:check:multistream:opus';
multistreamOpusCheckConnections = [
await connect(channelId, 'multistream-opus-sendrecv-opus-videos', 'sendrecv',
{multistream: true, audioCodecType: "OPUS"}),
await connect(channelId, 'multistream-lyra-sendrecv-lyra-videos', 'sendrecv',
{multistream: true, audioCodecType: "LYRA"}),
await connect(channelId, 'multistream-lyra-recvonly-videos', 'recvonly',
await connect(channelId, 'multistream-opus-recvonly-videos', 'recvonly',
{multistream: true}),
];
}

function stopMultistreamLyraCheck() {
multistreamLyraCheckConnections.forEach(x => x.disconnect());
multistreamLyraCheckConnections = [];
document.querySelectorAll('.multistream-lyra').forEach(x => x.innerHTML = null);
function stopMultistreamOpusCheck() {
multistreamOpusCheckConnections.forEach(x => x.disconnect());
multistreamOpusCheckConnections = [];
document.querySelectorAll('.multistream-opus').forEach(x => x.innerHTML = null);
}

let multistreamCheckConnections = [];
Expand All @@ -169,10 +145,6 @@ <h4>multistream, E2EE, recvonly</h4>
multistreamCheckConnections.push(
await connect(channelId, 'multistream-sendrecv-videos', 'sendrecv', {multistream: true}));

// Lyra が使えない環境で Lyra 用の初期化処理が悪影響を与えないことを確認するために
// ここで initLyra() を呼び出しておく。
initLyra();

multistreamCheckConnections.push(
await connect(channelId, 'multistream-recvonly-videos', 'recvonly', {multistream: true}));
}
Expand Down Expand Up @@ -202,12 +174,6 @@ <h4>multistream, E2EE, recvonly</h4>
document.querySelectorAll('.legacystream').forEach(x => x.innerHTML = null);
}

function initLyra() {
const modelPath = "https://lyra-wasm.shiguredo.app/2023.1.0/";
const wasmPath = modelPath;
Sora.initLyra({wasmPath, modelPath});
}

async function connect(channelId, videoId, role, options) {
const debug = false;
const signalingUrl = document.querySelector('#signalingUrl').value;
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-replace": "5.0.5",
"@rollup/plugin-typescript": "11.1.6",
"@shiguredo/lyra-wasm": "2023.1.0",
"jsdom": "24.0.0",
"rollup": "4.12.0",
"rollup-plugin-delete": "2.0.0"
Expand Down
52 changes: 16 additions & 36 deletions packages/sdk/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import fs from "fs";
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import replace from '@rollup/plugin-replace';
import del from "rollup-plugin-delete";
import pkg from '../../package.json';
import commonjs from '@rollup/plugin-commonjs'
import resolve from '@rollup/plugin-node-resolve'
import replace from '@rollup/plugin-replace'
import typescript from '@rollup/plugin-typescript'
import del from 'rollup-plugin-delete'
import pkg from '../../package.json'

const banner = `/**
* ${pkg.name}
Expand All @@ -13,36 +12,19 @@ const banner = `/**
* @author: ${pkg.author}
* @license: ${pkg.license}
**/
`;
`

export default [
{
input: 'src/lyra_worker.ts',
plugins: [
resolve(),
typescript({
tsconfig: './tsconfig.json'
}),
commonjs(),
],
output: {
sourcemap: false,
file: './tmp/lyra_worker.js',
format: 'umd',
}
},
{
input: 'src/sora.ts',
plugins: [
replace({
__SORA_JS_SDK_VERSION__: pkg.version,
__LYRA_WORKER_SCRIPT__: () => fs.readFileSync("./tmp/lyra_worker.js", "base64"),
preventAssignment: true
preventAssignment: true,
}),
resolve(),
typescript({
tsconfig: './tsconfig.json',
exclude: 'src/lyra_worker.ts',
}),
commonjs(),
],
Expand All @@ -51,34 +33,32 @@ export default [
file: '../../dist/sora.js',
format: 'umd',
name: 'Sora',
banner: banner
}
banner: banner,
},
},
{
input: 'src/sora.ts',
plugins: [
replace({
__SORA_JS_SDK_VERSION__: pkg.version,
__LYRA_WORKER_SCRIPT__: () => fs.readFileSync("./tmp/lyra_worker.js", "base64"),
preventAssignment: true
preventAssignment: true,
}),
resolve(),
typescript({
tsconfig: './tsconfig.json',
exclude: 'src/lyra_worker.ts',
}),
commonjs(),
del({
targets: './tmp/',
hook: 'buildEnd'
hook: 'buildEnd',
}),
],
output: {
sourcemap: false,
file: '../../dist/sora.mjs',
format: 'module',
name: 'Sora',
banner: banner
}
}
];
banner: banner,
},
},
]
Loading

0 comments on commit fa443e0

Please sign in to comment.