diff --git a/.codacy/cli.sh b/.codacy/cli.sh
index 7057e3b..8a3e679 100755
--- a/.codacy/cli.sh
+++ b/.codacy/cli.sh
@@ -59,6 +59,20 @@ get_latest_version() {
echo "$version"
}
+get_latest_cached_version() {
+ if [ -d "$CODACY_CLI_V2_TMP_FOLDER" ]; then
+ # Pick the highest version folder already present on disk.
+ # This is used as a fallback when the GitHub API is unavailable and the cache is populated.
+ local cached
+ cached=$(ls -1 "$CODACY_CLI_V2_TMP_FOLDER" 2>/dev/null | grep -v '^version\.yaml$' | sort -V | tail -n 1)
+ if [ -n "$cached" ]; then
+ echo "$cached"
+ return 0
+ fi
+ fi
+ return 1
+}
+
handle_rate_limit() {
local response="$1"
if echo "$response" | grep -q "API rate limit exceeded"; then
@@ -123,7 +137,18 @@ fi
if [ -n "$CODACY_CLI_V2_VERSION" ]; then
version="$CODACY_CLI_V2_VERSION"
else
- version=$(get_version_from_yaml)
+ version=$(get_version_from_yaml || true)
+ if [ -z "$version" ]; then
+ # version.yaml can be left with an empty version when the GitHub API call fails.
+ # Fall back to any already cached version first; if none exists, fetch latest.
+ version=$(get_latest_cached_version || true)
+ if [ -z "$version" ]; then
+ echo "ℹ️ Fetching latest version..."
+ version=$(get_latest_version)
+ fi
+ mkdir -p "$CODACY_CLI_V2_TMP_FOLDER"
+ echo "version: \"$version\"" > "$version_file"
+ fi
fi
diff --git a/.codacy/codacy.yaml b/.codacy/codacy.yaml
index 15365c7..0208f94 100644
--- a/.codacy/codacy.yaml
+++ b/.codacy/codacy.yaml
@@ -1,15 +1,4 @@
-runtimes:
- - dart@3.7.2
- - go@1.22.3
- - java@17.0.10
- - node@22.2.0
- - python@3.11.11
tools:
- - dartanalyzer@3.7.2
- - eslint@8.57.0
- - lizard@1.17.31
- - pmd@7.11.0
- - pylint@3.3.6
- - revive@1.7.0
- - semgrep@1.78.0
- trivy@0.66.0
+ - semgrep@1.78.0
+7.2
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..5929935
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+*.sh text eol=lf
+*.bash text eol=lf
\ No newline at end of file
diff --git a/.github/github_copilot_instructions.md b/.github/github_copilot_instructions.md
new file mode 100644
index 0000000..c130e72
--- /dev/null
+++ b/.github/github_copilot_instructions.md
@@ -0,0 +1,182 @@
+# GitHub Copilot Instructions
+
+> Datei: `.github/copilot-instructions.md`
+
+## Zweck
+Diese Datei gibt GitHub Copilot (inkl. Copilot Chat) repository‑weite Hinweise, wie Vorschläge, Code‑Snippets und Antworten formuliert werden sollen. Sie ist auf ein Multi‑Language‑Projekt ausgelegt: **C/C++**, **Rust**, **Dart/Flutter** (plus Hinweise zu `uv`‑basierten I/O‑Bindings), sowie generelle Tools wie **ruff**. Ziel ist konsistente Code‑Qualität, starke Typisierung und sichere Vorschläge.
+
+Hinweis: In diesem Dokument meint „**uv**“ in zwei Kontexten unterschiedliche Dinge:
+- **Python `uv`** = Package Manager/Runner.
+- **libuv** = native I/O‑Library (siehe Abschnitt zu libuv‑Bindings).
+
+---
+
+## Kurze Zusammenfassung / About
+Dieses Repository enthält native Komponenten (C/C++), Rust‑Bibliotheken, und eine Flutter‑UI (Dart). Der Fokus liegt auf Performance, Cross‑Language Interop, deterministischem Verhalten und starker Typisierung.
+
+---
+
+## Repository‑Scope
+- **Behandeln mit Vorrang:** `src/`, `lib/`, `rust/`, `flutter/`, `native/`, `include/`, `tests/`.
+- **Ignorieren / nur mit Vorsicht ändern:** `third_party/`, `vendor/`, `build/`, `artifacts/`.
+- **CI/Infra:** Vorschläge für CI (z. B. GitHub Actions) nur wenn klarer Nutzen erkennbar; keine ungeprüften Änderungen an Workflows ohne Review.
+
+---
+
+## Personality / Ton
+- Sprache: Deutsch (bei technischen Kommentaren kurze englische Code‑Begriffe ok).
+- Ton: Präzise, technisch, knapp. 1–3 Sätze Erklärung plus minimaler Beispielcode, wenn nötig.
+- Umfang: Bei trivialen Änderungen kurz; bei Architektur/Interop ausführlicher (aber nicht ausschweifend).
+
+---
+
+## Starke Typisierung (allgemein)
+- Priorisiere klar typisierte Lösungen:
+ - **C/C++:** explizite Typen, keine zu weiten `auto`‑Verwendungen an API‑Borders.
+ - **Rust:** Typinferenz nutzen, aber Signaturen und `Result`/`Option`-Fehlerpfade explizit behandeln.
+ - **Dart:** Null‑Safety strikt beachten, Typannotationen für öffentliche API‑Signaturen.
+- Copilot soll Typannotation vorschlagen, falls weggelassen.
+
+### Type‑Safety‑Policy (maximal)
+- Öffentliche APIs (inkl. FFI‑Grenzen) müssen vollständig typisiert sein; keine „untyped“ Escape‑Hatches (`void*`, `dynamic`, „Any“) ohne Begründung.
+- Fehlerpfade müssen typisiert sein (z. B. `Result`/`Option`, `std::optional`/Fehlercode, Dart Exceptions nur wenn idiomatisch).
+- Narrowing/implizite Konvertierungen vermeiden; bevorzugt explizite Casts und Wrapper‑Typen.
+- Wenn Tooling/Compiler das hergeben: Warnings werden in CI als Errors behandelt.
+
+---
+
+## Code Style & Tooling
+**C/C++**
+- Target standard: **C++20**.
+- Build‑System‑Policy (falls CMake): `CMAKE_CXX_STANDARD=20`, `CMAKE_CXX_STANDARD_REQUIRED=ON`, `CMAKE_CXX_EXTENSIONS=OFF`.
+- Format: `clang-format` (Repo‑konfiguration verwenden). Vorschläge müssen `clang-format`-konform sein.
+- Lints: `clang-tidy` Empfehlungen sind willkommen; vermeide invasive API‑Änderungen.
+- Type‑Safety bevorzugen:
+ - Keine Ownership über rohe Pointer: RAII (`std::unique_ptr`, `std::shared_ptr`) und klare Lifetimes.
+ - Für Größen/Indizes: `std::size_t`/`ptrdiff_t` statt `int`; für ABI/FFI: feste Breiten (`std::uint32_t` etc.).
+ - `enum class` statt unscoped enums; `[[nodiscard]]` für Rückgaben, die nicht ignoriert werden sollen.
+ - Für Views: `std::span`, `std::string_view` (keine rohen Buffer+Len‑Paare ohne Wrapper).
+ - Keine `#define` für Konstanten/Typen; `constexpr`/`consteval`/`using`.
+- Compiler‑Strenge (als Vorschlag, projektabhängig):
+ - Clang/GCC: `-Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wshadow -Wnull-dereference`.
+ - In CI nach Möglichkeit: `-Werror` (oder selektiv `-Werror=`).
+- Windows/MSVC (falls genutzt): `/W4 /WX /permissive-` und nach Möglichkeit SDL‑Hardening (`/sdl`).
+- Runtime‑Checks (Debug/CI): Sanitizer‑Builds (`ASan`, `UBSan`, optional `TSan`) für native Komponenten.
+- Tests: Google Test (gtest). Vorschläge für Tests sollen kleine, deterministische Cases enthalten.
+
+**Rust**
+- Format: `rustfmt`. Linter: `clippy` — Copilot soll `clippy`-freundliche Patterns bevorzugen.
+- Error Handling: Verwende `Result`/`?`-Operatoren idiomatisch; keine `unwrap()` in Produktionscode.
+- Type‑Safety:
+ - `unsafe` nur wenn notwendig; klein halten, kapseln, und Safety‑Invarianten in einem kurzen Kommentar festhalten.
+ - In CI bevorzugt: `cargo clippy -- -D warnings` und (falls passend) `#![deny(warnings)]`/`#![deny(clippy::all)]` auf Crate‑Level.
+ - Optional (wenn Crate es zulässt): `#![forbid(unsafe_code)]` in rein „safe“ Crates.
+- Tests: `cargo test` mit klaren Unit‑Tests.
+
+**Dart / Flutter**
+- Format: `dart format`. Null‑safety verpflichtend.
+- Architektur: Trenne UI/Business/Platform (z. B. Provider/Bloc/riverpod‑Pattern) — Copilot soll keine monolithischen Widgets vorschlagen.
+- Type‑Safety:
+ - `analysis_options.yaml` soll strikte Analyse aktivieren (z. B. `strict-casts`, `strict-inference`, `strict-raw-types`).
+ - Keine `dynamic`‑Leaks in Public APIs; generische Typen überall vollständig ausfüllen.
+ - Prefer `flutter_lints`/`lints` (projektabhängig) und behandle Analyzer‑Warnings in CI als Fehler.
+- Tests: `flutter_test` für Widgets + Unit‑Tests.
+
+**Python (uv + ruff + ty)**
+- Package Manager/Runner: **`uv`** (Dependencies gehören in `pyproject.toml`; Lockfile/Sync über `uv`).
+- Tools sollen über `uv run …` ausgeführt werden (kein „global pip“, kein ungepinnter Tool‑Mix).
+- Lint/Style: `ruff` (und optional Formatter nach Projektpolicy).
+- Typisierung: **`ty`** als Type Checker; Copilot soll Typannotationen vollständig ergänzen und `Any` vermeiden.
+- Type‑Safety Regeln:
+ - `from __future__ import annotations` bevorzugen (falls Projektpolicy), und öffentliche APIs vollständig annotieren.
+ - Keine stillen `Any`‑Leaks: `Any`/`cast()`/`# type: ignore` nur mit Begründung und so lokal wie möglich.
+ - Collections/Generics immer parametrisieren (`list[str]` statt `list`).
+
+---
+
+## CI / Checks (nur Kommandos, keine Workflow‑Änderungen)
+Copilot soll bei „How to validate“ bevorzugt konkrete, reproduzierbare Kommandos vorschlagen (an Repo‑Tooling anpassen):
+- C/C++: configure/build via CMake Presets oder `cmake -S . -B build` + `cmake --build build` + Tests (`ctest`).
+- clang-format: `clang-format -i` (nur auf geänderten Dateien) oder ein Check‑Target.
+- clang-tidy: nur wenn `compile_commands.json` vorhanden ist; keine massiven Auto‑Fixes ohne Review.
+- Rust: `cargo fmt --check`, `cargo clippy -- -D warnings`, `cargo test`.
+- Flutter: `dart format --output=none --set-exit-if-changed .`, `dart analyze`, `flutter test`.
+- Python (uv): `uv sync` (ggf. „frozen“/locked nach Projektpolicy), dann `uv run ruff check .` und `uv run ty` (bzw. `uv run ty check`, je nach Tool‑Konfiguration).
+
+**I/O / libuv‑basierte Bindings**
+- Für libuv/uvloop/uvicorn‑artige APIs: keine blockierenden Aufrufe in Event‑Loop‑Callbacks vorschlagen.
+- Prefer async patterns and explicit threading/futures when interacting with native I/O.
+
+---
+
+## Testing & Qualität
+- Neue Features sollten Unit‑Tests enthalten. Copilot soll Test‑Skeletons vorschlagen, die vorhandene Fixtures nutzen.
+- Vermeide flakige Tests; prefer deterministic seeds and small inputs.
+- Coverage: Mindestens smoke tests für kritische native bindings.
+
+---
+
+## Interop (C/C++ <-> Rust <-> Dart)
+- Copilot soll sicherheitsbewusst bei FFI/Bindings handeln: null/ownership/ABI‑stability prüfen.
+- Bei Vorschlägen für Bindings: automatische Free/Fallocate Regeln, `unsafe`-Blocks in Rust nur mit Kommentar.
+- Keine Code‑Generierung für Bindings ohne Hinweis (z. B. `cbindgen`, `flutter_rust_bridge`) und vorgeschlagenen Tests.
+
+### FFI‑Typregeln (konkret)
+- C ABI: `extern "C"`, stabile, explizite Layouts; keine C++‑Typen über ABI (z. B. `std::string`, Exceptions) exportieren.
+- Pointer/Nullability: Nullability im Typ ausdrücken (z. B. `Option>`/`*mut T` + Dokumentation); nie „silent null“.
+- Ownership: Erzeuger/Zerstörer‑Paare oder klare „borrowed vs owned“ Konventionen; keine impliziten Frees.
+- Fehler: über ABI entweder Fehlercodes + `out`‑Parameter oder klar definierte Ergebnis‑Structs; keine Exceptions über FFI.
+
+---
+
+## Sicherheit & Geheimnisse
+- Niemals API‑Keys, Passwörter, private Zertifikate oder sonstige Secrets einchecken oder vorschlagen.
+- Wenn Copilot möglichen Secret‑Leak erkennt, soll es auf Vault/Secret‑Manager oder `.gitignore` hinweisen.
+
+---
+
+## Lizenz & rechtliche Hinweise
+- Repository‑Lizenz: bitte hier eintragen (z. B. MIT / Apache‑2.0). Copilot soll Lizenz‑Header nur vorschlagen, wenn klar passend.
+
+---
+
+## Commit‑ und PR‑Konventionen
+- Commit‑Format: **Conventional Commits** (`feat:`, `fix:`, `chore:`, `docs:` etc.).
+- PRs: kurze Zusammenfassung + „Changes“ + „Testing/How to validate“ und CI‑Status.
+- Keine squash‑commits für sicherheitsrelevante Änderungen ohne Review.
+
+---
+
+## Do / Don't (kurz)
+**Do**
+- Kleine, überprüfbare Änderungen vorschlagen.
+- Typannotationen an öffentliche APIs ergänzen.
+- Tests + CI‑Checks vorschlagen.
+
+**Don't**
+- Große, invasive Refactorings ohne PR‑Diskussion vorschlagen.
+- Secrets oder unsichere Defaults einfügen.
+- Ungetestete native Änderungen direkt vorschlagen (z. B. ABI‑Änderungen ohne Tests).
+
+---
+
+## Beispiele / Snippets
+> *Hinweis: konkrete Codebeispiele und Style‑Configs (z. B. `.clang-format`, `rustfmt.toml`, `analysis_options.yaml`) sollten projekt‑spezifisch ergänzt werden.*
+
+---
+
+## Verhalten bei Unsicherheit
+- Wenn Anforderungen unklar sind, soll Copilot Rückfragen vorschlagen (z. B. "Welcher C++ Standard wird verwendet?") anstatt zu raten.
+- Für kritische Bereiche (Memory/FFI/Concurrency) präferiere conservative, safe Vorschläge und verweise auf Tests.
+
+---
+
+## Anpassung & Pflege
+- Passe die Datei an, wenn der C++ Standard wechselt oder neue CI‑Checks/Tools (z. B. OSS security scanners) hinzukommen.
+
+---
+
+*Ende der projekt‑spezifischen Copilot‑Anleitung.*
+
+*Wenn du möchtest: Ich kann noch spezifische Beispiele für `.clang-format`, `rustfmt.toml` und `analysis_options.yaml` (für Dart) hinzufügen — oder die Datei auf Englisch übersetzen.*
+
diff --git a/.github/workflows/dart_build_android_app.yml b/.github/workflows/dart_build_android_app.yml
new file mode 100644
index 0000000..58f1bed
--- /dev/null
+++ b/.github/workflows/dart_build_android_app.yml
@@ -0,0 +1,171 @@
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+
+name: Build + test + run android app
+
+on:
+ push:
+ branches: ["main", "develop"]
+ pull_request:
+ branches: ["main", "develop"]
+
+env:
+ APP_NAME: kataglyphis-inference-engine-apk
+ FLUTTER_VERSION: 3.38.9 # change here to update version for the whole workflow
+ FLUTTER_DIR: /workspace/flutter # Flutter SDK installation directory
+
+jobs:
+ build:
+ strategy:
+ matrix:
+ include:
+ - runs_on: ubuntu-24.04
+ arch: x64
+ platform: linux/amd64
+
+ runs-on: ${{ matrix.runs_on }}
+
+ steps:
+ - name: Free Disk Space on Host
+ uses: jlumbroso/free-disk-space@main
+ with:
+ tool-cache: true
+ android: true
+ dotnet: true
+ haskell: true
+ large-packages: true
+ docker-images: false
+ swap-storage: true
+
+ - uses: actions/checkout@v6.0.0
+ with:
+ fetch-depth: 0
+ submodules: recursive
+
+ - name: Create swapfile on runner (helps avoid OOM during linking)
+ run: |
+ # create 6 GiB swapfile (falls back to dd if fallocate fails)
+ sudo swapoff -a || true
+ if sudo test -f /swapfile; then
+ echo "/swapfile already exists"
+ else
+ if sudo fallocate -l 6G /swapfile; then
+ echo "fallocate succeeded"
+ else
+ echo "fallocate failed, using dd"
+ sudo dd if=/dev/zero of=/swapfile bs=1M count=6144
+ fi
+ sudo chmod 600 /swapfile
+ sudo mkswap /swapfile
+ sudo swapon /swapfile
+ echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
+ fi
+ swapon --show || true
+ free -h || true
+
+ - name: Login to GitHub Container Registry
+ run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
+
+ - name: Pull container image
+ run: |
+ for i in 1 2 3; do
+ echo "Attempt $i to pull container..."
+ if timeout 900 docker pull ghcr.io/kataglyphis/kataglyphis_beschleuniger:latest; then
+ echo "Successfully pulled container"
+ exit 0
+ fi
+ echo "Pull failed, waiting before retry..."
+ sleep 30
+ done
+ echo "Failed to pull container after 3 attempts"
+ exit 1
+
+ - name: Setup Flutter in container
+ run: |
+ docker run --rm \
+ --platform ${{ matrix.platform }} \
+ -v ${{ github.workspace }}:/workspace \
+ -w /workspace \
+ -e FLUTTER_VERSION=${{ env.FLUTTER_VERSION }} \
+ -e FLUTTER_DIR=${{ env.FLUTTER_DIR }} \
+ -e MATRIX_ARCH=${{ matrix.arch }} \
+ ghcr.io/kataglyphis/kataglyphis_beschleuniger:latest \
+ bash -lc '
+ set -e
+ git config --global --add safe.directory /workspace || true
+ git config --global --add safe.directory ${FLUTTER_DIR} || true
+
+ chmod +x scripts/linux/setup-flutter-x86-64.sh
+ ./scripts/linux/setup-flutter-x86-64.sh $FLUTTER_VERSION $(dirname ${FLUTTER_DIR})
+ '
+
+ - name: Run Flutter checks and tests
+ run: |
+ docker run --rm \
+ --platform ${{ matrix.platform }} \
+ -v ${{ github.workspace }}:/workspace \
+ -w /workspace \
+ ghcr.io/kataglyphis/kataglyphis_beschleuniger:latest \
+ bash -lc '
+ set -e
+ export PATH="$PWD/flutter/bin:$PATH"
+ git config --global --add safe.directory /workspace || true
+ git config --global --add safe.directory ${FLUTTER_DIR} || true
+
+ source ~/.bashrc
+ export PATH="${FLUTTER_DIR}/bin:$PATH"
+
+ flutter pub get
+ dart format --output=none --set-exit-if-changed . || true
+ dart analyze || true
+ flutter test || true
+ flutter config --enable-android
+ '
+
+ - name: Build Flutter Android app
+ run: |
+ docker run --rm \
+ --platform ${{ matrix.platform }} \
+ -v ${{ github.workspace }}:/workspace \
+ -w /workspace \
+ -e APP_NAME=${{ env.APP_NAME }} \
+ -e MATRIX_ARCH=${{ matrix.arch }} \
+ ghcr.io/kataglyphis/kataglyphis_beschleuniger:latest \
+ bash -lc '
+ set -e
+ export PATH="$PWD/flutter/bin:$PATH"
+ git config --global --add safe.directory /workspace || true
+ git config --global --add safe.directory ${FLUTTER_DIR} || true
+
+ source ~/.bashrc
+ export PATH="${FLUTTER_DIR}/bin:$PATH"
+
+ flutter build apk --release
+ '
+
+ - name: Package build artifacts
+ run: |
+ docker run --rm \
+ --platform ${{ matrix.platform }} \
+ -v ${{ github.workspace }}:/workspace \
+ -w /workspace \
+ -e APP_NAME=${{ env.APP_NAME }} \
+ -e MATRIX_ARCH=${{ matrix.arch }} \
+ ghcr.io/kataglyphis/kataglyphis_beschleuniger:latest \
+ bash -lc '
+ set -e
+ rm -rf build/linux/$MATRIX_ARCH/release/obj || true
+ rm -rf ~/.pub-cache/hosted || true
+ mkdir -p out
+ cp -r build/app/outputs/flutter-apk out/${APP_NAME}-bundle
+ tar -C out -czf ${APP_NAME}-linux-$MATRIX_ARCH.tar.gz ${APP_NAME}-bundle
+ '
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v6.0.0
+ with:
+ name: ${{ env.APP_NAME }}-linux-${{ matrix.arch }}-tar
+ path: ${{ env.APP_NAME }}-linux-${{ matrix.arch }}.tar.gz
+
diff --git a/.github/workflows/dart_on_linux.yml b/.github/workflows/dart_on_native_linux.yml
similarity index 71%
rename from .github/workflows/dart_on_linux.yml
rename to .github/workflows/dart_on_native_linux.yml
index 216be2b..e862d02 100644
--- a/.github/workflows/dart_on_linux.yml
+++ b/.github/workflows/dart_on_native_linux.yml
@@ -1,9 +1,12 @@
# This workflow uses actions that are not certified by GitHub.
+
# They are provided by a third-party and are governed by
+
# separate terms of service, privacy policy, and support
+
# documentation.
-name: Build + run + test on Linux
+name: Build + test + run on Linux natively - x86-64/arm64
on:
push:
@@ -13,7 +16,8 @@ on:
env:
APP_NAME: kataglyphis-inference-engine
- FLUTTER_VERSION: 3.38.3 # change here to update version for the whole workflow
+ FLUTTER_VERSION: 3.38.9 # change here to update version for the whole workflow
+ FLUTTER_DIR: /workspace/flutter # Flutter SDK installation directory
jobs:
build:
@@ -38,12 +42,19 @@ jobs:
dotnet: true
haskell: true
large-packages: true
- docker-images: false
+ docker-images: true
swap-storage: true
- - uses: actions/checkout@v6.0.0
+ - name: Prune Docker + show disk usage
+ run: |
+ set -eux
+ docker system prune -af --volumes || true
+ docker system df || true
+ df -h
+
+ - uses: actions/checkout@v6.0.2
with:
- fetch-depth: 0
+ fetch-depth: 1
submodules: recursive
- name: Login to GitHub Container Registry
@@ -55,6 +66,7 @@ jobs:
echo "Attempt $i to pull container..."
if timeout 900 docker pull ghcr.io/kataglyphis/kataglyphis_beschleuniger:latest; then
echo "Successfully pulled container"
+ docker system df || true
exit 0
fi
echo "Pull failed, waiting before retry..."
@@ -70,20 +82,23 @@ jobs:
-v ${{ github.workspace }}:/workspace \
-w /workspace \
-e FLUTTER_VERSION=${{ env.FLUTTER_VERSION }} \
+ -e FLUTTER_DIR=${{ env.FLUTTER_DIR }} \
-e MATRIX_ARCH=${{ matrix.arch }} \
ghcr.io/kataglyphis/kataglyphis_beschleuniger:latest \
bash -lc '
set -e
git config --global --add safe.directory /workspace || true
- git config --global --add safe.directory /workspace/flutter || true
+ git config --global --add safe.directory ${FLUTTER_DIR} || true
if [ "$MATRIX_ARCH" = "x64" ]; then
chmod +x scripts/linux/setup-flutter-x86-64.sh
- ./scripts/linux/setup-flutter-x86-64.sh $FLUTTER_VERSION
+ ./scripts/linux/setup-flutter-x86-64.sh $FLUTTER_VERSION $(dirname ${FLUTTER_DIR})
else
chmod +x scripts/linux/setup-flutter-arm64.sh
- ./scripts/linux/setup-flutter-arm64.sh $FLUTTER_VERSION
+ ./scripts/linux/setup-flutter-arm64.sh $FLUTTER_VERSION $(dirname ${FLUTTER_DIR})
fi
+ chmod -R u+rwX ${FLUTTER_DIR}/bin/cache 2>/dev/null || true
+ chmod -R u+rwX ${FLUTTER_DIR} 2>/dev/null || true
'
- name: Run Flutter checks and tests
@@ -92,12 +107,17 @@ jobs:
--platform ${{ matrix.platform }} \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
+ -e FLUTTER_DIR=${{ env.FLUTTER_DIR }} \
ghcr.io/kataglyphis/kataglyphis_beschleuniger:latest \
bash -lc '
set -e
- export PATH="$PWD/flutter/bin:$PATH"
+
git config --global --add safe.directory /workspace || true
- git config --global --add safe.directory /workspace/flutter || true
+ git config --global --add safe.directory ${FLUTTER_DIR} || true
+
+ source ~/.bashrc
+ export PATH="${FLUTTER_DIR}/bin:$PATH"
+
flutter pub get
dart format --output=none --set-exit-if-changed . || true
dart analyze || true
@@ -112,15 +132,35 @@ jobs:
-v ${{ github.workspace }}:/workspace \
-w /workspace \
-e APP_NAME=${{ env.APP_NAME }} \
+ -e FLUTTER_DIR=${{ env.FLUTTER_DIR }} \
-e MATRIX_ARCH=${{ matrix.arch }} \
ghcr.io/kataglyphis/kataglyphis_beschleuniger:latest \
bash -lc '
set -e
- export PATH="$PWD/flutter/bin:$PATH"
+
git config --global --add safe.directory /workspace || true
- git config --global --add safe.directory /workspace/flutter || true
-
+ git config --global --add safe.directory ${FLUTTER_DIR} || true
+
+ export PATH="${FLUTTER_DIR}/bin:$PATH"
+ source ~/.bashrc
+
+ # --- START FIX ---
+ # 1. Force use of Clang/Clang++
+ export CC=clang
+ export CXX=clang++
+
+ # 2. Point Clang to the custom GCC headers and library
+ # This fixes the "type_traits not found" error
+ export CXXFLAGS="--gcc-toolchain=/opt/gcc-15.2.0 $CXXFLAGS"
+
+ # 3. Ensure the linker finds the newer libstdc++
+ # We add rpath so the binary finds these libs at runtime/test time locally
+ export LDFLAGS="-L/opt/gcc-15.2.0/lib64 -Wl,-rpath,/opt/gcc-15.2.0/lib64 --gcc-toolchain=/opt/gcc-15.2.0 $LDFLAGS"
+ # --- END FIX ---
+
+ # run the build (use the absolute path to be robust)
flutter build linux --release
+
'
- name: Package build artifacts
@@ -148,23 +188,28 @@ jobs:
--platform ${{ matrix.platform }} \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
+ -e FLUTTER_DIR=${{ env.FLUTTER_DIR }} \
ghcr.io/kataglyphis/kataglyphis_beschleuniger:latest \
bash -lc '
set -e
- export PATH="$PWD/flutter/bin:$PATH"
+
git config --global --add safe.directory /workspace || true
- git config --global --add safe.directory /workspace/flutter || true
+ git config --global --add safe.directory ${FLUTTER_DIR} || true
+
+ source ~/.bashrc
+ export PATH="${FLUTTER_DIR}/bin:$PATH"
+
flutter clean
dart doc
-
+
OWNER_UID=$(stat -c "%u" /workspace)
OWNER_GID=$(stat -c "%g" /workspace)
echo "Fixing ownership of doc/api to ${OWNER_UID}:${OWNER_GID}"
chown -R ${OWNER_UID}:${OWNER_GID} /workspace/doc || true
'
-
+
- name: Upload artifact
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@v6.0.0
with:
name: ${{ env.APP_NAME }}-linux-${{ matrix.arch }}-tar
path: ${{ env.APP_NAME }}-linux-${{ matrix.arch }}.tar.gz
@@ -174,7 +219,7 @@ jobs:
run: |
chmod -R 755 ./doc/api/
ls -la ./doc/api/
-
+
- name: 📂 Sync files to domain
if: ${{ matrix.arch == 'x64' }}
uses: SamKirkland/FTP-Deploy-Action@v4.3.6
@@ -182,4 +227,4 @@ jobs:
server: ${{ secrets.SERVER }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PW }}
- local-dir: "./doc/api/"
+ local-dir: "./doc/api/"
\ No newline at end of file
diff --git a/.github/workflows/dart_on_windows.yml b/.github/workflows/dart_on_native_windows.yml
similarity index 89%
rename from .github/workflows/dart_on_windows.yml
rename to .github/workflows/dart_on_native_windows.yml
index 99a0968..b5b26d0 100644
--- a/.github/workflows/dart_on_windows.yml
+++ b/.github/workflows/dart_on_native_windows.yml
@@ -1,4 +1,4 @@
-name: Windows CMake (clang-cl)
+name: Build + test + run on Windows with (clang-cl)
on: [ push, pull_request ]
@@ -21,7 +21,7 @@ jobs:
shell: pwsh
- name: Checkout
- uses: actions/checkout@v6.0.0
+ uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
submodules: recursive
@@ -32,7 +32,7 @@ jobs:
uses: ./.github/actions/cleanup-disk-space
- name: Login to GitHub
- uses: docker/login-action@v3.6.0
+ uses: docker/login-action@v3.7.0
with:
registry: ghcr.io
username: Kataglyphis
@@ -52,7 +52,7 @@ jobs:
# see also the install commands in the bottom of the CMakeLists.txt
- name: Upload files & Zip
- uses: actions/upload-artifact@v5.0.0
+ uses: actions/upload-artifact@v6.0.0
with:
name: windows-files
path: |
diff --git a/.github/workflows/dart_on_web_linux.yml b/.github/workflows/dart_on_web_linux.yml
new file mode 100644
index 0000000..d4125ff
--- /dev/null
+++ b/.github/workflows/dart_on_web_linux.yml
@@ -0,0 +1,79 @@
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+
+name: Build + test + run for web
+
+env:
+ LOCAL_ASSETS_FOLDER: "assets"
+ BUILD_DIR_RELEASE: "build/web"
+
+on:
+ push:
+ branches: ["main", "develop"]
+
+jobs:
+ build:
+ name: 🚀 Deploy website on push
+ #runs-on: windows-latest
+ runs-on: ubuntu-24.04
+ steps:
+ - name: 🚚 Get latest code
+ uses: actions/checkout@v6.0.2
+ with:
+ fetch-depth: 0
+ submodules: recursive
+
+ - name: Setup Flutter SDK
+ uses: flutter-actions/setup-flutter@v4.1
+ with:
+ channel: stable
+ version: 3.38.9
+
+ # git submodule update --init --recursive
+ - name: Install dependencies
+ run: |
+ flutter pub get
+ cd ExternalLib/jotrockenmitlockenrepo
+ flutter pub get
+
+ # Uncomment this step to verify the use of 'dart format' on each commit.
+ - name: Verify formatting
+ continue-on-error: true
+ run: dart format --output=none --set-exit-if-changed .
+
+ # Consider passing '--fatal-infos' for slightly stricter analysis.
+ - name: Analyze project source
+ continue-on-error: true
+ run: dart analyze
+
+ # Your project will need to have tests in test/ and a dependency on
+ # package:test for this step to succeed. Note that Flutter projects will
+ # want to change this to 'flutter test'.
+ - name: Run tests
+ continue-on-error: true
+ run: |
+ flutter test
+
+ - name: Enable flutter web
+ run: |
+ rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
+ rustup target add wasm32-unknown-unknown --toolchain nightly
+ cargo install flutter_rust_bridge_codegen
+ flutter config --enable-web
+
+ - name: "Build Web App"
+ run: |
+ flutter_rust_bridge_codegen build-web \
+ --wasm-pack-rustflags "-Ctarget-feature=+atomics -Clink-args=--shared-memory -Clink-args=--max-memory=1073741824 -Clink-args=--import-memory -Clink-args=--export=__wasm_init_tls -Clink-args=--export=__tls_size -Clink-args=--export=__tls_align -Clink-args=--export=__tls_base" \
+ --release \
+ --rust-root ExternalLib/Kataglyphis-RustProjectTemplate
+ flutter build web --release --wasm
+
+ - name: Upload Web App Files for Deployment
+ uses: actions/upload-artifact@v6.0.0
+ with:
+ name: gstreamer-ai-web-frontend
+ path: ${{ env.BUILD_DIR_RELEASE }}/**
+ if-no-files-found: error
diff --git a/.gitignore b/.gitignore
index 3545eb9..d410d1d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,11 +41,15 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
-
-
-#Ignore vscode AI rules
-.github/instructions/codacy.instructions.md
-
-
-#Ignore vscode AI rules
-.github\instructions\codacy.instructions.md
+
+
+#Ignore vscode AI rules
+.github/instructions/codacy.instructions.md
+
+
+#Ignore vscode AI rules
+.github\instructions\codacy.instructions.md
+
+ExternalLib/Kataglyphis_NativeInferencePlugin/.dart_tool/*
+
+ExternalLib/jotrockenmitlockenrepo/.dart_tool/*
diff --git a/.gitmodules b/.gitmodules
index 8094f92..742d155 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -5,3 +5,9 @@
path = ExternalLib/Kataglyphis_NativeInferencePlugin
url = git@github.com:Kataglyphis/Kataglyphis-NativeInferencePlugin.git
branch = main
+[submodule "ExternalLib/Kataglyphis-ContainerHub"]
+ path = ExternalLib/Kataglyphis-ContainerHub
+ url = git@github.com:Kataglyphis/Kataglyphis-ContainerHub.git
+[submodule "ExternalLib/Kataglyphis-RustProjectTemplate"]
+ path = ExternalLib/Kataglyphis-RustProjectTemplate
+ url = git@github.com:Kataglyphis/Kataglyphis-RustProjectTemplate.git
diff --git a/.metadata b/.metadata
index 1b79560..62391df 100644
--- a/.metadata
+++ b/.metadata
@@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.
version:
- revision: "b25305a8832cfc6ba632a7f87ad455e319dccce8"
+ revision: "66dd93f9a27ffe2a9bfc8297506ce066ff51265f"
channel: "stable"
project_type: app
@@ -13,11 +13,11 @@ project_type: app
migration:
platforms:
- platform: root
- create_revision: b25305a8832cfc6ba632a7f87ad455e319dccce8
- base_revision: b25305a8832cfc6ba632a7f87ad455e319dccce8
- - platform: windows
- create_revision: b25305a8832cfc6ba632a7f87ad455e319dccce8
- base_revision: b25305a8832cfc6ba632a7f87ad455e319dccce8
+ create_revision: 66dd93f9a27ffe2a9bfc8297506ce066ff51265f
+ base_revision: 66dd93f9a27ffe2a9bfc8297506ce066ff51265f
+ - platform: android
+ create_revision: 66dd93f9a27ffe2a9bfc8297506ce066ff51265f
+ base_revision: 66dd93f9a27ffe2a9bfc8297506ce066ff51265f
# User provided section
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 1ad1dee..6489904 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,3 +1,4 @@
{
- "idf.pythonInstallPath": "/usr/bin/python3"
+ "idf.pythonInstallPath": "/usr/bin/python3",
+ "java.configuration.updateBuildConfiguration": "interactive"
}
\ No newline at end of file
diff --git a/ExternalLib/Kataglyphis-ContainerHub b/ExternalLib/Kataglyphis-ContainerHub
new file mode 160000
index 0000000..eac2cc8
--- /dev/null
+++ b/ExternalLib/Kataglyphis-ContainerHub
@@ -0,0 +1 @@
+Subproject commit eac2cc80e0fc053a33d5676a2497cd812116aedf
diff --git a/ExternalLib/Kataglyphis-RustProjectTemplate b/ExternalLib/Kataglyphis-RustProjectTemplate
new file mode 160000
index 0000000..16d97f1
--- /dev/null
+++ b/ExternalLib/Kataglyphis-RustProjectTemplate
@@ -0,0 +1 @@
+Subproject commit 16d97f1bd45723268817a7f109597830206b03aa
diff --git a/ExternalLib/Kataglyphis_NativeInferencePlugin b/ExternalLib/Kataglyphis_NativeInferencePlugin
index 193b33b..63a0cdf 160000
--- a/ExternalLib/Kataglyphis_NativeInferencePlugin
+++ b/ExternalLib/Kataglyphis_NativeInferencePlugin
@@ -1 +1 @@
-Subproject commit 193b33b159ed81c915fc7f3a1172bfc21b5bf86c
+Subproject commit 63a0cdf8c3603e7b05e430cfc6b8c250a3704833
diff --git a/ExternalLib/jotrockenmitlockenrepo b/ExternalLib/jotrockenmitlockenrepo
index 96d8890..5408dab 160000
--- a/ExternalLib/jotrockenmitlockenrepo
+++ b/ExternalLib/jotrockenmitlockenrepo
@@ -1 +1 @@
-Subproject commit 96d88904c3d1db32b3837b4e6e6e84ebf0ad7c28
+Subproject commit 5408dab392127e3bca1c27d7e6796163ce7456b2
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d9f6aaf
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2025 Jonas Heinle
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/README.md b/README.md
index 4076b7d..941ab64 100644
--- a/README.md
+++ b/README.md
@@ -1,202 +1,201 @@
-
-
-
-
- Kataglyphis-Inference-Engine
-
-
-
-
-
-
An inference engine with flutter/dart frontend an rust backend. .
-
-[](https://github.com/Kataglyphis/Kataglyphis-Inference-Engine/actions/workflows/dart_on_linux.yml)
-[](https://github.com/Kataglyphis/Kataglyphis-Inference-Engine/actions/workflows/dependency-graph/auto-submission)
-[](https://github.com/Kataglyphis/Kataglyphis-Inference-Engine/actions/workflows/github-code-scanning/codeql)
+
An inference engine with Flutter/Dart frontend and Rust/C++ backend, showcasing Gstreamer capabilities enhanced with AI. Read further if you are interested in cross platform AI inference.
+
+
+
+
+[](https://github.com/Kataglyphis/Kataglyphis-Inference-Engine/actions/workflows/dart_on_native_linux.yml) [](https://github.com/Kataglyphis/Kataglyphis-Inference-Engine/actions/workflows/dart_on_native_windows.yml) [](https://github.com/Kataglyphis/Kataglyphis-Inference-Engine/actions/workflows/dart_on_web_linux.yml)
+ [](https://github.com/Kataglyphis/Kataglyphis-Inference-Engine/actions/workflows/dart_build_android_app.yml)[](https://github.com/Kataglyphis/Kataglyphis-Inference-Engine/actions/workflows/dependency-graph/auto-submission)
+[](https://github.com/Kataglyphis/Kataglyphis-Inference-Engine/actions/workflows/github-code-scanning/codeql)
[](https://github.com/Kataglyphis/Kataglyphis-Inference-Engine/actions/workflows/dependabot/dependabot-updates)
-[](https://github.com/Kataglyphis/Kataglyphis-Inference-Engine/actions/workflows/dart_on_windows.yml)
[]()
[](https://www.paypal.com/donate/?hosted_button_id=BX9AVVES2P9LN)
[](https://twitter.com/Cataglyphis_)
[](https://www.youtube.com/channel/UC3LZiH4sZzzaVBCUV8knYeg)
-[**__Official homepage__**](https://kataglyphisinferenceengine.jonasheinle.de)
-
-
-
-
-
-
-## About The Project
-Building a high performance native inference engine with a frontend is quite challenging. This project discovers possibilities in doing it using Flutter/Dart and Rust.
-
-
-
-
-This project is a template.
-
-### Key Features
-
-
-
-
-### Dependencies
-This enumeration also includes submodules.
-
-
-### Useful tools
-
-
-
-
-## Getting Started
-
-```bash
-git submodule update --init --recursive
-```
-
-### Prerequisites
-
-### Installation
-
-1. Clone the repo
- ```sh
- git clone --recurse-submodules git@github.com:Kataglyphis/Kataglyphis-Inference-Engine.git
+[**Official homepage**](https://kataglyphisinferenceengine.jonasheinle.de)
+
+## Overview
+
+Kataglyphis-Inference-Engine bundles a Flutter/Dart frontend, a Rust/C++ inference core, and a rich set of camera streaming pipelines powered by GStreamer. The repository acts as an end-to-end reference for building cross-platform inference products that target desktop, web, and embedded devices.
+
+## Highlights & Key Features – Kataglyphis-Inference-Engine
+
+### 🌟 Highlights
+
+- 🎨 **GStreamer native GTK integration** – Leveraging users to write beautiful Linux AI inference apps.
+- 📹 **GStreamer WebRTC livestreaming** with ready-to-use pipelines for USB, Raspberry Pi, and Orange Pi cameras.
+- 🌉 **flutter_rust_bridge integration** – Ensures a seamless API boundary between Dart UI and Rust logic.
+- 🐳 **Containerized development flow** plus native instructions for Windows, Linux, web. For details in my build environment look into [Kataglyphis-ContainerHub](https://github.com/Kataglyphis/Kataglyphis-ContainerHub)
+- 🐍 **Python inference demos** for rapid experimentation alongside the Rust core.
+
+### 📊 Feature Status Matrix
+
+#### Core Features
+
+| Category | Feature | Win x64 | Linux x64 | Linux ARM64 | Linux RISC-V | Android |
+|----------|---------|:-------:|:---------:|:-----------:|:------------:|:-------:|
+| **Camera Streaming** | 📹 GStreamer WebRTC Livestream | ✔️ | ✔️ | ✔️ | ✔️ | N/A |
+| **Supported Cameras** | 🔌 USB Devices | ✔️ | ✔️ | ✔️ | ✔️ | N/A |
+| | 🍓 Raspberry Pi Camera | N/A | ✔️ | ✔️ | ✔️ | N/A |
+| | 🟠 Orange Pi Camera | N/A | ❌ | ❌ | ❌ | N/A |
+| | 📱 Native Camera API | N/A | N/A | N/A | N/A | ✔️ |
+
+#### Infrastructure & Build
+
+| Category | Feature | Win x64 | Linux x64 | Linux ARM64 | Linux RISC-V | Android |
+|----------|---------|:-------:|:---------:|:-----------:|:------------:|:-------:|
+| **Containerization** | 🐳 Dockerfile | ✔️ | ✔️ | ✔️ | ✔️ | N/A |
+| | 🐳 Docker Compose | N/A | ✔️ | ✔️ | ✔️ | N/A |
+| **Native Integration** | 🎨 GTK Integration | N/A | ✔️ | ✔️ | ✔️ | N/A |
+| | 🪟 Win32 API | ✔️ | N/A | N/A | N/A | N/A |
+| | 🤖 Android NDK | N/A | N/A | N/A | N/A | ✔️ |
+| **Bridge Layer** | 🌉 flutter_rust_bridge | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
+| **Compiler** | 🔧 Clang-CL | ✔️ | N/A | N/A | N/A | N/A |
+| | 🔧 GCC/Clang | N/A | ✔️ | ✔️ | ✔️ | ✔️ |
+
+#### Testing & Quality Assurance
+
+| Category | Feature | Win x64 | Linux x64 | Linux ARM64 | Linux RISC-V | Android |
+|----------|---------|:-------:|:---------:|:-----------:|:------------:|:-------:|
+| **Unit Testing** | 🧪 Advanced unit testing | 🔶 | 🔶 | 🔶 | 🔶 | 🔶 |
+| **Performance** | ⚡ Advanced performance testing | 🔶 | 🔶 | 🔶 | 🔶 | 🔶 |
+| **Security** | 🔍 Advanced fuzz testing | 🔶 | 🔶 | 🔶 | 🔶 | 🔶 |
+
+#### Frontend Platforms
+
+| Category | Feature | Win x64 | Linux x64 | Linux ARM64 | Linux RISC-V | Android |
+|----------|---------|:-------:|:---------:|:-----------:|:------------:|:-------:|
+| **Flutter UI** | 🦋 Flutter Web Support | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
+| | 💻 Flutter Desktop | ✔️ | ✔️ | ✔️ | ✔️ | N/A |
+| | 📱 Flutter Mobile | N/A | N/A | N/A | N/A | ✔️ |
+
+---
+
+#### Platform Summary
+
+| Platform | Architecture | Status | Notes |
+|----------|-------------|:------:|-------|
+| 🪟 **Windows** | x86-64 | ✔️ | Built with clang-cl, Win32 integration |
+| 🐧 **Linux** | x86-64 | ✔️ | Full GTK support, Docker ready |
+| 🐧 **Linux** | ARM64 | ✔️ | SBC optimized (RPi, OPi support) |
+| 🐧 **Linux** | RISC-V | ✔️ | Emerging architecture support |
+| 🤖 **Android** | ARM64/x86-64 | ✔️ | Native camera, NDK integration |
+
+---
+
+**Legend:**
+- ✔️ **Completed** - Feature fully implemented and tested
+- 🔶 **In Progress** - Active development underway
+- ❌ **Not Started** - Planned but not yet begun
+- **N/A** - Not applicable for this platform
+
+## Quick Start
+
+1. Clone the repository with submodules:
+ > **__NOTE:__**
+ > On Windows I use [Git Bash](https://git-scm.com/install/windows) instead of
+ > Powershell or cmd
+ ```bash
+ git clone --recurse-submodules --branch develop git@github.com:Kataglyphis/Kataglyphis-Inference-Engine.git
+ cd Kataglyphis-Inference-Engine
```
-### Upgrades
-Upgrading the flutter/dart bridge dependencies is as simple as this command:
-[see source](https://cjycode.com/flutter_rust_bridge/guides/miscellaneous/upgrade/regular)
-```bash
-cargo install flutter_rust_bridge_codegen && flutter_rust_bridge_codegen generate
-```
-
-### Windows
-For windows we absolutely do not want to be dependent on MSVC compiler.
-Therefore I use [clang-cl](https://clang.llvm.org/docs/MSVCCompatibility.html).
-Using clang-cl instead of MSVC needed adjustment. Therefore i give some instructions here.
-
-#### Flutter generated cmake project
-Adjust the CXX-Flags in the auto-generated Cmake project. Find the folloeing line
-and adjust accordingly:
-
-```cmake
-# comment this line
-# target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
-# add the following:
-# target_compile_options(${TARGET} PRIVATE /W3 /WX /wd4100 -Wno-cast-function-type-mismatch -Wno-unused-function)
-```
-
-Now you can build the project by running following commands:
-**__Attention:__** Adjust paths accordingly.
-
-```powershell
-cd rust
-cargo build --release
-cp rust\target\release\rust_lib_kataglyphis_inference_engine.dll build\windows\x64\plugins\rust_lib_kataglyphis_inference_engine
-cmake C:\GitHub\Kataglyphis-Inference-Engine\windows -B C:\GitHub\Kataglyphis-Inference-Engine\build\windows\x64 -G "Ninja" -DFLUTTER_TARGET_PLATFORM=windows-x64 -DCMAKE_CXX_COMPILER="C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\bin\clang-cl.exe" -DCMAKE_CXX_COMPILER_TARGET=x86_64-pc-windows-msvc
-cmake --build C:\GitHub\Kataglyphis-Inference-Engine\build\windows\x64 --config Release --target install --verbose
-```
+2. Initialize submodules if needed.
+ If u used `--recurse-submodules` while cloning you are already good.
+ Otherwise you can use this :smile:
+ ```bash
+ git submodule update --init --recursive
+ ```
+
+Refer to the detailed docs below for platform-specific requirements, camera streaming pipelines, and deployment workflows.
+
+
+## Documentation
+
+| Topic | Location | Description |
+|-------|----------|-------------|
+| Getting Started | [docs/source/getting-started.md](docs/source/getting-started.md) | Environment prerequisites, installation, and run commands. |
+| Platform Guides | [docs/source/platforms.md](docs/source/platforms.md) | Container, Windows, Raspberry Pi, and web build instructions. |
+| Camera Streaming | [docs/source/camera-streaming.md](docs/source/camera-streaming.md) | GStreamer WebRTC pipelines and Python inference demos. |
+| Upgrade guide | [docs/source/upgrade-guide.md](docs/source/upgrade-guide.md) | How to keep things up-to-date. |
+
+Build the full Sphinx documentation from the `docs/` directory when you need a browsable site.
## Tests
-
-## Roadmap
-Upcoming :)
-
+Testing infrastructure is under active development. Track progress on the roadmap or contribute test plans via pull requests.
+## Roadmap
+Upcoming features and improvements will be documented in this repository.
+Please have a look [docs/source/roadmap.md](docs/source/roadmap.md) for more deetails.
-
## Contributing
-Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
+Contributions are what make the open-source community amazing. Any contributions are **greatly appreciated**.
-1. Fork the Project
-2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
-3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
-4. Push to the Branch (`git push origin feature/AmazingFeature`)
-5. Open a Pull Request
+1. Fork the project.
+2. Create your feature branch (`git checkout -b feature/AmazingFeature`).
+3. Commit your changes (`git commit -m 'Add some AmazingFeature'`).
+4. Push to the branch (`git push origin feature/AmazingFeature`).
+5. Open a Pull Request.
-
-
## License
-
-## Contact
+MIT (see [here](LICENSE))
+
+## Acknowledgements
-Jonas Heinle - [@Cataglyphis_](https://twitter.com/Cataglyphis_) - jonasheinle@googlemail.com
+Thanks to the open-source community and all contributors!
-Project Link: [https://github.com/Kataglyphis/...](https://github.com/Kataglyphis/...)
+## Literature
+Helpful tutorials, documentation, and resources:
-
-## Acknowledgements
+### Multimedia
+- [GStreamer](https://gstreamer.freedesktop.org/)
+
+### Rust
+- [GStreamer-rs tutorial](https://gstreamer.freedesktop.org/documentation/rswebrtc/index.html?gi-language=c)
+- [gst-plugins-rs](https://github.com/GStreamer/gst-plugins-rs)
+- [GStreamer WebRTC](https://github.com/GStreamer/gst-plugins-rs/tree/main/net/webrtc)
-
+### Raspberry Pi
+- [GStreamer on Raspberry Pi](https://www.raspberrypi.com/documentation/computers/camera_software.html)
+- [libcamera](https://libcamera.org/)
+- [libcamera on Raspberry Pi](https://github.com/raspberrypi/libcamera)
-## Literature
+### CMake/C++
+- [clang-cl](https://clang.llvm.org/docs/MSVCCompatibility.html)
-Some very helpful literature, tutorials, etc.
+### Flutter/Dart
+- [Linux Native Textures](https://github.com/flutter/flutter/blob/master/examples/texture/lib/main.dart)
+- [flutter_rust_bridge](https://cjycode.com/flutter_rust_bridge/)
+- [Flutter on RISCV](https://github.com/ardera/flutter-ci/)
+
+### Protocols
+- [WebRTC](https://webrtc.org/?hl=de)
+
+### Tooling
+- [tmux](https://github.com/tmux/tmux/wiki)
+- [zellij](https://zellij.dev/)
+- [psmux](https://github.com/marlocarlo/psmux)
+
+### Android
+- [Gstreamer+flutter+android](https://github.com/hpdragon1618/flutter_gstreamer_player)
+
+## Contact
-CMake/C++
-* [clang-cl](https://clang.llvm.org/docs/MSVCCompatibility.html)
+**Jonas Heinle**
+Twitter: [@Cataglyphis_](https://twitter.com/Cataglyphis_)
+Email: cataglyphis@jonasheinle.de
-Flutter/Dart
-* [Linux Native Textures](https://github.com/flutter/flutter/blob/master/examples/texture/lib/main.dart)
+**Project Links:**
+- GitHub: [Kataglyphis-Inference-Engine](https://github.com/Kataglyphis/Kataglyphis-Inference-Engine)
+- Homepage: [Official Site](https://kataglyphisinferenceengine.jonasheinle.de)
diff --git a/android/.gitignore b/android/.gitignore
index fc83c26..be3943c 100644
--- a/android/.gitignore
+++ b/android/.gitignore
@@ -1,13 +1,14 @@
-gradle-wrapper.jar
-/.gradle
-/captures/
-/gradlew
-/gradlew.bat
-/local.properties
-GeneratedPluginRegistrant.java
-
-# Remember to never publicly share your keystore.
-# See https://flutter.dev/to/reference-keystore
-key.properties
-**/*.keystore
-**/*.jks
+gradle-wrapper.jar
+/.gradle
+/captures/
+/gradlew
+/gradlew.bat
+/local.properties
+GeneratedPluginRegistrant.java
+.cxx/
+
+# Remember to never publicly share your keystore.
+# See https://flutter.dev/to/reference-keystore
+key.properties
+**/*.keystore
+**/*.jks
diff --git a/android/app/build.gradle b/android/app/build.gradle.kts
similarity index 57%
rename from android/app/build.gradle
rename to android/app/build.gradle.kts
index 2d88cd1..b328bc8 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle.kts
@@ -1,44 +1,57 @@
-plugins {
- id "com.android.application"
- id "kotlin-android"
- // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
- id "dev.flutter.flutter-gradle-plugin"
-}
-
-android {
- namespace = "com.example.kataglyphis_inference_engine"
- compileSdk = flutter.compileSdkVersion
- ndkVersion = flutter.ndkVersion
-
- compileOptions {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
- }
-
- kotlinOptions {
- jvmTarget = JavaVersion.VERSION_1_8
- }
-
- defaultConfig {
- // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
- applicationId = "com.example.kataglyphis_inference_engine"
- // You can update the following values to match your application needs.
- // For more information, see: https://flutter.dev/to/review-gradle-config.
- minSdk = flutter.minSdkVersion
- targetSdk = flutter.targetSdkVersion
- versionCode = flutter.versionCode
- versionName = flutter.versionName
- }
-
- buildTypes {
- release {
- // TODO: Add your own signing config for the release build.
- // Signing with the debug keys for now, so `flutter run --release` works.
- signingConfig = signingConfigs.debug
- }
- }
-}
-
-flutter {
- source = "../.."
-}
+plugins {
+ id("com.android.application")
+ id("kotlin-android")
+ // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
+ id("dev.flutter.flutter-gradle-plugin")
+}
+
+android {
+ namespace = "com.example.kataglyphis_inference_engine"
+ // compileSdk = flutter.compileSdkVersion
+ // ndkVersion = flutter.ndkVersion
+ compileSdk = 36
+ buildToolsVersion = "35.0.0"
+ ndkVersion = "29.0.14206865"
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_21
+ targetCompatibility = JavaVersion.VERSION_21
+ isCoreLibraryDesugaringEnabled = true
+ }
+
+ kotlinOptions {
+ jvmTarget = JavaVersion.VERSION_21.toString()
+ }
+
+ defaultConfig {
+ // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
+ applicationId = "com.example.kataglyphis_inference_engine"
+ // You can update the following values to match your application needs.
+ // For more information, see: https://flutter.dev/to/review-gradle-config.
+ // my native_code_plugin requires minSdkVersion 26.
+ minSdk = 26
+ targetSdk = flutter.targetSdkVersion
+ versionCode = flutter.versionCode
+ versionName = flutter.versionName
+ }
+
+ buildTypes {
+ release {
+ // TODO: Add your own signing config for the release build.
+ // Signing with the debug keys for now, so `flutter run --release` works.
+ signingConfig = signingConfigs.getByName("debug")
+ }
+ }
+}
+
+flutter {
+ source = "../.."
+}
+
+kotlin {
+ jvmToolchain(21)
+}
+
+dependencies {
+ coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.3")
+}
diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml
index 8ffe024..399f698 100644
--- a/android/app/src/debug/AndroidManifest.xml
+++ b/android/app/src/debug/AndroidManifest.xml
@@ -1,7 +1,7 @@
-
-
-
-
+
+
+
+
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index cd5acf4..8ea5a33 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -1,45 +1,46 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/kotlin/com/example/kataglyphis_inference_engine/MainActivity.kt b/android/app/src/main/kotlin/com/example/kataglyphis_inference_engine/MainActivity.kt
index 81b1070..f73149b 100644
--- a/android/app/src/main/kotlin/com/example/kataglyphis_inference_engine/MainActivity.kt
+++ b/android/app/src/main/kotlin/com/example/kataglyphis_inference_engine/MainActivity.kt
@@ -1,5 +1,5 @@
-package com.example.kataglyphis_inference_engine
-
-import io.flutter.embedding.android.FlutterActivity
-
-class MainActivity: FlutterActivity()
+package com.example.kataglyphis_inference_engine
+
+import io.flutter.embedding.android.FlutterActivity
+
+class MainActivity : FlutterActivity()
diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml
index 1cb7aa2..f74085f 100644
--- a/android/app/src/main/res/drawable-v21/launch_background.xml
+++ b/android/app/src/main/res/drawable-v21/launch_background.xml
@@ -1,12 +1,12 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml
index 8403758..304732f 100644
--- a/android/app/src/main/res/drawable/launch_background.xml
+++ b/android/app/src/main/res/drawable/launch_background.xml
@@ -1,12 +1,12 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
index db77bb4..5657785 100644
Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
index 17987b7..a828c9f 100644
Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index 09d4391..ca02ea0 100644
Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index d5f1c8d..55f0369 100644
Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 4d6372e..f33a7ef 100644
Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml
index 360a160..06952be 100644
--- a/android/app/src/main/res/values-night/styles.xml
+++ b/android/app/src/main/res/values-night/styles.xml
@@ -1,18 +1,18 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml
index 5fac679..cb1ef88 100644
--- a/android/app/src/main/res/values/styles.xml
+++ b/android/app/src/main/res/values/styles.xml
@@ -1,18 +1,18 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml
index 8ffe024..399f698 100644
--- a/android/app/src/profile/AndroidManifest.xml
+++ b/android/app/src/profile/AndroidManifest.xml
@@ -1,7 +1,7 @@
-
-
-
-
+
+
+
+
diff --git a/android/build.gradle b/android/build.gradle
deleted file mode 100644
index 0066644..0000000
--- a/android/build.gradle
+++ /dev/null
@@ -1,18 +0,0 @@
-allprojects {
- repositories {
- google()
- mavenCentral()
- }
-}
-
-rootProject.buildDir = "../build"
-subprojects {
- project.buildDir = "${rootProject.buildDir}/${project.name}"
-}
-subprojects {
- project.evaluationDependsOn(":app")
-}
-
-tasks.register("clean", Delete) {
- delete rootProject.buildDir
-}
diff --git a/android/build.gradle.kts b/android/build.gradle.kts
new file mode 100644
index 0000000..dbee657
--- /dev/null
+++ b/android/build.gradle.kts
@@ -0,0 +1,24 @@
+allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+val newBuildDir: Directory =
+ rootProject.layout.buildDirectory
+ .dir("../../build")
+ .get()
+rootProject.layout.buildDirectory.value(newBuildDir)
+
+subprojects {
+ val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
+ project.layout.buildDirectory.value(newSubprojectBuildDir)
+}
+subprojects {
+ project.evaluationDependsOn(":app")
+}
+
+tasks.register("clean") {
+ delete(rootProject.layout.buildDirectory)
+}
diff --git a/android/build/reports/problems/problems-report.html b/android/build/reports/problems/problems-report.html
new file mode 100644
index 0000000..defc283
--- /dev/null
+++ b/android/build/reports/problems/problems-report.html
@@ -0,0 +1,663 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Gradle Configuration Cache
+
+
+
+
+
+
+ Loading...
+
+
+
+
+
+
+
diff --git a/android/gradle.properties b/android/gradle.properties
index 5ddc559..a9f5d10 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -1,3 +1,7 @@
-org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
-android.useAndroidX=true
-android.enableJetifier=true
+org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
+android.useAndroidX=true
+# Use full JDK 21 distribution so Gradle toolchains can find javac
+org.gradle.java.home=/usr/lib/jvm/java-1.21.0-openjdk-amd64
+# Help Gradle toolchains locate the installed JDK 21 explicitly
+org.gradle.java.installations.fromEnv=JAVA_HOME
+org.gradle.java.installations.paths=/usr/lib/jvm/java-1.21.0-openjdk-amd64,/usr/lib/jvm/java-21-openjdk-amd64
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 653f2e8..e4ef43f 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
diff --git a/android/settings.gradle b/android/settings.gradle
deleted file mode 100644
index beb05b2..0000000
--- a/android/settings.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-pluginManagement {
- def flutterSdkPath = {
- def properties = new Properties()
- file("local.properties").withInputStream { properties.load(it) }
- def flutterSdkPath = properties.getProperty("flutter.sdk")
- assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
- return flutterSdkPath
- }()
-
- includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
-
- repositories {
- google()
- mavenCentral()
- gradlePluginPortal()
- }
-}
-
-plugins {
- id "dev.flutter.flutter-plugin-loader" version "1.0.0"
- id "com.android.application" version "8.1.0" apply false
- id "org.jetbrains.kotlin.android" version "1.8.22" apply false
-}
-
-include ":app"
diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts
new file mode 100644
index 0000000..ca7fe06
--- /dev/null
+++ b/android/settings.gradle.kts
@@ -0,0 +1,26 @@
+pluginManagement {
+ val flutterSdkPath =
+ run {
+ val properties = java.util.Properties()
+ file("local.properties").inputStream().use { properties.load(it) }
+ val flutterSdkPath = properties.getProperty("flutter.sdk")
+ require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
+ flutterSdkPath
+ }
+
+ includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
+
+ repositories {
+ google()
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+
+plugins {
+ id("dev.flutter.flutter-plugin-loader") version "1.0.0"
+ id("com.android.application") version "8.11.1" apply false
+ id("org.jetbrains.kotlin.android") version "2.2.20" apply false
+}
+
+include(":app")
diff --git "a/assets/documents/books/Einf\303\274hrung in die Philosophie - Arno Anzenbacher.md" "b/assets/documents/books/Einf\303\274hrung in die Philosophie - Arno Anzenbacher.md"
deleted file mode 100644
index b6326d9..0000000
--- "a/assets/documents/books/Einf\303\274hrung in die Philosophie - Arno Anzenbacher.md"
+++ /dev/null
@@ -1,2 +0,0 @@
-Arno Anzenbacher
-
diff --git a/assets/documents/books/fuenfGeheimnisse.md b/assets/documents/books/fuenfGeheimnisse.md
deleted file mode 100644
index 7410319..0000000
--- a/assets/documents/books/fuenfGeheimnisse.md
+++ /dev/null
@@ -1,262 +0,0 @@
-> **_NOTE_** : For now the following content has no deeper meaning.
-> Right now this is my playground for integrating markdown into flutter.
->
-
-# AI Blog
-
-*image_caption*d
-
-
-This is inline latex: $f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x}$
-This is block level latex:
-
-This is inline latex with displayMode: $$f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x}$$
-
-**The Cauchy-Schwarz Inequality**
-
-```math
- \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
-```
-
-
-```c
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __CGROUP_INTERNAL_H
-#define __CGROUP_INTERNAL_H
-
-#include
-#include
-
-#define TRACE_CGROUP_PATH_LEN 1024
-
-
-/*
- * cgroup_path() takes a spin lock. It is good practice not to take
- * spin locks within trace point handlers, as they are mostly hidden
- * from normal view. As cgroup_path() can take the kernfs_rename_lock
- * spin lock, it is best to not call that function from the trace event
- * handler.
- *
- * Note: trace_cgroup_##type##_enabled() is a static branch that will only
- * be set when the trace event is enabled.
- */
-#define TRACE_CGROUP_PATH(type, cgrp, ...) \
- do { \
- if (trace_cgroup_##type##_enabled()) { \
- unsigned long flags; \
- spin_lock_irqsave(&trace_cgroup_path_lock, \
- flags); \
- cgroup_path(cgrp, trace_cgroup_path, \
- TRACE_CGROUP_PATH_LEN); \
- trace_cgroup_##type(cgrp, trace_cgroup_path, \
- ##__VA_ARGS__); \
- spin_unlock_irqrestore(&trace_cgroup_path_lock, \
- flags); \
- } \
- } while (0)
-
-/*
- * The cgroup filesystem superblock creation/mount context.
- */
-struct cgroup_fs_context {
- struct kernfs_fs_context kfc;
- struct cgroup_root *root;
- struct cgroup_namespace *ns;
- unsigned int flags; /* CGRP_ROOT_* flags */
-
- /* cgroup1 bits */
- bool cpuset_clone_children;
- bool none; /* User explicitly requested empty subsystem */
- bool all_ss; /* Seen 'all' option */
- u16 subsys_mask; /* Selected subsystems */
- char *name; /* Hierarchy name */
- char *release_agent; /* Path for release notifications */
-};
-
-static inline struct cgroup_fs_context *cgroup_fc2context(struct fs_context *fc)
-{
- struct kernfs_fs_context *kfc = fc->fs_private;
-
- return container_of(kfc, struct cgroup_fs_context, kfc);
-}
-
-struct cgroup_pidlist;
-
-struct cgroup_file_ctx {
- struct cgroup_namespace *ns;
-
- struct {
- void *trigger;
- } psi;
-
- struct {
- bool started;
- struct css_task_iter iter;
- } procs;
-
- struct {
- struct cgroup_pidlist *pidlist;
- } procs1;
-};
-
-/*
- * A cgroup can be associated with multiple css_sets as different tasks may
- * belong to different cgroups on different hierarchies. In the other
- * direction, a css_set is naturally associated with multiple cgroups.
- * This M:N relationship is represented by the following link structure
- * which exists for each association and allows traversing the associations
- * from both sides.
- */
-struct cgrp_cset_link {
- /* the cgroup and css_set this link associates */
- struct cgroup *cgrp;
- struct css_set *cset;
-
- /* list of cgrp_cset_links anchored at cgrp->cset_links */
- struct list_head cset_link;
-
- /* list of cgrp_cset_links anchored at css_set->cgrp_links */
- struct list_head cgrp_link;
-};
-
-/* used to track tasks and csets during migration */
-struct cgroup_taskset {
- /* the src and dst cset list running through cset->mg_node */
- struct list_head src_csets;
- struct list_head dst_csets;
-
- /* the number of tasks in the set */
- int nr_tasks;
-
- /* the subsys currently being processed */
- int ssid;
-
- /*
- * Fields for cgroup_taskset_*() iteration.
- *
- * Before migration is committed, the target migration tasks are on
- * ->mg_tasks of the csets on ->src_csets. After, on ->mg_tasks of
- * the csets on ->dst_csets. ->csets point to either ->src_csets
- * or ->dst_csets depending on whether migration is committed.
- *
- * ->cur_csets and ->cur_task point to the current task position
- * during iteration.
- */
- struct list_head *csets;
- struct css_set *cur_cset;
- struct task_struct *cur_task;
-};
-
-/* migration context also tracks preloading */
-struct cgroup_mgctx {
- /*
- * Preloaded source and destination csets. Used to guarantee
- * atomic success or failure on actual migration.
- */
- struct list_head preloaded_src_csets;
- struct list_head preloaded_dst_csets;
-
- /* tasks and csets to migrate */
- struct cgroup_taskset tset;
-
- /* subsystems affected by migration */
- u16 ss_mask;
-};
-
-#define CGROUP_TASKSET_INIT(tset) \
-{ \
- .src_csets = LIST_HEAD_INIT(tset.src_csets), \
- .dst_csets = LIST_HEAD_INIT(tset.dst_csets), \
- .csets = &tset.src_csets, \
-}
-
-#define CGROUP_MGCTX_INIT(name) \
-{ \
- LIST_HEAD_INIT(name.preloaded_src_csets), \
- LIST_HEAD_INIT(name.preloaded_dst_csets), \
- CGROUP_TASKSET_INIT(name.tset), \
-}
-
-#define DEFINE_CGROUP_MGCTX(name) \
- struct cgroup_mgctx name = CGROUP_MGCTX_INIT(name)
-
-extern struct cgroup_subsys *cgroup_subsys[];
-extern struct list_head cgroup_roots;
-
-/* iterate across the hierarchies */
-#define for_each_root(root) \
- list_for_each_entry_rcu((root), &cgroup_roots, root_list, \
- lockdep_is_held(&cgroup_mutex))
-
-/**
- * for_each_subsys - iterate all enabled cgroup subsystems
- * @ss: the iteration cursor
- * @ssid: the index of @ss, CGROUP_SUBSYS_COUNT after reaching the end
- */
-#define for_each_subsys(ss, ssid) \
- for ((ssid) = 0; (ssid) < CGROUP_SUBSYS_COUNT && \
- (((ss) = cgroup_subsys[ssid]) || true); (ssid)++)
-
-static inline bool cgroup_is_dead(const struct cgroup *cgrp)
-{
- return !(cgrp->self.flags & CSS_ONLINE);
-}
-
-static inline bool notify_on_release(const struct cgroup *cgrp)
-{
- return test_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
-}
-
-void put_css_set_locked(struct css_set *cset);
-
-static inline void put_css_set(struct css_set *cset)
-{
- unsigned long flags;
-
- /*
- * Ensure that the refcount doesn't hit zero while any readers
- * can see it. Similar to atomic_dec_and_lock(), but for an
- * rwlock
- */
- if (refcount_dec_not_one(&cset->refcount))
- return;
-
- spin_lock_irqsave(&css_set_lock, flags);
- put_css_set_locked(cset);
- spin_unlock_irqrestore(&css_set_lock, flags);
-}
-
-/*
- * refcounted get/put for css_set objects
- */
-static inline void get_css_set(struct css_set *cset)
-{
- refcount_inc(&cset->refcount);
-}
-#endif /* __CGROUP_INTERNAL_H */
-```
-| | Command | Description |
-| ----- | -------- | --------------------------------- |
-| | `git status` | List all new or modified files |
-| | `git-diff` | Show file differences that haven't been staged|
-
-> **_NOTE:_** Das Impressum befindet sich in einer experimentellen Phase und
-beinhaltet derzeit unvollständige/dummy Daten.
-
-## Anbieter
-Jonas Heinle
-Elchwinkel 42
-12345 Bärstadt
-
-
-## Links
-
-### E-Mail
-- für allgemeine Anfragen: [Kontakt zu mir](#)
-
-## Externe Links
-- [philoclopedia.de](#)
-- [johannes-heinle.de](#)
-
-
-Stand: 13.02.2024
diff --git a/assets/documents/cv/CV_Jonas_Heinle_english.pdf b/assets/documents/cv/CV_Jonas_Heinle_english.pdf
deleted file mode 100644
index 6edc5aa..0000000
Binary files a/assets/documents/cv/CV_Jonas_Heinle_english.pdf and /dev/null differ
diff --git a/assets/documents/cv/CV_Jonas_Heinle_german.pdf b/assets/documents/cv/CV_Jonas_Heinle_german.pdf
deleted file mode 100644
index 09dd607..0000000
Binary files a/assets/documents/cv/CV_Jonas_Heinle_german.pdf and /dev/null differ
diff --git a/assets/documents/games/Gothic1.md b/assets/documents/games/Gothic1.md
deleted file mode 100644
index 253b325..0000000
--- a/assets/documents/games/Gothic1.md
+++ /dev/null
@@ -1,263 +0,0 @@
-> ***NOTE*** : For now the following content has no deeper meaning.
-> Right now this is my playground for integrating markdown into flutter.
-
-# AI Blog
-
-
-*image_caption*d
-
-This is inline latex: $f(x) = \\sum\_{i=0}^{n} \\frac{a_i}{1+x}$
-This is block level latex:
-
-This is inline latex with displayMode: $$f(x) = \\sum\_{i=0}^{n} \\frac{a_i}{1+x}$$
-
-**The Cauchy-Schwarz Inequality**
-
-```math
- \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
-```
-
-```c
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __CGROUP_INTERNAL_H
-#define __CGROUP_INTERNAL_H
-
-#include
-#include
-
-#define TRACE_CGROUP_PATH_LEN 1024
-
-
-/*
- * cgroup_path() takes a spin lock. It is good practice not to take
- * spin locks within trace point handlers, as they are mostly hidden
- * from normal view. As cgroup_path() can take the kernfs_rename_lock
- * spin lock, it is best to not call that function from the trace event
- * handler.
- *
- * Note: trace_cgroup_##type##_enabled() is a static branch that will only
- * be set when the trace event is enabled.
- */
-#define TRACE_CGROUP_PATH(type, cgrp, ...) \
- do { \
- if (trace_cgroup_##type##_enabled()) { \
- unsigned long flags; \
- spin_lock_irqsave(&trace_cgroup_path_lock, \
- flags); \
- cgroup_path(cgrp, trace_cgroup_path, \
- TRACE_CGROUP_PATH_LEN); \
- trace_cgroup_##type(cgrp, trace_cgroup_path, \
- ##__VA_ARGS__); \
- spin_unlock_irqrestore(&trace_cgroup_path_lock, \
- flags); \
- } \
- } while (0)
-
-/*
- * The cgroup filesystem superblock creation/mount context.
- */
-struct cgroup_fs_context {
- struct kernfs_fs_context kfc;
- struct cgroup_root *root;
- struct cgroup_namespace *ns;
- unsigned int flags; /* CGRP_ROOT_* flags */
-
- /* cgroup1 bits */
- bool cpuset_clone_children;
- bool none; /* User explicitly requested empty subsystem */
- bool all_ss; /* Seen 'all' option */
- u16 subsys_mask; /* Selected subsystems */
- char *name; /* Hierarchy name */
- char *release_agent; /* Path for release notifications */
-};
-
-static inline struct cgroup_fs_context *cgroup_fc2context(struct fs_context *fc)
-{
- struct kernfs_fs_context *kfc = fc->fs_private;
-
- return container_of(kfc, struct cgroup_fs_context, kfc);
-}
-
-struct cgroup_pidlist;
-
-struct cgroup_file_ctx {
- struct cgroup_namespace *ns;
-
- struct {
- void *trigger;
- } psi;
-
- struct {
- bool started;
- struct css_task_iter iter;
- } procs;
-
- struct {
- struct cgroup_pidlist *pidlist;
- } procs1;
-};
-
-/*
- * A cgroup can be associated with multiple css_sets as different tasks may
- * belong to different cgroups on different hierarchies. In the other
- * direction, a css_set is naturally associated with multiple cgroups.
- * This M:N relationship is represented by the following link structure
- * which exists for each association and allows traversing the associations
- * from both sides.
- */
-struct cgrp_cset_link {
- /* the cgroup and css_set this link associates */
- struct cgroup *cgrp;
- struct css_set *cset;
-
- /* list of cgrp_cset_links anchored at cgrp->cset_links */
- struct list_head cset_link;
-
- /* list of cgrp_cset_links anchored at css_set->cgrp_links */
- struct list_head cgrp_link;
-};
-
-/* used to track tasks and csets during migration */
-struct cgroup_taskset {
- /* the src and dst cset list running through cset->mg_node */
- struct list_head src_csets;
- struct list_head dst_csets;
-
- /* the number of tasks in the set */
- int nr_tasks;
-
- /* the subsys currently being processed */
- int ssid;
-
- /*
- * Fields for cgroup_taskset_*() iteration.
- *
- * Before migration is committed, the target migration tasks are on
- * ->mg_tasks of the csets on ->src_csets. After, on ->mg_tasks of
- * the csets on ->dst_csets. ->csets point to either ->src_csets
- * or ->dst_csets depending on whether migration is committed.
- *
- * ->cur_csets and ->cur_task point to the current task position
- * during iteration.
- */
- struct list_head *csets;
- struct css_set *cur_cset;
- struct task_struct *cur_task;
-};
-
-/* migration context also tracks preloading */
-struct cgroup_mgctx {
- /*
- * Preloaded source and destination csets. Used to guarantee
- * atomic success or failure on actual migration.
- */
- struct list_head preloaded_src_csets;
- struct list_head preloaded_dst_csets;
-
- /* tasks and csets to migrate */
- struct cgroup_taskset tset;
-
- /* subsystems affected by migration */
- u16 ss_mask;
-};
-
-#define CGROUP_TASKSET_INIT(tset) \
-{ \
- .src_csets = LIST_HEAD_INIT(tset.src_csets), \
- .dst_csets = LIST_HEAD_INIT(tset.dst_csets), \
- .csets = &tset.src_csets, \
-}
-
-#define CGROUP_MGCTX_INIT(name) \
-{ \
- LIST_HEAD_INIT(name.preloaded_src_csets), \
- LIST_HEAD_INIT(name.preloaded_dst_csets), \
- CGROUP_TASKSET_INIT(name.tset), \
-}
-
-#define DEFINE_CGROUP_MGCTX(name) \
- struct cgroup_mgctx name = CGROUP_MGCTX_INIT(name)
-
-extern struct cgroup_subsys *cgroup_subsys[];
-extern struct list_head cgroup_roots;
-
-/* iterate across the hierarchies */
-#define for_each_root(root) \
- list_for_each_entry_rcu((root), &cgroup_roots, root_list, \
- lockdep_is_held(&cgroup_mutex))
-
-/**
- * for_each_subsys - iterate all enabled cgroup subsystems
- * @ss: the iteration cursor
- * @ssid: the index of @ss, CGROUP_SUBSYS_COUNT after reaching the end
- */
-#define for_each_subsys(ss, ssid) \
- for ((ssid) = 0; (ssid) < CGROUP_SUBSYS_COUNT && \
- (((ss) = cgroup_subsys[ssid]) || true); (ssid)++)
-
-static inline bool cgroup_is_dead(const struct cgroup *cgrp)
-{
- return !(cgrp->self.flags & CSS_ONLINE);
-}
-
-static inline bool notify_on_release(const struct cgroup *cgrp)
-{
- return test_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
-}
-
-void put_css_set_locked(struct css_set *cset);
-
-static inline void put_css_set(struct css_set *cset)
-{
- unsigned long flags;
-
- /*
- * Ensure that the refcount doesn't hit zero while any readers
- * can see it. Similar to atomic_dec_and_lock(), but for an
- * rwlock
- */
- if (refcount_dec_not_one(&cset->refcount))
- return;
-
- spin_lock_irqsave(&css_set_lock, flags);
- put_css_set_locked(cset);
- spin_unlock_irqrestore(&css_set_lock, flags);
-}
-
-/*
- * refcounted get/put for css_set objects
- */
-static inline void get_css_set(struct css_set *cset)
-{
- refcount_inc(&cset->refcount);
-}
-#endif /* __CGROUP_INTERNAL_H */
-```
-
-| | Command | Description |
-|--|---------|-------------|
-| | `git status` | List all new or modified files |
-| | `git-diff` | Show file differences that haven't been staged |
-
-> ***NOTE:*** Das Impressum befindet sich in einer experimentellen Phase und
-> beinhaltet derzeit unvollständige/dummy Daten.
-
-## Anbieter
-
-Jonas Heinle
-Elchwinkel 42
-12345 Bärstadt
-
-
-## Links
-
-### E-Mail
-
-- für allgemeine Anfragen: [Kontakt zu mir](#)
-
-## Externe Links
-
-- [philoclopedia.de](#)
-- [johannes-heinle.de](#)
-
-Stand: 13.02.2024
\ No newline at end of file
diff --git a/assets/documents/thesis/Bachelor_Thesis.pdf b/assets/documents/thesis/Bachelor_Thesis.pdf
deleted file mode 100644
index 3d616bb..0000000
Binary files a/assets/documents/thesis/Bachelor_Thesis.pdf and /dev/null differ
diff --git a/assets/documents/thesis/Master_Thesis.pdf b/assets/documents/thesis/Master_Thesis.pdf
deleted file mode 100644
index fdefc3b..0000000
Binary files a/assets/documents/thesis/Master_Thesis.pdf and /dev/null differ
diff --git a/assets/fonts/Noto_Sans/NotoSans-Italic-VariableFont_wdth,wght.ttf b/assets/fonts/Noto_Sans/NotoSans-Italic-VariableFont_wdth,wght.ttf
new file mode 100644
index 0000000..6245ba0
Binary files /dev/null and b/assets/fonts/Noto_Sans/NotoSans-Italic-VariableFont_wdth,wght.ttf differ
diff --git a/assets/fonts/Noto_Sans/NotoSans-VariableFont_wdth,wght.ttf b/assets/fonts/Noto_Sans/NotoSans-VariableFont_wdth,wght.ttf
new file mode 100644
index 0000000..9530d84
Binary files /dev/null and b/assets/fonts/Noto_Sans/NotoSans-VariableFont_wdth,wght.ttf differ
diff --git a/assets/fonts/Noto_Sans/OFL.txt b/assets/fonts/Noto_Sans/OFL.txt
new file mode 100644
index 0000000..09f020b
--- /dev/null
+++ b/assets/fonts/Noto_Sans/OFL.txt
@@ -0,0 +1,93 @@
+Copyright 2022 The Noto Project Authors (https://github.com/notofonts/latin-greek-cyrillic)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://openfontlicense.org
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/assets/fonts/Noto_Sans/README.txt b/assets/fonts/Noto_Sans/README.txt
new file mode 100644
index 0000000..4958bee
--- /dev/null
+++ b/assets/fonts/Noto_Sans/README.txt
@@ -0,0 +1,136 @@
+Noto Sans Variable Font
+=======================
+
+This download contains Noto Sans as both variable fonts and static fonts.
+
+Noto Sans is a variable font with these axes:
+ wdth
+ wght
+
+This means all the styles are contained in these files:
+ NotoSans-VariableFont_wdth,wght.ttf
+ NotoSans-Italic-VariableFont_wdth,wght.ttf
+
+If your app fully supports variable fonts, you can now pick intermediate styles
+that aren’t available as static fonts. Not all apps support variable fonts, and
+in those cases you can use the static font files for Noto Sans:
+ static/NotoSans_ExtraCondensed-Thin.ttf
+ static/NotoSans_ExtraCondensed-ExtraLight.ttf
+ static/NotoSans_ExtraCondensed-Light.ttf
+ static/NotoSans_ExtraCondensed-Regular.ttf
+ static/NotoSans_ExtraCondensed-Medium.ttf
+ static/NotoSans_ExtraCondensed-SemiBold.ttf
+ static/NotoSans_ExtraCondensed-Bold.ttf
+ static/NotoSans_ExtraCondensed-ExtraBold.ttf
+ static/NotoSans_ExtraCondensed-Black.ttf
+ static/NotoSans_Condensed-Thin.ttf
+ static/NotoSans_Condensed-ExtraLight.ttf
+ static/NotoSans_Condensed-Light.ttf
+ static/NotoSans_Condensed-Regular.ttf
+ static/NotoSans_Condensed-Medium.ttf
+ static/NotoSans_Condensed-SemiBold.ttf
+ static/NotoSans_Condensed-Bold.ttf
+ static/NotoSans_Condensed-ExtraBold.ttf
+ static/NotoSans_Condensed-Black.ttf
+ static/NotoSans_SemiCondensed-Thin.ttf
+ static/NotoSans_SemiCondensed-ExtraLight.ttf
+ static/NotoSans_SemiCondensed-Light.ttf
+ static/NotoSans_SemiCondensed-Regular.ttf
+ static/NotoSans_SemiCondensed-Medium.ttf
+ static/NotoSans_SemiCondensed-SemiBold.ttf
+ static/NotoSans_SemiCondensed-Bold.ttf
+ static/NotoSans_SemiCondensed-ExtraBold.ttf
+ static/NotoSans_SemiCondensed-Black.ttf
+ static/NotoSans-Thin.ttf
+ static/NotoSans-ExtraLight.ttf
+ static/NotoSans-Light.ttf
+ static/NotoSans-Regular.ttf
+ static/NotoSans-Medium.ttf
+ static/NotoSans-SemiBold.ttf
+ static/NotoSans-Bold.ttf
+ static/NotoSans-ExtraBold.ttf
+ static/NotoSans-Black.ttf
+ static/NotoSans_ExtraCondensed-ThinItalic.ttf
+ static/NotoSans_ExtraCondensed-ExtraLightItalic.ttf
+ static/NotoSans_ExtraCondensed-LightItalic.ttf
+ static/NotoSans_ExtraCondensed-Italic.ttf
+ static/NotoSans_ExtraCondensed-MediumItalic.ttf
+ static/NotoSans_ExtraCondensed-SemiBoldItalic.ttf
+ static/NotoSans_ExtraCondensed-BoldItalic.ttf
+ static/NotoSans_ExtraCondensed-ExtraBoldItalic.ttf
+ static/NotoSans_ExtraCondensed-BlackItalic.ttf
+ static/NotoSans_Condensed-ThinItalic.ttf
+ static/NotoSans_Condensed-ExtraLightItalic.ttf
+ static/NotoSans_Condensed-LightItalic.ttf
+ static/NotoSans_Condensed-Italic.ttf
+ static/NotoSans_Condensed-MediumItalic.ttf
+ static/NotoSans_Condensed-SemiBoldItalic.ttf
+ static/NotoSans_Condensed-BoldItalic.ttf
+ static/NotoSans_Condensed-ExtraBoldItalic.ttf
+ static/NotoSans_Condensed-BlackItalic.ttf
+ static/NotoSans_SemiCondensed-ThinItalic.ttf
+ static/NotoSans_SemiCondensed-ExtraLightItalic.ttf
+ static/NotoSans_SemiCondensed-LightItalic.ttf
+ static/NotoSans_SemiCondensed-Italic.ttf
+ static/NotoSans_SemiCondensed-MediumItalic.ttf
+ static/NotoSans_SemiCondensed-SemiBoldItalic.ttf
+ static/NotoSans_SemiCondensed-BoldItalic.ttf
+ static/NotoSans_SemiCondensed-ExtraBoldItalic.ttf
+ static/NotoSans_SemiCondensed-BlackItalic.ttf
+ static/NotoSans-ThinItalic.ttf
+ static/NotoSans-ExtraLightItalic.ttf
+ static/NotoSans-LightItalic.ttf
+ static/NotoSans-Italic.ttf
+ static/NotoSans-MediumItalic.ttf
+ static/NotoSans-SemiBoldItalic.ttf
+ static/NotoSans-BoldItalic.ttf
+ static/NotoSans-ExtraBoldItalic.ttf
+ static/NotoSans-BlackItalic.ttf
+
+Get started
+-----------
+
+1. Install the font files you want to use
+
+2. Use your app's font picker to view the font family and all the
+available styles
+
+Learn more about variable fonts
+-------------------------------
+
+ https://developers.google.com/web/fundamentals/design-and-ux/typography/variable-fonts
+ https://variablefonts.typenetwork.com
+ https://medium.com/variable-fonts
+
+In desktop apps
+
+ https://theblog.adobe.com/can-variable-fonts-illustrator-cc
+ https://helpx.adobe.com/nz/photoshop/using/fonts.html#variable_fonts
+
+Online
+
+ https://developers.google.com/fonts/docs/getting_started
+ https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/Variable_Fonts_Guide
+ https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/variable-fonts
+
+Installing fonts
+
+ MacOS: https://support.apple.com/en-us/HT201749
+ Linux: https://www.google.com/search?q=how+to+install+a+font+on+gnu%2Blinux
+ Windows: https://support.microsoft.com/en-us/help/314960/how-to-install-or-remove-a-font-in-windows
+
+Android Apps
+
+ https://developers.google.com/fonts/docs/android
+ https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts
+
+License
+-------
+Please read the full license text (OFL.txt) to understand the permissions,
+restrictions and requirements for usage, redistribution, and modification.
+
+You can use them in your products & projects – print or digital,
+commercial or otherwise.
+
+This isn't legal advice, please consider consulting a lawyer and see the full
+license for all details.
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-Black.ttf b/assets/fonts/Noto_Sans/static/NotoSans-Black.ttf
new file mode 100644
index 0000000..d5a6e0d
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-Black.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-BlackItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans-BlackItalic.ttf
new file mode 100644
index 0000000..dfc640c
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-BlackItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-Bold.ttf b/assets/fonts/Noto_Sans/static/NotoSans-Bold.ttf
new file mode 100644
index 0000000..07f0d25
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-Bold.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-BoldItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans-BoldItalic.ttf
new file mode 100644
index 0000000..e538eae
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-BoldItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-ExtraBold.ttf b/assets/fonts/Noto_Sans/static/NotoSans-ExtraBold.ttf
new file mode 100644
index 0000000..5868446
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-ExtraBold.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-ExtraBoldItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans-ExtraBoldItalic.ttf
new file mode 100644
index 0000000..68abd4c
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-ExtraBoldItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-ExtraLight.ttf b/assets/fonts/Noto_Sans/static/NotoSans-ExtraLight.ttf
new file mode 100644
index 0000000..078f8dc
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-ExtraLight.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-ExtraLightItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans-ExtraLightItalic.ttf
new file mode 100644
index 0000000..acaa466
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-ExtraLightItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-Italic.ttf b/assets/fonts/Noto_Sans/static/NotoSans-Italic.ttf
new file mode 100644
index 0000000..d9b9e14
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-Italic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-Light.ttf b/assets/fonts/Noto_Sans/static/NotoSans-Light.ttf
new file mode 100644
index 0000000..8d8a678
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-Light.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-LightItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans-LightItalic.ttf
new file mode 100644
index 0000000..0ab65c0
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-LightItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-Medium.ttf b/assets/fonts/Noto_Sans/static/NotoSans-Medium.ttf
new file mode 100644
index 0000000..a44124b
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-Medium.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-MediumItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans-MediumItalic.ttf
new file mode 100644
index 0000000..467af1b
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-MediumItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-Regular.ttf b/assets/fonts/Noto_Sans/static/NotoSans-Regular.ttf
new file mode 100644
index 0000000..4bac02f
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-Regular.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-SemiBold.ttf b/assets/fonts/Noto_Sans/static/NotoSans-SemiBold.ttf
new file mode 100644
index 0000000..e846749
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-SemiBold.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-SemiBoldItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans-SemiBoldItalic.ttf
new file mode 100644
index 0000000..cacc7ec
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-SemiBoldItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-Thin.ttf b/assets/fonts/Noto_Sans/static/NotoSans-Thin.ttf
new file mode 100644
index 0000000..04335a5
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-Thin.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans-ThinItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans-ThinItalic.ttf
new file mode 100644
index 0000000..910dfc7
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans-ThinItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Black.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Black.ttf
new file mode 100644
index 0000000..3186699
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Black.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-BlackItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-BlackItalic.ttf
new file mode 100644
index 0000000..d4b19bc
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-BlackItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Bold.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Bold.ttf
new file mode 100644
index 0000000..bb82d6b
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Bold.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-BoldItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-BoldItalic.ttf
new file mode 100644
index 0000000..c31898f
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-BoldItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ExtraBold.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ExtraBold.ttf
new file mode 100644
index 0000000..cb36919
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ExtraBold.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ExtraBoldItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ExtraBoldItalic.ttf
new file mode 100644
index 0000000..7bbea17
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ExtraBoldItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ExtraLight.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ExtraLight.ttf
new file mode 100644
index 0000000..29a7751
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ExtraLight.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ExtraLightItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ExtraLightItalic.ttf
new file mode 100644
index 0000000..983b81a
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ExtraLightItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Italic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Italic.ttf
new file mode 100644
index 0000000..8e2d1f8
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Italic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Light.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Light.ttf
new file mode 100644
index 0000000..32c58a5
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Light.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-LightItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-LightItalic.ttf
new file mode 100644
index 0000000..c5d1b45
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-LightItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Medium.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Medium.ttf
new file mode 100644
index 0000000..45f8ea4
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Medium.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-MediumItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-MediumItalic.ttf
new file mode 100644
index 0000000..92cd88a
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-MediumItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Regular.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Regular.ttf
new file mode 100644
index 0000000..3ad9a1b
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Regular.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-SemiBold.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-SemiBold.ttf
new file mode 100644
index 0000000..2f20a21
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-SemiBold.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-SemiBoldItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-SemiBoldItalic.ttf
new file mode 100644
index 0000000..b28147d
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-SemiBoldItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Thin.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Thin.ttf
new file mode 100644
index 0000000..d5b50b5
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-Thin.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ThinItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ThinItalic.ttf
new file mode 100644
index 0000000..00d9315
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_Condensed-ThinItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Black.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Black.ttf
new file mode 100644
index 0000000..619c4f8
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Black.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-BlackItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-BlackItalic.ttf
new file mode 100644
index 0000000..f124627
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-BlackItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Bold.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Bold.ttf
new file mode 100644
index 0000000..2854b42
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Bold.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-BoldItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-BoldItalic.ttf
new file mode 100644
index 0000000..3f6f8ac
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-BoldItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ExtraBold.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ExtraBold.ttf
new file mode 100644
index 0000000..2ce3cb3
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ExtraBold.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ExtraBoldItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ExtraBoldItalic.ttf
new file mode 100644
index 0000000..9892967
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ExtraBoldItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ExtraLight.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ExtraLight.ttf
new file mode 100644
index 0000000..ce67cb1
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ExtraLight.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ExtraLightItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ExtraLightItalic.ttf
new file mode 100644
index 0000000..45726c3
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ExtraLightItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Italic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Italic.ttf
new file mode 100644
index 0000000..e6b1a73
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Italic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Light.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Light.ttf
new file mode 100644
index 0000000..5e9fef8
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Light.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-LightItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-LightItalic.ttf
new file mode 100644
index 0000000..500c919
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-LightItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Medium.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Medium.ttf
new file mode 100644
index 0000000..c78465e
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Medium.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-MediumItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-MediumItalic.ttf
new file mode 100644
index 0000000..527291a
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-MediumItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Regular.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Regular.ttf
new file mode 100644
index 0000000..8921daa
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Regular.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-SemiBold.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-SemiBold.ttf
new file mode 100644
index 0000000..83b98b2
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-SemiBold.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-SemiBoldItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-SemiBoldItalic.ttf
new file mode 100644
index 0000000..9dedf3e
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-SemiBoldItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Thin.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Thin.ttf
new file mode 100644
index 0000000..81e2bf9
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-Thin.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ThinItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ThinItalic.ttf
new file mode 100644
index 0000000..17b43b1
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_ExtraCondensed-ThinItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Black.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Black.ttf
new file mode 100644
index 0000000..5a141da
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Black.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-BlackItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-BlackItalic.ttf
new file mode 100644
index 0000000..538888d
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-BlackItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Bold.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Bold.ttf
new file mode 100644
index 0000000..e0cd54f
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Bold.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-BoldItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-BoldItalic.ttf
new file mode 100644
index 0000000..e7b743a
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-BoldItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ExtraBold.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ExtraBold.ttf
new file mode 100644
index 0000000..c50c081
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ExtraBold.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ExtraBoldItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ExtraBoldItalic.ttf
new file mode 100644
index 0000000..b8b053e
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ExtraBoldItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ExtraLight.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ExtraLight.ttf
new file mode 100644
index 0000000..6450a04
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ExtraLight.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ExtraLightItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ExtraLightItalic.ttf
new file mode 100644
index 0000000..a655d1e
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ExtraLightItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Italic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Italic.ttf
new file mode 100644
index 0000000..67c7a2f
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Italic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Light.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Light.ttf
new file mode 100644
index 0000000..f9221c3
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Light.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-LightItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-LightItalic.ttf
new file mode 100644
index 0000000..9a72200
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-LightItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Medium.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Medium.ttf
new file mode 100644
index 0000000..e2c825c
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Medium.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-MediumItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-MediumItalic.ttf
new file mode 100644
index 0000000..6be577a
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-MediumItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Regular.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Regular.ttf
new file mode 100644
index 0000000..06a2982
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Regular.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-SemiBold.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-SemiBold.ttf
new file mode 100644
index 0000000..8c8f313
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-SemiBold.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-SemiBoldItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-SemiBoldItalic.ttf
new file mode 100644
index 0000000..59093a9
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-SemiBoldItalic.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Thin.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Thin.ttf
new file mode 100644
index 0000000..7d7ef33
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-Thin.ttf differ
diff --git a/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ThinItalic.ttf b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ThinItalic.ttf
new file mode 100644
index 0000000..44084d9
Binary files /dev/null and b/assets/fonts/Noto_Sans/static/NotoSans_SemiCondensed-ThinItalic.ttf differ
diff --git a/assets/icons/kataglyphis_app_icon.png b/assets/icons/kataglyphis_app_icon.png
new file mode 100644
index 0000000..800d5d1
Binary files /dev/null and b/assets/icons/kataglyphis_app_icon.png differ
diff --git a/assets/icons/kataglyphis_app_icon.svg b/assets/icons/kataglyphis_app_icon.svg
new file mode 100644
index 0000000..43e4f34
--- /dev/null
+++ b/assets/icons/kataglyphis_app_icon.svg
@@ -0,0 +1,55 @@
+
+
diff --git a/default.profraw b/default.profraw
index 086e567..8bcc55b 100644
Binary files a/default.profraw and b/default.profraw differ
diff --git a/docs/source/README.md b/docs/source/README.md
index ded6d49..9a8c350 100644
--- a/docs/source/README.md
+++ b/docs/source/README.md
@@ -1,191 +1,29 @@
\n * @typedef {object} GstWebRTCConfig\n * @property {object} meta=null - Client free-form information that will be exchanged with all peers through the\n * signaling meta property, its content depends on your application.\n * @property {string} signalingServerUrl=ws://127.0.0.1:8443 - The WebRTC signaling server URL.\n * @property {number} reconnectionTimeout=2500 - Timeout in milliseconds to reconnect to the signaling server in\n * case of an unexpected disconnection.\n * @property {object} webrtcConfig={iceServers...} - The WebRTC peer connection configuration passed to\n * {@link RTCPeerConnection}. Default configuration only includes a list of free STUN servers\n * (stun[0-4].l.google.com:19302).\n */\n\n/**\n * Default GstWebRTCAPI configuration.\n * @type {GstWebRTCConfig}\n */\nconst defaultConfig = Object.freeze({\n meta: null,\n signalingServerUrl: \"ws://127.0.0.1:8443\",\n reconnectionTimeout: 2500,\n webrtcConfig: {\n iceServers: [\n {\n urls: [\n \"stun:stun.l.google.com:19302\",\n \"stun:stun1.l.google.com:19302\"\n ]\n }\n ],\n bundlePolicy: \"max-bundle\"\n }\n});\n\nexport default defaultConfig;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\n/**\n * Session states enumeration. \n * Session state always increases from idle to closed and never switches backwards.\n * @enum {number}\n * @readonly\n */\nconst SessionState = /** @type {const} */ {\n /**\n * (0) Default state when creating a new session, goes to connecting when starting the session.\n */\n idle: 0,\n /**\n * (1) Session is trying to connect to remote peers, goes to streaming in case of\n * success or closed in case of error.\n */\n connecting: 1,\n /**\n * (2) Session is correctly connected to remote peers and currently streaming audio/video, goes\n * to closed when any peer closes the session.\n */\n streaming: 2,\n /**\n * (3) Session is closed and can be garbage collected, state will not change anymore.\n */\n closed: 3\n};\nObject.freeze(SessionState);\n\nexport default SessionState;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport SessionState from \"./session-state.js\";\n\n/** @import ProducerSession from \"./producer-session.js\"; */\n/** @import ClientSession from \"./producer-session.js\"; */\n\n/**\n * Event name: \"error\". \n * Triggered when any kind of error occurs.\n *
When emitted by a session, it is in general an unrecoverable error. Normally, the session is automatically closed\n * but in the specific case of a {@link ProducerSession}, when the error occurs on an underlying\n * {@link ClientSession} between the producer session and a remote client consuming the streamed media,\n * then only the failing {@link ClientSession} is closed. The producer session can keep on serving the\n * other consumer peers.
The remote control data channel is created by the GStreamer webrtcsink element on the producer side. Then it is\n * announced through the consumer session thanks to the {@link gstWebRTCAPI#event:RemoteControllerChangedEvent}\n * event.
\n *
You can attach an {@link HTMLVideoElement} to the remote controller, then all mouse and keyboard events\n * emitted by this element will be automatically relayed to the remote producer.
\n * @extends {EventTarget}\n * @fires {@link GstWebRTCAPI#event:ErrorEvent}\n * @fires {@link GstWebRTCAPI#event:ClosedEvent}\n * @fires {@link GstWebRTCAPI#event:InfoEvent}\n * @fires {@link GstWebRTCAPI#event:ControlResponseEvent}\n * @see ConsumerSession#remoteController\n * @see RemoteController#attachVideoElement\n * @see https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/tree/main/net/webrtc/gstwebrtc-api#produce-a-gstreamer-interactive-webrtc-stream-with-remote-control\n */\nclass RemoteController extends EventTarget {\n constructor(rtcDataChannel, consumerSession) {\n super();\n\n this._rtcDataChannel = rtcDataChannel;\n this._consumerSession = consumerSession;\n\n this._videoElement = null;\n this._videoElementComputedStyle = null;\n this._videoElementKeyboard = null;\n this._lastTouchEventTimestamp = 0;\n this._requestCounter = 0;\n\n rtcDataChannel.addEventListener(\"close\", () => {\n if (this._rtcDataChannel === rtcDataChannel) {\n this.close();\n }\n });\n\n rtcDataChannel.addEventListener(\"error\", (event) => {\n if (this._rtcDataChannel === rtcDataChannel) {\n const error = event.error;\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: (error && error.message) || \"Remote controller error\",\n error: error || new Error(\"unknown error on the remote controller data channel\")\n }));\n }\n });\n\n rtcDataChannel.addEventListener(\"message\", (event) => {\n try {\n const msg = JSON.parse(event.data);\n\n if (msg.type === \"ControlResponseMessage\") {\n this.dispatchEvent(new CustomEvent(\"controlResponse\", { detail: msg }));\n } else if (msg.type === \"InfoMessage\") {\n this.dispatchEvent(new CustomEvent(\"info\", { detail: msg }));\n }\n } catch (ex) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot parse control message from signaling server\",\n error: ex\n }));\n }\n });\n }\n\n\n /**\n * The underlying WebRTC data channel connected to a remote GStreamer webrtcsink producer offering remote control.\n * The value may be null if the remote controller has been closed.\n * @type {RTCDataChannel}\n * @readonly\n */\n get rtcDataChannel() {\n return this._rtcDataChannel;\n }\n\n /**\n * The consumer session associated with this remote controller.\n * @type {ConsumerSession}\n * @readonly\n */\n get consumerSession() {\n return this._consumerSession;\n }\n\n /**\n * The video element that is currently used to send all mouse and keyboard events to the remote producer. Value may\n * be null if no video element is attached.\n * @type {HTMLVideoElement}\n * @readonly\n * @see RemoteController#attachVideoElement\n */\n get videoElement() {\n return this._videoElement;\n }\n\n /**\n * Associates a video element with this remote controller. \n * When a video element is attached to this remote controller, all mouse and keyboard events emitted by this\n * element will be sent to the remote GStreamer webrtcink producer.\n * @param {HTMLVideoElement|null} element - the video element to use to relay mouse and keyboard events,\n * or null to detach any previously attached element. If the provided element parameter is not null and not a\n * valid instance of an {@link HTMLVideoElement}, then the method does nothing.\n */\n attachVideoElement(element) {\n if ((element instanceof HTMLVideoElement) && (element !== this._videoElement)) {\n if (this._videoElement) {\n this.attachVideoElement(null);\n }\n\n this._videoElement = element;\n this._videoElementComputedStyle = window.getComputedStyle(element);\n\n for (const eventName of eventsNames) {\n element.addEventListener(eventName, this);\n }\n\n element.setAttribute(\"tabindex\", \"0\");\n } else if ((element === null) && this._videoElement) {\n const previousElement = this._videoElement;\n previousElement.removeAttribute(\"tabindex\");\n\n this._videoElement = null;\n this._videoElementComputedStyle = null;\n\n this._lastTouchEventTimestamp = 0;\n\n for (const eventName of eventsNames) {\n previousElement.removeEventListener(eventName, this);\n }\n }\n }\n\n /**\n * Send a request over the control data channel. \n *\n * @fires {@link GstWebRTCAPI#event:ErrorEvent}\n * @param {object|string} request - The request to send over the channel\n * @returns {number} The identifier attributed to the request, or -1 if an exception occurred\n */\n sendControlRequest(request) {\n try {\n if (!request || ((typeof (request) !== \"object\") && (typeof (request) !== \"string\"))) {\n throw new Error(\"invalid request\");\n }\n\n if (!this._rtcDataChannel) {\n throw new Error(\"remote controller data channel is closed\");\n }\n\n let message = {\n id: this._requestCounter++,\n request: request\n };\n\n this._rtcDataChannel.send(JSON.stringify(message));\n\n return message.id;\n } catch (ex) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: `cannot send control message over session ${this._consumerSession.sessionId} remote controller`,\n error: ex\n }));\n return -1;\n }\n }\n\n /**\n * Closes the remote controller channel. \n * It immediately shuts down the underlying WebRTC data channel connected to a remote GStreamer webrtcsink\n * producer and detaches any video element that may be used to relay mouse and keyboard events.\n */\n close() {\n this.attachVideoElement(null);\n\n const rtcDataChannel = this._rtcDataChannel;\n this._rtcDataChannel = null;\n\n if (rtcDataChannel) {\n rtcDataChannel.close();\n this.dispatchEvent(new Event(\"closed\"));\n }\n }\n\n _sendGstNavigationEvent(data) {\n let request = {\n type: \"navigationEvent\",\n event: data\n };\n this.sendControlRequest(request);\n }\n\n _computeVideoMousePosition(event) {\n const mousePos = { x: 0, y: 0 };\n if (!this._videoElement || (this._videoElement.videoWidth <= 0) || (this._videoElement.videoHeight <= 0)) {\n return mousePos;\n }\n\n const padding = {\n left: parseFloat(this._videoElementComputedStyle.paddingLeft),\n right: parseFloat(this._videoElementComputedStyle.paddingRight),\n top: parseFloat(this._videoElementComputedStyle.paddingTop),\n bottom: parseFloat(this._videoElementComputedStyle.paddingBottom)\n };\n\n if ((\"offsetX\" in event) && (\"offsetY\" in event)) {\n mousePos.x = event.offsetX - padding.left;\n mousePos.y = event.offsetY - padding.top;\n } else {\n const clientRect = this._videoElement.getBoundingClientRect();\n const border = {\n left: parseFloat(this._videoElementComputedStyle.borderLeftWidth),\n top: parseFloat(this._videoElementComputedStyle.borderTopWidth)\n };\n mousePos.x = event.clientX - clientRect.left - border.left - padding.left;\n mousePos.y = event.clientY - clientRect.top - border.top - padding.top;\n }\n\n const videoOffset = {\n x: this._videoElement.clientWidth - (padding.left + padding.right),\n y: this._videoElement.clientHeight - (padding.top + padding.bottom)\n };\n\n const ratio = Math.min(videoOffset.x / this._videoElement.videoWidth, videoOffset.y / this._videoElement.videoHeight);\n videoOffset.x = Math.max(0.5 * (videoOffset.x - this._videoElement.videoWidth * ratio), 0);\n videoOffset.y = Math.max(0.5 * (videoOffset.y - this._videoElement.videoHeight * ratio), 0);\n\n const invRatio = (ratio !== 0) ? (1 / ratio) : 0;\n mousePos.x = (mousePos.x - videoOffset.x) * invRatio;\n mousePos.y = (mousePos.y - videoOffset.y) * invRatio;\n\n mousePos.x = Math.min(Math.max(mousePos.x, 0), this._videoElement.videoWidth);\n mousePos.y = Math.min(Math.max(mousePos.y, 0), this._videoElement.videoHeight);\n\n return mousePos;\n }\n\n handleEvent(event) {\n if (!this._videoElement) {\n return;\n }\n\n switch (event.type) {\n case \"wheel\":\n event.preventDefault();\n {\n const mousePos = this._computeVideoMousePosition(event);\n this._sendGstNavigationEvent({\n event: \"MouseScroll\",\n x: mousePos.x,\n y: mousePos.y,\n delta_x: -event.deltaX, // eslint-disable-line camelcase\n delta_y: -event.deltaY, // eslint-disable-line camelcase\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n });\n }\n break;\n\n case \"contextmenu\":\n event.preventDefault();\n break;\n\n case \"mousemove\":\n case \"mousedown\":\n case \"mouseup\":\n event.preventDefault();\n {\n const mousePos = this._computeVideoMousePosition(event);\n const data = {\n event: mouseEventsNames[event.type],\n x: mousePos.x,\n y: mousePos.y,\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n };\n\n if (event.type !== \"mousemove\") {\n data.button = event.button + 1;\n\n if ((event.type === \"mousedown\") && (event.button === 0)) {\n this._videoElement.focus();\n }\n }\n\n this._sendGstNavigationEvent(data);\n }\n break;\n\n case \"touchstart\":\n case \"touchend\":\n case \"touchmove\":\n case \"touchcancel\":\n for (const touch of event.changedTouches) {\n const mousePos = this._computeVideoMousePosition(touch);\n const data = {\n event: touchEventsNames[event.type],\n identifier: touch.identifier,\n x: mousePos.x,\n y: mousePos.y,\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n };\n\n if ((\"force\" in touch) && ((event.type === \"touchstart\") || (event.type === \"touchmove\"))) {\n data.pressure = touch.force;\n }\n\n this._sendGstNavigationEvent(data);\n }\n\n if (event.timeStamp > this._lastTouchEventTimestamp) {\n this._lastTouchEventTimestamp = event.timeStamp;\n this._sendGstNavigationEvent({\n event: \"TouchFrame\",\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n });\n }\n break;\n case \"keyup\":\n case \"keydown\":\n event.preventDefault();\n {\n const data = {\n event: keyboardEventsNames[event.type],\n key: getKeysymString(event.key, event.code),\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n };\n this._sendGstNavigationEvent(data);\n }\n break;\n }\n }\n}\n\nexport default RemoteController;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport WebRTCSession from \"./webrtc-session.js\";\nimport SessionState from \"./session-state.js\";\nimport RemoteController from \"./remote-controller.js\";\n\n/**\n * Event name: \"streamsChanged\". \n * Triggered when the underlying media streams of a {@link ConsumerSession} change.\n * @event GstWebRTCAPI#StreamsChangedEvent\n * @type {Event}\n * @see ConsumerSession#streams\n */\n/**\n * Event name: \"remoteControllerChanged\". \n * Triggered when the underlying remote controller of a {@link ConsumerSession} changes.\n * @event GstWebRTCAPI#RemoteControllerChangedEvent\n * @type {Event}\n * @see ConsumerSession#remoteController\n */\n\n/**\n * @class ConsumerSession\n * @hideconstructor\n * @classdesc Consumer session managing a peer-to-peer WebRTC channel between a remote producer and this client\n * instance.\n *
Call {@link GstWebRTCAPI#createConsumerSession} to create a ConsumerSession instance.
\n * @extends {WebRTCSession}\n * @fires {@link GstWebRTCAPI#event:StreamsChangedEvent}\n * @fires {@link GstWebRTCAPI#event:RemoteControllerChangedEvent}\n */\nclass ConsumerSession extends WebRTCSession {\n constructor(peerId, comChannel, offerOptions) {\n super(peerId, comChannel);\n this._streams = [];\n this._remoteController = null;\n this._pendingCandidates = [];\n this._mungeStereoHack = false;\n\n this._offerOptions = offerOptions;\n\n this.addEventListener(\"closed\", () => {\n this._streams = [];\n this._pendingCandidates = [];\n\n if (this._remoteController) {\n this._remoteController.close();\n }\n });\n }\n\n /**\n * Defines whether the SDP should be munged in order to enable stereo with chrome.\n * @method\n * @param {boolean} enable - Enable or disable the hack, default is false\n */\n set mungeStereoHack(enable) {\n if (typeof (enable) !== \"boolean\") { return; }\n\n this._mungeStereoHack = enable;\n }\n\n /**\n * The array of remote media streams consumed locally through this WebRTC channel.\n * @type {MediaStream[]}\n * @readonly\n */\n get streams() {\n return this._streams;\n }\n\n /**\n * The remote controller associated with this WebRTC consumer session. Value may be null if consumer session\n * has no remote controller.\n * @type {RemoteController}\n * @readonly\n */\n get remoteController() {\n return this._remoteController;\n }\n\n /**\n * Connects the consumer session to its remote producer. \n * This method must be called after creating the consumer session in order to start receiving the remote streams.\n * It registers this consumer session to the signaling server and gets ready to receive audio/video streams.\n *
Even on success, streaming can fail later if any error occurs during or after connection. In order to know\n * the effective streaming state, you should be listening to the [error]{@link GstWebRTCAPI#event:ErrorEvent},\n * [stateChanged]{@link GstWebRTCAPI#event:StateChangedEvent} and/or [closed]{@link GstWebRTCAPI#event:ClosedEvent}\n * events.
\n * @returns {boolean} true in case of success (may fail later during or after connection) or false in case of\n * immediate error (wrong session state or no connection to the signaling server).\n */\n connect() {\n if (!this._comChannel || (this._state === SessionState.closed)) {\n return false;\n }\n\n if (this._state !== SessionState.idle) {\n return true;\n }\n\n if (this._offerOptions) {\n this.ensurePeerConnection();\n\n this._rtcPeerConnection.createDataChannel(\"control\");\n\n this._rtcPeerConnection.createOffer(this._offerOptions).then((desc) => {\n if (this._rtcPeerConnection && desc) {\n return this._rtcPeerConnection.setLocalDescription(desc);\n } else {\n throw new Error(\"cannot send local offer to WebRTC peer\");\n }\n }).then(() => {\n if (this._rtcPeerConnection && this._comChannel) {\n const msg = {\n type: \"startSession\",\n peerId: this._peerId,\n offer: this._rtcPeerConnection.localDescription.toJSON().sdp\n };\n if (!this._comChannel.send(msg)) {\n throw new Error(\"cannot send startSession message to signaling server\");\n }\n this._state = SessionState.connecting;\n this.dispatchEvent(new Event(\"stateChanged\"));\n }\n }).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during SDP handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n } else {\n const msg = {\n type: \"startSession\",\n peerId: this._peerId\n };\n if (!this._comChannel.send(msg)) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot connect consumer session\",\n error: new Error(\"cannot send startSession message to signaling server\")\n }));\n\n this.close();\n return false;\n }\n\n this._state = SessionState.connecting;\n this.dispatchEvent(new Event(\"stateChanged\"));\n }\n\n return true;\n }\n\n onSessionStarted(peerId, sessionId) {\n if ((this._peerId === peerId) && (this._state === SessionState.connecting) && !this._sessionId) {\n console.log(\"Session started\", this._sessionId);\n this._sessionId = sessionId;\n\n for (const candidate of this._pendingCandidates) {\n console.log(\"Sending delayed ICE with session id\", this._sessionId);\n this._comChannel.send({\n type: \"peer\",\n sessionId: this._sessionId,\n ice: candidate.toJSON()\n });\n }\n\n this._pendingCandidates = [];\n }\n }\n\n ensurePeerConnection() {\n if (!this._rtcPeerConnection) {\n const connection = new RTCPeerConnection(this._comChannel.webrtcConfig);\n this._rtcPeerConnection = connection;\n\n connection.ontrack = (event) => {\n if ((this._rtcPeerConnection === connection) && event.streams && (event.streams.length > 0)) {\n if (this._state === SessionState.connecting) {\n this._state = SessionState.streaming;\n this.dispatchEvent(new Event(\"stateChanged\"));\n }\n\n let streamsChanged = false;\n for (const stream of event.streams) {\n if (!this._streams.includes(stream)) {\n this._streams.push(stream);\n streamsChanged = true;\n }\n }\n\n if (streamsChanged) {\n this.dispatchEvent(new Event(\"streamsChanged\"));\n }\n }\n };\n\n connection.ondatachannel = (event) => {\n const rtcDataChannel = event.channel;\n if (rtcDataChannel && (rtcDataChannel.label === \"control\")) {\n if (this._remoteController) {\n const previousController = this._remoteController;\n this._remoteController = null;\n previousController.close();\n }\n\n const remoteController = new RemoteController(rtcDataChannel, this);\n this._remoteController = remoteController;\n this.dispatchEvent(new Event(\"remoteControllerChanged\"));\n\n remoteController.addEventListener(\"closed\", () => {\n if (this._remoteController === remoteController) {\n this._remoteController = null;\n this.dispatchEvent(new Event(\"remoteControllerChanged\"));\n }\n });\n }\n };\n\n connection.onicecandidate = (event) => {\n if ((this._rtcPeerConnection === connection) && event.candidate && this._comChannel) {\n if (this._sessionId) {\n console.log(\"Sending ICE with session id\", this._sessionId);\n this._comChannel.send({\n type: \"peer\",\n sessionId: this._sessionId,\n ice: event.candidate.toJSON()\n });\n } else {\n this._pendingCandidates.push(event.candidate);\n }\n }\n };\n\n this.dispatchEvent(new Event(\"rtcPeerConnectionChanged\"));\n }\n }\n\n // Work around Chrome not handling stereo Opus correctly.\n // See\n // https://chromium.googlesource.com/external/webrtc/+/194e3bcc53ffa3e98045934377726cb25d7579d2/webrtc/media/engine/webrtcvoiceengine.cc#302\n // https://bugs.chromium.org/p/webrtc/issues/detail?id=8133\n //\n // Technically it's against the spec to modify the SDP\n // but there's no other API for this and this seems to\n // be the only possible workaround at this time.\n mungeStereo(offerSdp, answerSdp) {\n const stereoRegexp = /a=fmtp:.* sprop-stereo/g;\n let stereoPayloads = new Set();\n for (const m of offerSdp.matchAll(stereoRegexp)) {\n const payloadMatch = m[0].match(/a=fmtp:(\\d+) .*/);\n if (payloadMatch) {\n stereoPayloads.add(payloadMatch[1]);\n }\n }\n\n for (const payload of stereoPayloads) {\n const isStereoRegexp = new RegExp(\"a=fmtp:\" + payload + \".*stereo\");\n const answerIsStereo = answerSdp.match(isStereoRegexp);\n\n if (!answerIsStereo) {\n answerSdp = answerSdp.replaceAll(\"a=fmtp:\" + payload, \"a=fmtp:\" + payload + \" stereo=1;\");\n }\n }\n\n return answerSdp;\n }\n\n onSessionPeerMessage(msg) {\n if ((this._state === SessionState.closed) || !this._comChannel || !this._sessionId) {\n return;\n }\n\n this.ensurePeerConnection();\n\n if (msg.sdp) {\n if (this._offerOptions) {\n this._rtcPeerConnection.setRemoteDescription(msg.sdp).then(() => {\n console.log(\"done\");\n }).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during SDP handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n } else {\n this._rtcPeerConnection.setRemoteDescription(msg.sdp).then(() => {\n if (this._rtcPeerConnection) {\n return this._rtcPeerConnection.createAnswer();\n } else {\n return null;\n }\n }).then((desc) => {\n if (this._rtcPeerConnection && desc) {\n if (this._mungeStereoHack) {\n desc.sdp = this.mungeStereo(msg.sdp.sdp, desc.sdp);\n }\n\n return this._rtcPeerConnection.setLocalDescription(desc);\n } else {\n return null;\n }\n }).then(() => {\n if (this._rtcPeerConnection && this._comChannel) {\n console.log(\"Sending SDP with session id\", this._sessionId);\n const sdp = {\n type: \"peer\",\n sessionId: this._sessionId,\n sdp: this._rtcPeerConnection.localDescription.toJSON()\n };\n if (!this._comChannel.send(sdp)) {\n throw new Error(\"cannot send local SDP configuration to WebRTC peer\");\n }\n }\n }).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during SDP handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n }\n } else if (msg.ice) {\n const candidate = msg.ice.candidate ? new RTCIceCandidate(msg.ice) : null;\n this._rtcPeerConnection.addIceCandidate(candidate).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during ICE handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n } else {\n throw new Error(`invalid empty peer message received from consumer session ${this._sessionId}`);\n }\n }\n}\n\nexport default ConsumerSession;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport WebRTCSession from \"./webrtc-session.js\";\nimport SessionState from \"./session-state.js\";\n\n/**\n * @class ClientSession\n * @hideconstructor\n * @classdesc Client session representing a link between a remote consumer and a local producer session.\n * @extends {WebRTCSession}\n */\nclass ClientSession extends WebRTCSession {\n constructor(peerId, sessionId, comChannel, stream) {\n super(peerId, comChannel);\n this._sessionId = sessionId;\n this._state = SessionState.streaming;\n\n const connection = new RTCPeerConnection(this._comChannel.webrtcConfig);\n this._rtcPeerConnection = connection;\n\n for (const track of stream.getTracks()) {\n connection.addTrack(track, stream);\n }\n\n connection.onicecandidate = (event) => {\n if ((this._rtcPeerConnection === connection) && event.candidate && this._comChannel) {\n this._comChannel.send({\n type: \"peer\",\n sessionId: this._sessionId,\n ice: event.candidate.toJSON()\n });\n }\n };\n\n this.dispatchEvent(new Event(\"rtcPeerConnectionChanged\"));\n\n connection.setLocalDescription().then(() => {\n if ((this._rtcPeerConnection === connection) && this._comChannel) {\n const sdp = {\n type: \"peer\",\n sessionId: this._sessionId,\n sdp: this._rtcPeerConnection.localDescription.toJSON()\n };\n if (!this._comChannel.send(sdp)) {\n throw new Error(\"cannot send local SDP configuration to WebRTC peer\");\n }\n }\n }).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during SDP handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n }\n\n onSessionPeerMessage(msg) {\n if ((this._state === SessionState.closed) || !this._rtcPeerConnection) {\n return;\n }\n\n if (msg.sdp) {\n this._rtcPeerConnection.setRemoteDescription(msg.sdp).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during SDP handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n } else if (msg.ice) {\n const candidate = new RTCIceCandidate(msg.ice);\n this._rtcPeerConnection.addIceCandidate(candidate).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during ICE handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n } else {\n throw new Error(`invalid empty peer message received from producer's client session ${this._peerId}`);\n }\n }\n}\n\n/**\n * Event name: \"clientConsumerAdded\". \n * Triggered when a remote consumer peer connects to a local {@link ProducerSession}.\n * @event GstWebRTCAPI#ClientConsumerAddedEvent\n * @type {CustomEvent}\n * @property {ClientSession} detail - The WebRTC session associated with the added consumer peer.\n * @see ProducerSession\n */\n/**\n * Event name: \"clientConsumerRemoved\". \n * Triggered when a remote consumer peer disconnects from a local {@link ProducerSession}.\n * @event GstWebRTCAPI#ClientConsumerRemovedEvent\n * @type {CustomEvent}\n * @property {ClientSession} detail - The WebRTC session associated with the removed consumer peer.\n * @see ProducerSession\n */\n\n/**\n * @class ProducerSession\n * @hideconstructor\n * @classdesc Producer session managing the streaming out of a local {@link MediaStream}. \n * It manages all underlying WebRTC connections to each peer client consuming the stream.\n *
Call {@link GstWebRTCAPI#createProducerSession} to create a ProducerSession instance.
\n * @extends {EventTarget}\n * @fires {@link GstWebRTCAPI#event:ErrorEvent}\n * @fires {@link GstWebRTCAPI#event:StateChangedEvent}\n * @fires {@link GstWebRTCAPI#event:ClosedEvent}\n * @fires {@link GstWebRTCAPI#event:ClientConsumerAddedEvent}\n * @fires {@link GstWebRTCAPI#event:ClientConsumerRemovedEvent}\n */\nclass ProducerSession extends EventTarget {\n constructor(comChannel, stream, consumerId) {\n super();\n\n this._comChannel = comChannel;\n this._stream = stream;\n this._state = SessionState.idle;\n this._clientSessions = {};\n this._consumerId = consumerId;\n }\n\n /**\n * The local stream produced out by this session.\n * @type {MediaStream}\n * @readonly\n */\n get stream() {\n return this._stream;\n }\n\n /**\n * The current producer session state.\n * @type {SessionState}\n * @readonly\n */\n get state() {\n return this._state;\n }\n\n /**\n * Starts the producer session. \n * This method must be called after creating the producer session in order to start streaming. It registers this\n * producer session to the signaling server and gets ready to serve peer requests from consumers.\n *
Even on success, streaming can fail later if any error occurs during or after connection. In order to know\n * the effective streaming state, you should be listening to the [error]{@link GstWebRTCAPI#event:ErrorEvent},\n * [stateChanged]{@link GstWebRTCAPI#event:StateChangedEvent} and/or [closed]{@link GstWebRTCAPI#event:ClosedEvent}\n * events.
\n * @returns {boolean} true in case of success (may fail later during or after connection) or false in case of\n * immediate error (wrong session state or no connection to the signaling server).\n */\n start() {\n if (!this._comChannel || (this._state === SessionState.closed)) {\n return false;\n }\n\n if (this._state !== SessionState.idle) {\n return true;\n }\n\n const msg = {\n type: \"setPeerStatus\",\n roles: [\"listener\", \"producer\"],\n meta: this._comChannel.meta\n };\n if (!this._comChannel.send(msg)) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot start producer session\",\n error: new Error(\"cannot register producer to signaling server\")\n }));\n\n this.close();\n return false;\n }\n\n this._state = SessionState.connecting;\n this.dispatchEvent(new Event(\"stateChanged\"));\n return true;\n }\n\n /**\n * Terminates the producer session. \n * It immediately disconnects all peer consumers attached to this producer session and unregisters the producer\n * from the signaling server.\n */\n close() {\n if (this._state !== SessionState.closed) {\n for (const track of this._stream.getTracks()) {\n track.stop();\n }\n\n if ((this._state !== SessionState.idle) && this._comChannel) {\n this._comChannel.send({\n type: \"setPeerStatus\",\n roles: [\"listener\"],\n meta: this._comChannel.meta\n });\n }\n\n this._state = SessionState.closed;\n this.dispatchEvent(new Event(\"stateChanged\"));\n\n this._comChannel = null;\n this._stream = null;\n\n for (const clientSession of Object.values(this._clientSessions)) {\n clientSession.close();\n }\n this._clientSessions = {};\n\n this.dispatchEvent(new Event(\"closed\"));\n }\n }\n\n onProducerRegistered() {\n if (this._state === SessionState.connecting) {\n this._state = SessionState.streaming;\n this.dispatchEvent(new Event(\"stateChanged\"));\n }\n\n if (this._consumerId) {\n const msg = {\n type: \"startSession\",\n peerId: this._consumerId\n };\n if (!this._comChannel.send(msg)) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot send session request to specified consumer\",\n error: new Error(\"cannot send startSession message to signaling server\")\n }));\n\n this.close();\n }\n }\n }\n\n onStartSessionMessage(msg) {\n if (this._comChannel && this._stream && !(msg.sessionId in this._clientSessions)) {\n const session = new ClientSession(msg.peerId, msg.sessionId, this._comChannel, this._stream);\n this._clientSessions[msg.sessionId] = session;\n\n session.addEventListener(\"closed\", (event) => {\n const sessionId = event.target.sessionId;\n if ((sessionId in this._clientSessions) && (this._clientSessions[sessionId] === session)) {\n delete this._clientSessions[sessionId];\n this.dispatchEvent(new CustomEvent(\"clientConsumerRemoved\", { detail: session }));\n }\n });\n\n session.addEventListener(\"error\", (event) => {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: `error from client consumer ${event.target.peerId}: ${event.message}`,\n error: event.error\n }));\n });\n\n this.dispatchEvent(new CustomEvent(\"clientConsumerAdded\", { detail: session }));\n }\n }\n\n onEndSessionMessage(msg) {\n if (msg.sessionId in this._clientSessions) {\n this._clientSessions[msg.sessionId].close();\n }\n }\n\n onSessionPeerMessage(msg) {\n if (msg.sessionId in this._clientSessions) {\n this._clientSessions[msg.sessionId].onSessionPeerMessage(msg);\n }\n }\n}\n\nexport default ProducerSession;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport ConsumerSession from \"./consumer-session.js\";\nimport ProducerSession from \"./producer-session.js\";\n\nconst SignallingServerMessageType = Object.freeze({\n welcome: \"welcome\",\n peerStatusChanged: \"peerStatusChanged\",\n list: \"list\",\n listConsumers: \"listConsumers\",\n sessionStarted: \"sessionStarted\",\n peer: \"peer\",\n startSession: \"startSession\",\n endSession: \"endSession\",\n error: \"error\"\n});\n\nfunction normalizePeer(peer, excludedId) {\n if (!peer || (typeof (peer) !== \"object\")) {\n return null;\n }\n\n const normalizedPeer = {\n id: \"\",\n meta: {}\n };\n\n if (peer.id && (typeof (peer.id) === \"string\")) {\n normalizedPeer.id = peer.id;\n } else if (peer.peerId && (typeof (peer.peerId) === \"string\")) {\n normalizedPeer.id = peer.peerId;\n } else {\n return null;\n }\n\n if (normalizedPeer.id === excludedId) {\n return null;\n }\n\n if (peer.meta && (typeof (peer.meta) === \"object\")) {\n normalizedPeer.meta = peer.meta;\n }\n\n Object.freeze(normalizedPeer.meta);\n return Object.freeze(normalizedPeer);\n}\n\nclass ComChannel extends EventTarget {\n constructor(url, meta, webrtcConfig) {\n super();\n\n this._meta = meta;\n this._webrtcConfig = webrtcConfig;\n this._ws = new WebSocket(url);\n this._ready = false;\n this._channelId = \"\";\n this._producerSession = null;\n this._consumerSessions = {};\n this._peers = {};\n\n this._ws.onerror = (event) => {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: event.message || \"WebSocket error\",\n error: event.error || new Error(\n this._ready ? \"transportation error\" : \"cannot connect to signaling server\")\n }));\n this.close();\n };\n\n this._ws.onclose = () => {\n this._ready = false;\n this._channelId = \"\";\n this._ws = null;\n\n this.closeAllConsumerSessions();\n\n if (this._producerSession) {\n this._producerSession.close();\n this._producerSession = null;\n }\n\n this.dispatchEvent(new Event(\"closed\"));\n };\n\n this._ws.onmessage = (event) => {\n try {\n const msg = JSON.parse(event.data);\n if (msg && (typeof (msg) === \"object\")) {\n switch (msg.type) {\n\n case SignallingServerMessageType.welcome:\n this._channelId = msg.peerId;\n try {\n this._ws.send(JSON.stringify({\n type: \"setPeerStatus\",\n roles: [\"listener\"],\n meta: meta\n }));\n } catch (ex) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot initialize connection to signaling server\",\n error: ex\n }));\n this.close();\n }\n break;\n\n case SignallingServerMessageType.peerStatusChanged: {\n if (msg.peerId === this._channelId) {\n if (!this._ready && msg.roles.includes(\"listener\")) {\n this._ready = true;\n this.dispatchEvent(new Event(\"ready\"));\n this.send({ type: \"list\" });\n this.send({ type: \"listConsumers\"});\n }\n\n if (this._producerSession && msg.roles.includes(\"producer\")) {\n this._producerSession.onProducerRegistered();\n }\n\n break;\n }\n\n const peer = normalizePeer(msg, this._channelId);\n if (!peer) {\n break;\n }\n\n const oldRoles = this._peers[msg.peerId] || [];\n this._peers[msg.peerId] = msg.roles;\n for (const role of [\"producer\", \"consumer\"]) {\n if (!oldRoles.includes(role) && msg.roles.includes(role)) {\n this.dispatchEvent(new CustomEvent(\"peerAdded\", { detail: { peer, role } }));\n } else if (oldRoles.includes(role) && !msg.roles.includes(role)) {\n this.dispatchEvent(new CustomEvent(\"peerRemoved\", { detail: { peerId: msg.peerId, role } }));\n }\n }\n break;\n }\n\n case SignallingServerMessageType.list: {\n this.clearPeers(\"producer\");\n this.addPeers(msg.producers, \"producer\");\n break;\n }\n\n case SignallingServerMessageType.listConsumers: {\n this.clearPeers(\"consumer\");\n this.addPeers(msg.consumers, \"consumer\");\n break;\n }\n\n case SignallingServerMessageType.sessionStarted:\n {\n const session = this.getConsumerSession(msg.peerId);\n if (session) {\n delete this._consumerSessions[msg.peerId];\n\n session.onSessionStarted(msg.peerId, msg.sessionId);\n if (session.sessionId && !(session.sessionId in this._consumerSessions)) {\n this._consumerSessions[session.sessionId] = session;\n } else {\n session.close();\n }\n }\n }\n break;\n\n case SignallingServerMessageType.peer:\n {\n const session = this.getConsumerSession(msg.sessionId);\n if (session) {\n session.onSessionPeerMessage(msg);\n } else if (this._producerSession) {\n this._producerSession.onSessionPeerMessage(msg);\n }\n }\n break;\n\n case SignallingServerMessageType.startSession:\n if (this._producerSession) {\n this._producerSession.onStartSessionMessage(msg);\n }\n break;\n\n case SignallingServerMessageType.endSession:\n {\n const session = this.getConsumerSession(msg.sessionId);\n if (session) {\n session.close();\n } else if (this._producerSession) {\n this._producerSession.onEndSessionMessage(msg);\n }\n }\n break;\n\n case SignallingServerMessageType.error:\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"error received from signaling server\",\n error: new Error(msg.details)\n }));\n break;\n\n default:\n throw new Error(`unknown message type: \"${msg.type}\"`);\n }\n }\n } catch (ex) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot parse incoming message from signaling server\",\n error: ex\n }));\n }\n };\n }\n\n get meta() {\n return this._meta;\n }\n\n get webrtcConfig() {\n return this._webrtcConfig;\n }\n\n get ready() {\n return this._ready;\n }\n\n get channelId() {\n return this._channelId;\n }\n\n get producerSession() {\n return this._producerSession;\n }\n\n createProducerSession(stream, consumerId) {\n if (!this._ready || !(stream instanceof MediaStream)) {\n return null;\n }\n\n if (this._producerSession) {\n if (this._producerSession.stream === stream) {\n return this._producerSession;\n } else {\n return null;\n }\n }\n\n const session = new ProducerSession(this, stream, consumerId);\n this._producerSession = session;\n\n session.addEventListener(\"closed\", () => {\n if (this._producerSession === session) {\n this._producerSession = null;\n }\n });\n\n return session;\n }\n\n createConsumerSession(producerId, offerOptions) {\n if (!this._ready || !producerId || (typeof (producerId) !== \"string\")) {\n return null;\n }\n\n if (offerOptions && (typeof(offerOptions) !== \"object\")) {\n offerOptions = undefined;\n }\n\n if (producerId in this._consumerSessions) {\n return this._consumerSessions[producerId];\n }\n\n for (const session of Object.values(this._consumerSessions)) {\n if (session.peerId === producerId) {\n return session;\n }\n }\n\n const session = new ConsumerSession(producerId, this, offerOptions);\n this._consumerSessions[producerId] = session;\n\n session.addEventListener(\"closed\", (event) => {\n let sessionId = event.target.sessionId;\n if (!sessionId) {\n sessionId = event.target.peerId;\n }\n\n if ((sessionId in this._consumerSessions) && (this._consumerSessions[sessionId] === session)) {\n delete this._consumerSessions[sessionId];\n }\n });\n\n return session;\n }\n\n getConsumerSession(sessionId) {\n if (sessionId in this._consumerSessions) {\n return this._consumerSessions[sessionId];\n } else {\n return null;\n }\n }\n\n closeAllConsumerSessions() {\n for (const session of Object.values(this._consumerSessions)) {\n session.close();\n }\n\n this._consumerSessions = {};\n }\n\n send(data) {\n if (this._ready && data && (typeof (data) === \"object\")) {\n try {\n this._ws.send(JSON.stringify(data));\n return true;\n } catch (ex) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot send message to signaling server\",\n error: ex\n }));\n }\n }\n\n return false;\n }\n\n close() {\n if (this._ws) {\n this._ready = false;\n this._channelId = \"\";\n this._ws.close();\n\n this.closeAllConsumerSessions();\n\n if (this._producerSession) {\n this._producerSession.close();\n this._producerSession = null;\n }\n }\n }\n\n clearPeers(role) {\n for (const peerId in this._peers) {\n if (this._peers[peerId].includes(role)) {\n delete this._peers[peerId];\n this.dispatchEvent(new CustomEvent(\"peerRemoved\", { detail: { peerId, role } }));\n }\n }\n }\n\n addPeers(items, role) {\n items.forEach(item => {\n const peer = normalizePeer(item, this._channelId);\n if (peer) {\n this._peers[peer.id] = [role];\n this.dispatchEvent(new CustomEvent(\"peerAdded\", { detail: { peer, role } }));\n }\n });\n };\n}\n\nexport default ComChannel;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport defaultConfig from \"./config.js\";\nimport ComChannel from \"./com-channel.js\";\nimport SessionState from \"./session-state.js\";\n\n/** @import ConsumerSession from \"./consumer-session.js\"; */\n/** @import ProducerSession from \"./producer-session.js\"; */\n/** @import GstWebRTCConfig from \"./config.js\"; */\n/** @import RTCOfferOptions from \"typescript/lib/lib.dom.js\"; */\n\nclass GstWebRTCAPI {\n /**\n * @class GstWebRTCAPI\n * @classdesc The API entry point that manages a WebRTC.\n * @constructor\n * @param {GstWebRTCConfig} [userConfig] - The user configuration. \n * Only the parameters different from the default ones need to be provided.\n */\n constructor(userConfig) {\n this._channel = null;\n this._producers = {};\n this._consumers = {};\n this._connectionListeners = [];\n this._peerListeners = [];\n\n const config = Object.assign({}, defaultConfig);\n if (userConfig && (typeof (userConfig) === \"object\")) {\n Object.assign(config, userConfig);\n }\n\n if (typeof (config.meta) !== \"object\") {\n config.meta = null;\n }\n\n this._config = config;\n this.connectChannel();\n }\n\n /**\n * @interface ConnectionListener\n */\n /**\n * Callback method called when this client connects to the WebRTC signaling server.\n * The callback implementation should not throw any exception.\n * @method ConnectionListener#connected\n * @abstract\n * @param {string} clientId - The unique identifier of this WebRTC client. This identifier is provided by the\n * signaling server to uniquely identify each connected peer.\n */\n /**\n * Callback method called when this client disconnects from the WebRTC signaling server.\n * The callback implementation should not throw any exception.\n * @method ConnectionListener#disconnected\n * @abstract\n */\n\n /**\n * Registers a connection listener that will be called each time the WebRTC API connects to or disconnects from the\n * signaling server.\n * @param {ConnectionListener} listener - The connection listener to register.\n * @returns {boolean} true in case of success (or if the listener was already registered), or false if the listener\n * doesn't implement all callback functions and cannot be registered.\n */\n registerConnectionListener(listener) {\n if (!listener || (typeof (listener) !== \"object\") ||\n (typeof (listener.connected) !== \"function\") ||\n (typeof (listener.disconnected) !== \"function\")) {\n return false;\n }\n\n if (!this._connectionListeners.includes(listener)) {\n this._connectionListeners.push(listener);\n }\n\n return true;\n }\n\n /**\n * Unregisters a connection listener. \n * The removed listener will never be called again and can be garbage collected.\n * @param {ConnectionListener} listener - The connection listener to unregister.\n * @returns {boolean} true if the listener is found and unregistered, or false if the listener was not previously\n * registered.\n */\n unregisterConnectionListener(listener) {\n const idx = this._connectionListeners.indexOf(listener);\n if (idx >= 0) {\n this._connectionListeners.splice(idx, 1);\n return true;\n }\n\n return false;\n }\n\n /**\n * Unregisters all previously registered connection listeners.\n */\n unregisterAllConnectionListeners() {\n this._connectionListeners = [];\n }\n\n /**\n * Creates a new producer session.\n *
You can only create one producer session at a time. \n * To request streaming from a new stream you will first need to close the previous producer session.
\n *
You can only request a producer session while you are connected to the signaling server. You can use the\n * {@link ConnectionListener} interface and {@link GstWebRTCAPI#registerConnectionListener} method to\n * listen to the connection state.
\n * @param {MediaStream} stream - The audio/video stream to offer as a producer through WebRTC.\n * @returns {ProducerSession} The created producer session or null in case of error. To start streaming,\n * you still need to call {@link ProducerSession#start} after adding on the returned session all the event\n * listeners you may need.\n */\n createProducerSession(stream) {\n if (this._channel) {\n return this._channel.createProducerSession(stream);\n }\n return null;\n }\n\n createProducerSessionForConsumer(stream, consumerId) {\n if (this._channel) {\n return this._channel.createProducerSession(stream, consumerId);\n }\n return null;\n }\n\n /**\n * Information about a remote peer registered by the signaling server.\n * @typedef {object} Peer\n * @readonly\n * @property {string} id - The unique peer identifier set by the signaling server (always non-empty).\n * @property {object} meta - Free-form object containing extra information about the peer (always non-null,\n * but may be empty). Its content depends on your application.\n */\n\n /**\n * Gets the list of all remote WebRTC producers available on the signaling server.\n *
The remote producers list is only populated once you've connected to the signaling server. You can use the\n * {@link ConnectionListener} interface and {@link GstWebRTCAPI#registerConnectionListener} method to\n * listen to the connection state.
\n * @returns {Peer[]} The list of remote WebRTC producers available.\n */\n getAvailableProducers() {\n return Object.values(this._producers);\n }\n\n /**\n * Gets the list of all remote WebRTC consumers available on the signaling server.\n *
The remote consumer list is only populated once you've connected to the signaling server. You can use the\n * {@link ConnectionListener} interface and {@link GstWebRTCAPI#registerConnectionListener} method to\n * listen to the connection state.
\n * @returns {Peer[]} The list of remote WebRTC consumers available.\n */\n getAvailableConsumers() {\n return Object.values(this._consumers);\n }\n\n /**\n * @interface PeerListener\n */\n /**\n * Callback method called when a remote producer is added on the signaling server.\n * The callback implementation should not throw any exception.\n * @method PeerListener#producerAdded\n * @abstract\n * @param {Peer} producer - The remote producer added on server-side.\n */\n /**\n * Callback method called when a remote producer is removed from the signaling server.\n * The callback implementation should not throw any exception.\n * @method PeerListener#producerRemoved\n * @abstract\n * @param {Peer} producer - The remote producer removed on server-side.\n */\n /**\n * Callback method called when a remote consumer is added on the signaling server.\n * The callback implementation should not throw any exception.\n * @method PeerListener#consumerAdded\n * @abstract\n * @param {Peer} consumer - The remote consumer added on server-side.\n * */\n /**\n * Callback method called when a remote consumer is removed from the signaling server.\n * The callback implementation should not throw any exception.\n * @method PeerListener#consumerRemoved\n * @abstract\n * @param {Peer} consumer - The remote consumer removed on server-side.\n * */\n\n /**\n * Registers a listener that will be called each time a peer is added or removed on the signaling server.\n * The listener can implement all or only some of the callback methods.\n * @param {PeerListener} listener - The peer listener to register.\n * @returns {boolean} true in case of success (or if the listener was already registered), or false if the listener\n * doesn't implement any methods from PeerListener and cannot be registered.\n */\n registerPeerListener(listener) {\n // refuse if no methods from PeerListener are implemented\n if (!listener || (typeof (listener) !== \"object\") ||\n ((typeof (listener.producerAdded) !== \"function\") &&\n (typeof (listener.producerRemoved) !== \"function\") &&\n (typeof (listener.consumerAdded) !== \"function\") &&\n (typeof (listener.consumerRemoved) !== \"function\"))) {\n return false;\n }\n\n if (!this._peerListeners.includes(listener)) {\n this._peerListeners.push(listener);\n }\n\n return true;\n }\n\n /**\n * Unregisters a peer listener. \n * The removed listener will never be called again and can be garbage collected.\n * @param {PeerListener} listener - The peer listener to unregister.\n * @returns {boolean} true if the listener is found and unregistered, or false if the listener was not previously\n * registered.\n */\n unregisterPeerListener(listener) {\n const idx = this._peerListeners.indexOf(listener);\n if (idx >= 0) {\n this._peerListeners.splice(idx, 1);\n return true;\n }\n\n return false;\n }\n\n /**\n * Unregisters all previously registered peer listeners.\n */\n unregisterAllPeerListeners() {\n this._peerListeners = [];\n }\n\n /**\n * Creates a consumer session by connecting the local client to a remote WebRTC producer.\n *
You can only create one consumer session per remote producer.
\n *
You can only request a new consumer session while you are connected to the signaling server. You can use the\n * {@link ConnectionListener} interface and {@link GstWebRTCAPI#registerConnectionListener} method to\n * listen to the connection state.
\n * @param {string} producerId - The unique identifier of the remote producer to connect to.\n * @returns {ConsumerSession} The WebRTC session between the selected remote producer and this local\n * consumer, or null in case of error. To start connecting and receiving the remote streams, you still need to call\n * {@link ConsumerSession#connect} after adding on the returned session all the event listeners you may\n * need.\n */\n createConsumerSession(producerId) {\n if (this._channel) {\n return this._channel.createConsumerSession(producerId);\n }\n return null;\n }\n\n /**\n * Creates a consumer session by connecting the local client to a remote WebRTC producer and creating the offer.\n *
See {@link GstWebRTCAPI#createConsumerSession} for more information
\n * @param {string} producerId - The unique identifier of the remote producer to connect to.\n * @param {RTCOfferOptions} offerOptions - An object to use when creating the offer.\n * @returns {ConsumerSession} The WebRTC session between the selected remote producer and this local\n * consumer, or null in case of error. To start connecting and receiving the remote streams, you still need to call\n * {@link ConsumerSession#connect} after adding on the returned session all the event listeners you may\n * need.\n */\n createConsumerSessionWithOfferOptions(producerId, offerOptions) {\n if (this._channel) {\n return this._channel.createConsumerSession(producerId, offerOptions);\n }\n return null;\n }\n\n connectChannel() {\n if (this._channel) {\n const oldChannel = this._channel;\n this._channel = null;\n oldChannel.close();\n for (const key in this._producers) {\n this.triggerProducerRemoved(key);\n }\n for (const key in this._consumers) {\n this.triggerConsumerRemoved(key);\n }\n this._producers = {};\n this._consumers = {};\n this.triggerDisconnected();\n }\n\n this._channel = new ComChannel(\n this._config.signalingServerUrl,\n this._config.meta,\n this._config.webrtcConfig\n );\n\n this._channel.addEventListener(\"error\", (event) => {\n if (event.target === this._channel) {\n console.error(event.message, event.error);\n }\n });\n\n this._channel.addEventListener(\"closed\", (event) => {\n if (event.target !== this._channel) {\n return;\n }\n this._channel = null;\n for (const key in this._producers) {\n this.triggerProducerRemoved(key);\n }\n for (const key in this._consumers) {\n this.triggerConsumerRemoved(key);\n }\n this._producers = {};\n this._consumers = {};\n this.triggerDisconnected();\n if (this._config.reconnectionTimeout > 0) {\n window.setTimeout(() => {\n this.connectChannel();\n }, this._config.reconnectionTimeout);\n }\n });\n\n this._channel.addEventListener(\"ready\", (event) => {\n if (event.target === this._channel) {\n this.triggerConnected(this._channel.channelId);\n }\n });\n\n this._channel.addEventListener(\"peerAdded\", (event) => {\n if (event.target !== this._channel) {\n return;\n }\n\n if (event.detail.role === \"producer\") {\n this.triggerProducerAdded(event.detail.peer);\n } else {\n this.triggerConsumerAdded(event.detail.peer);\n }\n });\n\n this._channel.addEventListener(\"peerRemoved\", (event) => {\n if (event.target !== this._channel) {\n return;\n }\n\n if (event.detail.role === \"producer\") {\n this.triggerProducerRemoved(event.detail.peerId);\n } else {\n this.triggerConsumerRemoved(event.detail.peerId);\n }\n });\n }\n\n triggerConnected(clientId) {\n for (const listener of this._connectionListeners) {\n try {\n listener.connected(clientId);\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n\n triggerDisconnected() {\n for (const listener of this._connectionListeners) {\n try {\n listener.disconnected();\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n\n triggerProducerAdded(producer) {\n if (producer.id in this._producers) {\n return;\n }\n\n this._producers[producer.id] = producer;\n for (const listener of this._peerListeners) {\n if (!listener.producerAdded) {\n continue;\n }\n\n try {\n listener.producerAdded(producer);\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n\n triggerProducerRemoved(producerId) {\n if (!(producerId in this._producers)) {\n return;\n }\n\n const producer = this._producers[producerId];\n delete this._producers[producerId];\n\n for (const listener of this._peerListeners) {\n if (!listener.producerRemoved) {\n continue;\n }\n\n try {\n listener.producerRemoved(producer);\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n\n triggerConsumerAdded(consumer) {\n if (consumer.id in this._consumers) {\n return;\n }\n\n this._consumers[consumer.id] = consumer;\n for (const listener of this._peerListeners) {\n if (!listener.consumerAdded) {\n continue;\n }\n\n try {\n listener.consumerAdded(consumer);\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n\n triggerConsumerRemoved(consumerId) {\n if (!(consumerId in this._consumers)) {\n return;\n }\n\n const consumer = this._consumers[consumerId];\n delete this._consumers[consumerId];\n\n for (const listener of this._peerListeners) {\n if (!listener.consumerRemoved) {\n continue;\n }\n\n try {\n listener.consumerRemoved(consumer);\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n}\n\nGstWebRTCAPI.SessionState = SessionState;\n\nexport default GstWebRTCAPI;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport \"webrtc-adapter\";\nimport GstWebRTCAPI from \"./gstwebrtc-api.js\";\n\n/**\n * @external MediaStream\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MediaStream\n */\n/**\n * @external RTCPeerConnection\n * @see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection\n */\n/**\n * @external RTCDataChannel\n * @see https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel\n */\n/**\n * @external RTCOfferOptions\n * @see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createOffer#options\n */\n/**\n * @external EventTarget\n * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget\n */\n/**\n * @external Event\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Event\n */\n/**\n * @external ErrorEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent\n */\n/**\n * @external CustomEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent\n */\n/**\n * @external Error\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\n */\n/**\n * @external HTMLVideoElement\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement\n */\n\nif (!window.GstWebRTCAPI) {\n window.GstWebRTCAPI = GstWebRTCAPI;\n}\n\nexport default GstWebRTCAPI;\n"],"names":["SDPUtils","Math","random","toString","substring","localCName","generateIdentifier","splitLines","blob","trim","split","map","line","splitSections","part","index","getDescription","sections","getMediaSections","shift","matchPrefix","prefix","filter","indexOf","parseCandidate","parts","candidate","foundation","component","protocol","toLowerCase","priority","parseInt","ip","address","port","type","i","length","relatedAddress","relatedPort","tcpType","ufrag","usernameFragment","undefined","writeCandidate","sdp","push","toUpperCase","join","parseIceOptions","parseRtpMap","parsed","payloadType","name","clockRate","channels","numChannels","writeRtpMap","codec","pt","preferredPayloadType","parseExtmap","id","direction","uri","attributes","slice","writeExtmap","headerExtension","preferredId","parseFmtp","kv","j","writeFmtp","parameters","Object","keys","params","forEach","param","parseRtcpFb","parameter","writeRtcpFb","lines","rtcpFeedback","fb","parseSsrcMedia","sp","ssrc","colon","attribute","value","parseSsrcGroup","semantics","ssrcs","getMid","mediaSection","mid","parseFingerprint","algorithm","getDtlsParameters","sessionpart","role","fingerprints","writeDtlsParameters","setupType","fp","parseCryptoLine","tag","cryptoSuite","keyParams","sessionParams","writeCryptoLine","writeCryptoKeyParams","parseCryptoKeyParams","keyMethod","keySalt","lifeTime","mkiValue","mkiLength","getCryptoParameters","getIceParameters","pwd","password","writeIceParameters","iceLite","parseRtpParameters","description","codecs","headerExtensions","fecMechanisms","rtcp","mline","profile","rtpmapline","fmtps","wildcardRtcpFb","find","existingFeedback","writeRtpDescription","kind","caps","maxptime","extension","parseRtpEncodingParameters","encodingParameters","hasRed","hasUlpfec","primarySsrc","secondarySsrc","flows","apt","encParam","codecPayloadType","rtx","JSON","parse","stringify","fec","mechanism","bandwidth","maxBitrate","parseRtcpParameters","rtcpParameters","remoteSsrc","obj","cname","rsize","reducedSize","compound","mux","writeRtcpParameters","parseMsid","spec","stream","track","planB","msidParts","parseSctpDescription","parseMLine","maxSizeLine","maxMessageSize","isNaN","sctpPort","fmt","sctpMapLines","writeSctpDescription","media","sctp","output","generateSessionId","substr","writeSessionBoilerplate","sessId","sessVer","sessUser","sessionId","version","getDirection","getKind","isRejected","parseOLine","username","sessionVersion","netType","addressType","isValidSDP","charAt","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","logDisabled_","deprecationWarnings_","extractVersion","uastring","expr","pos","match","wrapPeerConnectionEvent","window","eventNameToWrap","wrapper","RTCPeerConnection","proto","nativeAddEventListener","addEventListener","nativeEventName","cb","apply","this","arguments","wrappedCallback","e","modifiedEvent","handleEvent","_eventMap","Map","set","nativeRemoveEventListener","removeEventListener","has","unwrappedCb","delete","size","configurable","disableLog","bool","Error","disableWarnings","log","console","deprecated","oldMethod","newMethod","warn","isObject","val","compactObject","data","reduce","accumulator","isObj","isEmptyObject","assign","walkStats","stats","base","resultSet","endsWith","filterStats","result","outbound","streamStatsType","filteredResult","trackStats","trackIdentifier","trackStat","trackId","logging","shimGetUserMedia","browserDetails","navigator","mediaDevices","constraintsToChrome_","c","mandatory","optional","cc","ideal","exact","min","max","oldname_","oc","mix","advanced","concat","shimConstraints_","constraints","func","audio","remap","b","video","face","facingMode","getSupportedFacingModeLies","getSupportedConstraints","matches","enumerateDevices","then","devices","dev","some","label","includes","deviceId","shimError_","PermissionDeniedError","PermissionDismissedError","InvalidStateError","DevicesNotFoundError","ConstraintNotSatisfiedError","TrackStartError","MediaDeviceFailedDueToShutdown","MediaDeviceKillSwitchOn","TabCaptureError","ScreenCaptureError","DeviceCaptureError","message","constraint","constraintName","getUserMedia","onSuccess","onError","webkitGetUserMedia","bind","origGetUserMedia","cs","getAudioTracks","getVideoTracks","getTracks","stop","DOMException","Promise","reject","shimGetDisplayMedia","getSourceId","getDisplayMedia","sourceId","widthSpecified","width","heightSpecified","height","frameRateSpecified","frameRate","chromeMediaSource","chromeMediaSourceId","maxFrameRate","maxWidth","maxHeight","error","shimMediaStream","MediaStream","webkitMediaStream","shimOnTrack","_ontrack","f","origSetRemoteDescription","setRemoteDescription","_ontrackpoly","te","receiver","getReceivers","event","Event","transceiver","streams","dispatchEvent","shimGetSendersWithDtmf","shimSenderWithDtmf","pc","dtmf","_dtmf","createDTMFSender","_pc","getSenders","_senders","origAddTrack","addTrack","sender","origRemoveTrack","removeTrack","idx","splice","origAddStream","addStream","origRemoveStream","removeStream","s","RTCRtpSender","origGetSenders","senders","shimGetStats","origGetStats","getStats","selector","onSucc","onErr","fixChromeStats_","response","standardReport","report","standardStats","timestamp","localcandidate","remotecandidate","names","stat","makeMapStats","successCallbackWrapper_","resolve","shimSenderReceiverGetStats","RTCRtpReceiver","origGetReceivers","receivers","srcElement","MediaStreamTrack","err","shimAddTrackRemoveTrackWithNative","getLocalStreams","_shimmedLocalStreams","streamId","existingSenders","newSenders","newSender","shimAddTrackRemoveTrack","origGetLocalStreams","nativeStreams","_reverseStreams","_streams","newStream","replaceInternalStreamId","internalId","externalStream","internalStream","replace","RegExp","RTCSessionDescription","signalingState","t","oldStream","method","nativeMethod","methodObj","args","desc","origSetLocalDescription","setLocalDescription","replaceExternalStreamId","origLocalDescription","getOwnPropertyDescriptor","streamid","shimPeerConnection","webkitRTCPeerConnection","RTCIceCandidate","fixNegotiationNeeded","target","getConfiguration","sdpSemantics","nativeGetUserMedia","getSettings","nativeGetSettings","applyConstraints","nativeApplyConstraints","preferredMediaSource","code","mediaSource","RTCTrackEvent","mozRTCPeerConnection","modernStatsTypes","inboundrtp","outboundrtp","candidatepair","nativeGetStats","shimSenderGetStats","shimReceiverGetStats","shimRemoveStream","shimRTCDataChannel","DataChannel","RTCDataChannel","shimAddTransceiver","origAddTransceiver","addTransceiver","setParametersPromises","sendEncodings","shouldPerformCheck","encodingParam","test","rid","TypeError","parseFloat","scaleResolutionDownBy","RangeError","maxFramerate","getParameters","encodings","setParameters","catch","shimGetParameters","origGetParameters","shimCreateOffer","origCreateOffer","createOffer","all","finally","shimCreateAnswer","origCreateAnswer","createAnswer","shimLocalStreamsAPI","_localStreams","_addTrack","tracks","shimRemoteStreamsAPI","getRemoteStreams","_remoteStreams","_onaddstream","_onaddstreampoly","shimCallbacksAPI","addIceCandidate","successCallback","failureCallback","options","promise","withCallback","_getUserMedia","shimConstraints","errcb","shimRTCIceServerUrls","OrigPeerConnection","pcConfig","pcConstraints","iceServers","newIceServers","server","urls","url","generateCertificate","shimTrackEventTransceiver","shimCreateOfferLegacy","offerOptions","offerToReceiveAudio","audioTransceiver","getTransceivers","setDirection","offerToReceiveVideo","videoTransceiver","shimAudioContext","AudioContext","webkitAudioContext","shimRTCIceCandidate","NativeRTCIceCandidate","nativeCandidate","parsedCandidate","toJSON","sdpMid","sdpMLineIndex","writable","shimRTCIceCandidateRelayProtocol","relayProtocol","shimMaxMessageSize","_sctp","browser","mLine","sctpInDescription","isFirefox","getRemoteFirefoxVersion","canSendMMS","remoteIsFirefox","canSendMaxMessageSize","getCanSendMaxMessageSize","remoteMMS","getMaxMessageSize","Number","POSITIVE_INFINITY","shimSendThrowTypeError","wrapDcSend","dc","origDataChannelSend","send","byteLength","readyState","origCreateDataChannel","createDataChannel","dataChannel","channel","shimConnectionState","completed","checking","iceConnectionState","_onconnectionstatechange","origMethod","_connectionstatechangepoly","_lastConnectionState","connectionState","newEvent","removeExtmapAllowMixed","nativeSRD","shimAddIceCandidateNullOrEmpty","nativeAddIceCandidate","shimParameterlessSetLocalDescription","nativeSetLocalDescription","shimChrome","shimFirefox","shimSafari","userAgent","mozGetUserMedia","isSecureContext","supportsUnifiedPlan","RTCRtpTransceiver","adapter","commonShim","browserShim","adapterFactory","freeze","meta","signalingServerUrl","reconnectionTimeout","webrtcConfig","bundlePolicy","SessionState","idle","connecting","streaming","closed","WebRTCSession","EventTarget","constructor","peerId","comChannel","super","_peerId","_sessionId","_comChannel","_state","_rtcPeerConnection","state","rtcPeerConnection","close","uniToKeySyms","kbEventCodesToKeySyms","knownKbEventCodes","Set","getKeysymString","keySym","keyCodeUni","charCodeAt","eventsNames","mouseEventsNames","mousemove","mousedown","mouseup","touchEventsNames","touchstart","touchend","touchmove","touchcancel","keyboardEventsNames","keydown","keyup","getModifiers","modifiers","altKey","ctrlKey","metaKey","shiftKey","RemoteController","rtcDataChannel","consumerSession","_rtcDataChannel","_consumerSession","_videoElement","_videoElementComputedStyle","_videoElementKeyboard","_lastTouchEventTimestamp","_requestCounter","ErrorEvent","msg","CustomEvent","detail","ex","videoElement","attachVideoElement","element","HTMLVideoElement","getComputedStyle","eventName","setAttribute","previousElement","removeAttribute","sendControlRequest","request","_sendGstNavigationEvent","_computeVideoMousePosition","mousePos","x","y","videoWidth","videoHeight","padding","paddingLeft","paddingRight","paddingTop","paddingBottom","offsetX","offsetY","clientRect","getBoundingClientRect","border","left","borderLeftWidth","top","borderTopWidth","clientX","clientY","videoOffset","clientWidth","clientHeight","ratio","invRatio","preventDefault","delta_x","deltaX","delta_y","deltaY","modifier_state","button","focus","touch","changedTouches","identifier","pressure","force","timeStamp","_remoteController","_pendingCandidates","_mungeStereoHack","_offerOptions","mungeStereoHack","enable","remoteController","connect","ensurePeerConnection","offer","localDescription","onSessionStarted","ice","connection","ontrack","streamsChanged","ondatachannel","previousController","onicecandidate","mungeStereo","offerSdp","answerSdp","stereoRegexp","stereoPayloads","m","matchAll","payloadMatch","add","payload","isStereoRegexp","replaceAll","onSessionPeerMessage","ClientSession","ProducerSession","consumerId","_stream","_clientSessions","_consumerId","start","roles","clientSession","values","onProducerRegistered","onStartSessionMessage","session","onEndSessionMessage","SignallingServerMessageType","welcome","peerStatusChanged","list","listConsumers","sessionStarted","peer","startSession","endSession","normalizePeer","excludedId","normalizedPeer","ComChannel","_meta","_webrtcConfig","_ws","WebSocket","_ready","_channelId","_producerSession","_consumerSessions","_peers","onerror","onclose","closeAllConsumerSessions","onmessage","oldRoles","clearPeers","addPeers","producers","consumers","getConsumerSession","details","ready","channelId","producerSession","createProducerSession","createConsumerSession","producerId","items","item","GstWebRTCAPI","userConfig","_channel","_producers","_consumers","_connectionListeners","_peerListeners","config","_config","connectChannel","registerConnectionListener","listener","unregisterConnectionListener","unregisterAllConnectionListeners","createProducerSessionForConsumer","getAvailableProducers","getAvailableConsumers","registerPeerListener","unregisterPeerListener","unregisterAllPeerListeners","createConsumerSessionWithOfferOptions","oldChannel","triggerProducerRemoved","triggerConsumerRemoved","triggerDisconnected","setTimeout","triggerConnected","triggerProducerAdded","triggerConsumerAdded","clientId","connected","disconnected","producer","producerAdded","producerRemoved","consumer","consumerAdded","consumerRemoved"],"sourceRoot":""}
\ No newline at end of file
diff --git a/web/javascript/webrtc/gstwebrtc-api-3.0.0.min.js b/web/javascript/webrtc/gstwebrtc-api-3.0.0.min.js
new file mode 100644
index 0000000..8abcca4
--- /dev/null
+++ b/web/javascript/webrtc/gstwebrtc-api-3.0.0.min.js
@@ -0,0 +1,5 @@
+/*! gstwebrtc-api (https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/tree/main/net/webrtc/gstwebrtc-api), MPL-2.0 License, Copyright (C) 2022 Igalia S.L. , Author: Loïc Le Page */
+/*! Contains embedded adapter from webrtc-adapter (https://github.com/webrtcHacks/adapter), BSD 3-Clause License, Copyright (c) 2014, The WebRTC project authors. All rights reserved. Copyright (c) 2018, The adapter.js project authors. All rights reserved. */
+
+(()=>{"use strict";var e={539:e=>{const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map(e=>e.trim())},t.splitSections=function(e){return e.split("\nm=").map((e,t)=>(t>0?"m="+e:e).trim()+"\r\n")},t.getDescription=function(e){const n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){const n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter(e=>0===e.indexOf(n))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const n={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let n;const r=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e{void 0!==e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)}),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(e=>{t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),n={ssrc:parseInt(e.substring(7,t),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substring(t+1,r),n.value=e.substring(r+1)):n.attribute=e.substring(t+1),n},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(e=>parseInt(e,10))}},t.getMid=function(e){const n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substring(6)},t.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},t.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){const r=t.matchPrefix(e+n,"a=ice-ufrag:")[0],i=t.matchPrefix(e+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substring(12),password:i.substring(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" ");n.profile=r[2];for(let i=3;i{n.headerExtensions.push(t.parseExtmap(e))});const i=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return n.codecs.forEach(e=>{i.forEach(t=>{e.rtcpFeedback.find(e=>e.type===t.type&&e.parameter===t.parameter)||e.rtcpFeedback.push(t)})}),n},t.writeRtpDescription=function(e,n){let r="";r+="m="+e+" ",r+=n.codecs.length>0?"9":"0",r+=" "+(n.profile||"UDP/TLS/RTP/SAVPF")+" ",r+=n.codecs.map(e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach(e=>{r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)});let i=0;return n.codecs.forEach(e=>{e.maxptime>i&&(i=e.maxptime)}),i>0&&(r+="a=maxptime:"+i+"\r\n"),n.headerExtensions&&n.headerExtensions.forEach(e=>{r+=t.writeExtmap(e)}),r},t.parseRtpEncodingParameters=function(e){const n=[],r=t.parseRtpParameters(e),i=-1!==r.fecMechanisms.indexOf("RED"),o=-1!==r.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map(e=>t.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute),a=s.length>0&&s[0].ssrc;let c;const d=t.matchPrefix(e,"a=ssrc-group:FID").map(e=>e.substring(17).split(" ").map(e=>parseInt(e,10)));d.length>0&&d[0].length>1&&d[0][0]===a&&(c=d[0][1]),r.codecs.forEach(e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(t.rtx={ssrc:c}),n.push(t),i&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},n.push(t))}}),0===n.length&&a&&n.push({ssrc:a});let l=t.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substring(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substring(5),10)*.95-16e3:void 0,n.forEach(e=>{e.maxBitrate=l})),n},t.parseRtcpParameters=function(e){const n={},r=t.matchPrefix(e,"a=ssrc:").map(e=>t.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute)[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);const i=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;const o=t.matchPrefix(e,"a=rtcp-mux");return n.mux=o.length>0,n},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let n;const r=t.matchPrefix(e,"a=msid:");if(1===r.length)return n=r[0].substring(7).split(" "),{stream:n[0],track:n[1]};const i=t.matchPrefix(e,"a=ssrc:").map(e=>t.parseSsrcMedia(e)).filter(e=>"msid"===e.attribute);return i.length>0?(n=i[0].value.split(" "),{stream:n[0],track:n[1]}):void 0},t.parseSctpDescription=function(e){const n=t.parseMLine(e),r=t.matchPrefix(e,"a=max-message-size:");let i;r.length>0&&(i=parseInt(r[0].substring(19),10)),isNaN(i)&&(i=65536);const o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:n.fmt,maxMessageSize:i};const s=t.matchPrefix(e,"a=sctpmap:");if(s.length>0){const e=s[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:i}}},t.writeSctpDescription=function(e,t){let n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,n,r){let i;const o=void 0!==n?n:2;i=e||t.generateSessionId();return"v=0\r\no="+(r||"thisisadapterortc")+" "+i+" "+o+" IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,n){const r=t.splitLines(e);for(let e=0;e{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={};n.r(e),n.d(e,{fixNegotiationNeeded:()=>w,shimAddTrackRemoveTrack:()=>P,shimAddTrackRemoveTrackWithNative:()=>E,shimGetDisplayMedia:()=>y,shimGetSendersWithDtmf:()=>S,shimGetStats:()=>k,shimGetUserMedia:()=>C,shimMediaStream:()=>v,shimOnTrack:()=>b,shimPeerConnection:()=>R,shimSenderReceiverGetStats:()=>T});var t={};n.r(t),n.d(t,{shimAddTransceiver:()=>G,shimCreateAnswer:()=>U,shimCreateOffer:()=>N,shimGetDisplayMedia:()=>I,shimGetParameters:()=>j,shimGetUserMedia:()=>A,shimOnTrack:()=>x,shimPeerConnection:()=>O,shimRTCDataChannel:()=>H,shimReceiverGetStats:()=>M,shimRemoveStream:()=>L,shimSenderGetStats:()=>D});var r={};n.r(r),n.d(r,{shimAudioContext:()=>B,shimCallbacksAPI:()=>J,shimConstraints:()=>K,shimCreateOfferLegacy:()=>V,shimGetUserMedia:()=>q,shimLocalStreamsAPI:()=>F,shimRTCIceServerUrls:()=>W,shimRemoteStreamsAPI:()=>z,shimTrackEventTransceiver:()=>Y});var i={};n.r(i),n.d(i,{removeExtmapAllowMixed:()=>re,shimAddIceCandidateNullOrEmpty:()=>ie,shimConnectionState:()=>ne,shimMaxMessageSize:()=>ee,shimParameterlessSetLocalDescription:()=>oe,shimRTCIceCandidate:()=>$,shimRTCIceCandidateRelayProtocol:()=>Q,shimSendThrowTypeError:()=>te});let o=!0,s=!0;function a(e,t,n){const r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function c(e,t,n){if(!e.RTCPeerConnection)return;const r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);const o=e=>{const t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),i.apply(this,[e,o])};const o=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(n))return o.apply(this,arguments);const r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function d(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(o=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function l(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(s=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function h(){if("object"==typeof window){if(o)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function p(e,t){s&&console.warn(e+" is deprecated, please use "+t+" instead.")}function u(e){return"[object Object]"===Object.prototype.toString.call(e)}function m(e){return u(e)?Object.keys(e).reduce(function(t,n){const r=u(e[n]),i=r?m(e[n]):e[n],o=r&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[n]:i})},{}):e}function _(e,t,n){t&&!n.has(t.id)&&(n.set(t.id,t),Object.keys(t).forEach(r=>{r.endsWith("Id")?_(e,e.get(t[r]),n):r.endsWith("Ids")&&t[r].forEach(t=>{_(e,e.get(t),n)})}))}function f(e,t,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const o=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)}),o.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&_(e,n,i)})}),i}const g=h;function C(e,t){const n=e&&e.navigator;if(!n.mediaDevices)return;const r=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach(n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];let e={};"number"==typeof r.ideal?(e[i("min",n)]=r.ideal,t.optional.push(e),e={},e[i("max",n)]=r.ideal,t.optional.push(e)):(e[i("",n)]=r.ideal,t.optional.push(e))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach(e=>{void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return n.mediaDevices.enumerateDevices().then(n=>{let s=(n=n.filter(e=>"videoinput"===e.kind)).find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!s&&n.length&&t.includes("back")&&(s=n[n.length-1]),s&&(e.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=r(e.video),g("chrome: "+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return g("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(o(e))})})}.bind(n),n.mediaDevices.getUserMedia){const e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>Promise.reject(o(e))))}}}function y(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then(t=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(n)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function v(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function b(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else c(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function S(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{const t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function k(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,r]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach(e=>{const n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(t=>{n[t]=e.stat(t)}),t[n.id]=n}),t},o=function(e){return new Map(Object.keys(e).map(t=>[t,e[t]]))};if(arguments.length>=2){const r=function(e){n(o(i(e)))};return t.apply(this,[r,e])}return new Promise((e,n)=>{t.apply(this,[function(t){e(o(i(t)))},n])}).then(n,r)}}function T(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>f(t,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),c(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>f(t,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function E(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});const t=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter(e=>-1===t.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(r)};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{const n=this._shimmedLocalStreams[t].indexOf(e);-1!==n&&this._shimmedLocalStreams[t].splice(n,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function P(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return E(e);const n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){const n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find(e=>e===t))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(e=>e.track===t))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)},["createOffer","createAnswer"].forEach(function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[t=>{const n=o(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>o(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]});const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=a.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function R(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]})}function w(e,t){c(e,"negotiationneeded",e=>{const n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e})}function A(e,t){const n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){p("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,"autoGainControl","mozAutoGainControl"),e(n.audio,"noiseSuppression","mozNoiseSuppression")),t(n)},r&&r.prototype.getSettings){const t=r.prototype.getSettings;r.prototype.getSettings=function(){const n=t.apply(this,arguments);return e(n,"mozAutoGainControl","autoGainControl"),e(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),e(n,"autoGainControl","mozAutoGainControl"),e(n,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[n])}}}}function I(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}function x(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function O(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]});const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,o]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(t){if("TypeError"!==t.name)throw t;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,o)}}function D(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function M(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),c(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function L(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){p("removeStream","removeTrack"),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function H(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function G(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const n=e.length>0;n&&e.forEach(e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const r=t.apply(this,arguments);if(n){const{sender:t}=r,n=t.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function j(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function N(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function U(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function F(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function z(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)})})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const n=new Event("addstream");n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function J(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let a=function(e,t,n){const r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=a,a=function(e,t,n){const r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=a,a=function(e,t,n){const r=s.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=a}function q(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(K(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function K(e){return e&&void 0!==e.video?Object.assign({},e,{video:m(e.video)}):e}function W(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){const t=[];for(let n=0;nt.generateCertificate})}function Y(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function V(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const n=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function B(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Z=n(539),X=n.n(Z);function $(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){const n=new t(e),r=X().parseCandidate(e.candidate);for(const e in r)e in n||Object.defineProperty(n,e,{value:r[e]});return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,c(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function Q(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||c(e,"icecandidate",e=>{if(e.candidate){const t=X().parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e})}function ee(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;const t=X().splitSections(e.sdp);return t.shift(),t.some(e=>{const t=X().parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")})}(arguments[0])){const e=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const n=parseInt(t[1],10);return n!=n?-1:n}(arguments[0]),n=function(e){let n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n}(e),r=function(e,n){let r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);const i=X().matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substring(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r}(arguments[0],e);let i;i=0===n&&0===r?Number.POSITIVE_INFINITY:0===n||0===r?Math.max(n,r):Math.min(n,r);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return n.apply(this,arguments)}}function te(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const n=e.send;e.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}const n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=n.apply(this,arguments);return t(e,this),e},c(e,"datachannel",e=>(t(e.channel,e.target),e))}function ne(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{const n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function re(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const n=t.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==e.trim()).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function ie(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function oe(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return n.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}if(e.sdp||"offer"!==e.type&&"answer"!==e.type)return n.apply(this,[e]);return("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then(e=>n.apply(this,[e]))})}!function({window:n}={},o={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const s=h,c=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator||!e.navigator.userAgent)return t.browser="Not a browser.",t;const{navigator:n}=e;if(n.mozGetUserMedia)t.browser="firefox",t.version=a(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=a(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=a(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(n),p={browserDetails:c,commonShim:i,extractVersion:a,disableLog:d,disableWarnings:l,sdp:Z};switch(c.browser){case"chrome":if(!e||!R||!o.shimChrome)return s("Chrome shim is not included in this adapter release."),p;if(null===c.version)return s("Chrome shim can not determine version, not shimming."),p;s("adapter.js shimming chrome."),p.browserShim=e,ie(n,c),oe(n),C(n,c),v(n),R(n,c),b(n),P(n,c),S(n),k(n),T(n),w(n,c),$(n),Q(n),ne(n),ee(n,c),te(n),re(n,c);break;case"firefox":if(!t||!O||!o.shimFirefox)return s("Firefox shim is not included in this adapter release."),p;s("adapter.js shimming firefox."),p.browserShim=t,ie(n,c),oe(n),A(n,c),O(n,c),x(n),L(n),D(n),M(n),H(n),G(n),j(n),N(n),U(n),$(n),ne(n),ee(n,c),te(n);break;case"safari":if(!r||!o.shimSafari)return s("Safari shim is not included in this adapter release."),p;s("adapter.js shimming safari."),p.browserShim=r,ie(n,c),oe(n),W(n),V(n),J(n),F(n),z(n),Y(n),q(n),B(n),$(n),Q(n),ee(n,c),te(n),re(n,c);break;default:s("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});const se=Object.freeze({meta:null,signalingServerUrl:"ws://127.0.0.1:8443",reconnectionTimeout:2500,webrtcConfig:{iceServers:[{urls:["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302"]}],bundlePolicy:"max-bundle"}}),ae={idle:0,connecting:1,streaming:2,closed:3};Object.freeze(ae);const ce=ae;class de extends EventTarget{constructor(e,t){super(),this._peerId=e,this._sessionId="",this._comChannel=t,this._state=ce.idle,this._rtcPeerConnection=null}get peerId(){return this._peerId}get sessionId(){return this._sessionId}get state(){return this._state}get rtcPeerConnection(){return this._rtcPeerConnection}close(){this._state!==ce.closed&&(this._state!==ce.idle&&this._comChannel&&this._sessionId&&this._comChannel.send({type:"endSession",sessionId:this._sessionId}),this._state=ce.closed,this.dispatchEvent(new Event("stateChanged")),this._comChannel=null,this._rtcPeerConnection&&(this._rtcPeerConnection.close(),this._rtcPeerConnection=null,this.dispatchEvent(new Event("rtcPeerConnectionChanged"))),this.dispatchEvent(new Event("closed")))}}const le=de,he=Object.freeze({32:"space",33:"exclam",34:"quotedbl",35:"numbersign",36:"dollar",37:"percent",38:"ampersand",39:"apostrophe",40:"parenleft",41:"parenright",42:"asterisk",43:"plus",44:"comma",45:"minus",46:"period",47:"slash",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",58:"colon",59:"semicolon",60:"less",61:"equal",62:"greater",63:"question",64:"at",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"bracketleft",92:"backslash",93:"bracketright",94:"asciicircum",95:"underscore",96:"grave",97:"a",98:"b",99:"c",100:"d",101:"e",102:"f",103:"g",104:"h",105:"i",106:"j",107:"k",108:"l",109:"m",110:"n",111:"o",112:"p",113:"q",114:"r",115:"s",116:"t",117:"u",118:"v",119:"w",120:"x",121:"y",122:"z",123:"braceleft",124:"bar",125:"braceright",126:"asciitilde",160:"nobreakspace",161:"exclamdown",162:"cent",163:"sterling",164:"currency",165:"yen",166:"brokenbar",167:"section",168:"diaeresis",169:"copyright",170:"ordfeminine",171:"guillemotleft",172:"notsign",173:"hyphen",174:"registered",175:"macron",176:"degree",177:"plusminus",178:"twosuperior",179:"threesuperior",180:"acute",181:"mu",182:"paragraph",183:"periodcentered",184:"cedilla",185:"onesuperior",186:"masculine",187:"guillemotright",188:"onequarter",189:"onehalf",190:"threequarters",191:"questiondown",192:"Agrave",193:"Aacute",194:"Acircumflex",195:"Atilde",196:"Adiaeresis",197:"Aring",198:"AE",199:"Ccedilla",200:"Egrave",201:"Eacute",202:"Ecircumflex",203:"Ediaeresis",204:"Igrave",205:"Iacute",206:"Icircumflex",207:"Idiaeresis",208:"ETH",209:"Ntilde",210:"Ograve",211:"Oacute",212:"Ocircumflex",213:"Otilde",214:"Odiaeresis",215:"multiply",216:"Ooblique",217:"Ugrave",218:"Uacute",219:"Ucircumflex",220:"Udiaeresis",221:"Yacute",222:"THORN",223:"ssharp",224:"agrave",225:"aacute",226:"acircumflex",227:"atilde",228:"adiaeresis",229:"aring",230:"ae",231:"ccedilla",232:"egrave",233:"eacute",234:"ecircumflex",235:"ediaeresis",236:"igrave",237:"iacute",238:"icircumflex",239:"idiaeresis",240:"eth",241:"ntilde",242:"ograve",243:"oacute",244:"ocircumflex",245:"otilde",246:"odiaeresis",247:"division",248:"oslash",249:"ugrave",250:"uacute",251:"ucircumflex",252:"udiaeresis",253:"yacute",254:"thorn",255:"ydiaeresis",260:"Aogonek",728:"breve",321:"Lstroke",317:"Lcaron",346:"Sacute",352:"Scaron",350:"Scedilla",356:"Tcaron",377:"Zacute",381:"Zcaron",379:"Zabovedot",261:"aogonek",731:"ogonek",322:"lstroke",318:"lcaron",347:"sacute",711:"caron",353:"scaron",351:"scedilla",357:"tcaron",378:"zacute",733:"doubleacute",382:"zcaron",380:"zabovedot",340:"Racute",258:"Abreve",313:"Lacute",262:"Cacute",268:"Ccaron",280:"Eogonek",282:"Ecaron",270:"Dcaron",272:"Dstroke",323:"Nacute",327:"Ncaron",336:"Odoubleacute",344:"Rcaron",366:"Uring",368:"Udoubleacute",354:"Tcedilla",341:"racute",259:"abreve",314:"lacute",263:"cacute",269:"ccaron",281:"eogonek",283:"ecaron",271:"dcaron",273:"dstroke",324:"nacute",328:"ncaron",337:"odoubleacute",345:"rcaron",367:"uring",369:"udoubleacute",355:"tcedilla",729:"abovedot",294:"Hstroke",292:"Hcircumflex",304:"Iabovedot",286:"Gbreve",308:"Jcircumflex",295:"hstroke",293:"hcircumflex",305:"idotless",287:"gbreve",309:"jcircumflex",266:"Cabovedot",264:"Ccircumflex",288:"Gabovedot",284:"Gcircumflex",364:"Ubreve",348:"Scircumflex",267:"cabovedot",265:"ccircumflex",289:"gabovedot",285:"gcircumflex",365:"ubreve",349:"scircumflex",312:"kra",342:"Rcedilla",296:"Itilde",315:"Lcedilla",274:"Emacron",290:"Gcedilla",358:"Tslash",343:"rcedilla",297:"itilde",316:"lcedilla",275:"emacron",291:"gcedilla",359:"tslash",330:"ENG",331:"eng",256:"Amacron",302:"Iogonek",278:"Eabovedot",298:"Imacron",325:"Ncedilla",332:"Omacron",310:"Kcedilla",370:"Uogonek",360:"Utilde",362:"Umacron",257:"amacron",303:"iogonek",279:"eabovedot",299:"imacron",326:"ncedilla",333:"omacron",311:"kcedilla",371:"uogonek",361:"utilde",363:"umacron",8254:"overline",12290:"kana_fullstop",12300:"kana_openingbracket",12301:"kana_closingbracket",12289:"kana_comma",12539:"kana_conjunctive",12530:"kana_WO",12449:"kana_a",12451:"kana_i",12453:"kana_u",12455:"kana_e",12457:"kana_o",12515:"kana_ya",12517:"kana_yu",12519:"kana_yo",12483:"kana_tsu",12540:"prolongedsound",12450:"kana_A",12452:"kana_I",12454:"kana_U",12456:"kana_E",12458:"kana_O",12459:"kana_KA",12461:"kana_KI",12463:"kana_KU",12465:"kana_KE",12467:"kana_KO",12469:"kana_SA",12471:"kana_SHI",12473:"kana_SU",12475:"kana_SE",12477:"kana_SO",12479:"kana_TA",12481:"kana_CHI",12484:"kana_TSU",12486:"kana_TE",12488:"kana_TO",12490:"kana_NA",12491:"kana_NI",12492:"kana_NU",12493:"kana_NE",12494:"kana_NO",12495:"kana_HA",12498:"kana_HI",12501:"kana_FU",12504:"kana_HE",12507:"kana_HO",12510:"kana_MA",12511:"kana_MI",12512:"kana_MU",12513:"kana_ME",12514:"kana_MO",12516:"kana_YA",12518:"kana_YU",12520:"kana_YO",12521:"kana_RA",12522:"kana_RI",12523:"kana_RU",12524:"kana_RE",12525:"kana_RO",12527:"kana_WA",12531:"kana_N",12443:"voicedsound",12444:"semivoicedsound",1548:"Arabic_comma",1563:"Arabic_semicolon",1567:"Arabic_question_mark",1569:"Arabic_hamza",1570:"Arabic_maddaonalef",1571:"Arabic_hamzaonalef",1572:"Arabic_hamzaonwaw",1573:"Arabic_hamzaunderalef",1574:"Arabic_hamzaonyeh",1575:"Arabic_alef",1576:"Arabic_beh",1577:"Arabic_tehmarbuta",1578:"Arabic_teh",1579:"Arabic_theh",1580:"Arabic_jeem",1581:"Arabic_hah",1582:"Arabic_khah",1583:"Arabic_dal",1584:"Arabic_thal",1585:"Arabic_ra",1586:"Arabic_zain",1587:"Arabic_seen",1588:"Arabic_sheen",1589:"Arabic_sad",1590:"Arabic_dad",1591:"Arabic_tah",1592:"Arabic_zah",1593:"Arabic_ain",1594:"Arabic_ghain",1600:"Arabic_tatweel",1601:"Arabic_feh",1602:"Arabic_qaf",1603:"Arabic_kaf",1604:"Arabic_lam",1605:"Arabic_meem",1606:"Arabic_noon",1607:"Arabic_ha",1608:"Arabic_waw",1609:"Arabic_alefmaksura",1610:"Arabic_yeh",1611:"Arabic_fathatan",1612:"Arabic_dammatan",1613:"Arabic_kasratan",1614:"Arabic_fatha",1615:"Arabic_damma",1616:"Arabic_kasra",1617:"Arabic_shadda",1618:"Arabic_sukun",1106:"Serbian_dje",1107:"Macedonia_gje",1105:"Cyrillic_io",1108:"Ukrainian_ie",1109:"Macedonia_dse",1110:"Ukrainian_i",1111:"Ukrainian_yi",1112:"Cyrillic_je",1113:"Cyrillic_lje",1114:"Cyrillic_nje",1115:"Serbian_tshe",1116:"Macedonia_kje",1118:"Byelorussian_shortu",1119:"Cyrillic_dzhe",8470:"numerosign",1026:"Serbian_DJE",1027:"Macedonia_GJE",1025:"Cyrillic_IO",1028:"Ukrainian_IE",1029:"Macedonia_DSE",1030:"Ukrainian_I",1031:"Ukrainian_YI",1032:"Cyrillic_JE",1033:"Cyrillic_LJE",1034:"Cyrillic_NJE",1035:"Serbian_TSHE",1036:"Macedonia_KJE",1038:"Byelorussian_SHORTU",1039:"Cyrillic_DZHE",1102:"Cyrillic_yu",1072:"Cyrillic_a",1073:"Cyrillic_be",1094:"Cyrillic_tse",1076:"Cyrillic_de",1077:"Cyrillic_ie",1092:"Cyrillic_ef",1075:"Cyrillic_ghe",1093:"Cyrillic_ha",1080:"Cyrillic_i",1081:"Cyrillic_shorti",1082:"Cyrillic_ka",1083:"Cyrillic_el",1084:"Cyrillic_em",1085:"Cyrillic_en",1086:"Cyrillic_o",1087:"Cyrillic_pe",1103:"Cyrillic_ya",1088:"Cyrillic_er",1089:"Cyrillic_es",1090:"Cyrillic_te",1091:"Cyrillic_u",1078:"Cyrillic_zhe",1074:"Cyrillic_ve",1100:"Cyrillic_softsign",1099:"Cyrillic_yeru",1079:"Cyrillic_ze",1096:"Cyrillic_sha",1101:"Cyrillic_e",1097:"Cyrillic_shcha",1095:"Cyrillic_che",1098:"Cyrillic_hardsign",1070:"Cyrillic_YU",1040:"Cyrillic_A",1041:"Cyrillic_BE",1062:"Cyrillic_TSE",1044:"Cyrillic_DE",1045:"Cyrillic_IE",1060:"Cyrillic_EF",1043:"Cyrillic_GHE",1061:"Cyrillic_HA",1048:"Cyrillic_I",1049:"Cyrillic_SHORTI",1050:"Cyrillic_KA",1051:"Cyrillic_EL",1052:"Cyrillic_EM",1053:"Cyrillic_EN",1054:"Cyrillic_O",1055:"Cyrillic_PE",1071:"Cyrillic_YA",1056:"Cyrillic_ER",1057:"Cyrillic_ES",1058:"Cyrillic_TE",1059:"Cyrillic_U",1046:"Cyrillic_ZHE",1042:"Cyrillic_VE",1068:"Cyrillic_SOFTSIGN",1067:"Cyrillic_YERU",1047:"Cyrillic_ZE",1064:"Cyrillic_SHA",1069:"Cyrillic_E",1065:"Cyrillic_SHCHA",1063:"Cyrillic_CHE",1066:"Cyrillic_HARDSIGN",902:"Greek_ALPHAaccent",904:"Greek_EPSILONaccent",905:"Greek_ETAaccent",906:"Greek_IOTAaccent",938:"Greek_IOTAdiaeresis",908:"Greek_OMICRONaccent",910:"Greek_UPSILONaccent",939:"Greek_UPSILONdieresis",911:"Greek_OMEGAaccent",901:"Greek_accentdieresis",8213:"Greek_horizbar",940:"Greek_alphaaccent",941:"Greek_epsilonaccent",942:"Greek_etaaccent",943:"Greek_iotaaccent",970:"Greek_iotadieresis",912:"Greek_iotaaccentdieresis",972:"Greek_omicronaccent",973:"Greek_upsilonaccent",971:"Greek_upsilondieresis",944:"Greek_upsilonaccentdieresis",974:"Greek_omegaaccent",913:"Greek_ALPHA",914:"Greek_BETA",915:"Greek_GAMMA",916:"Greek_DELTA",917:"Greek_EPSILON",918:"Greek_ZETA",919:"Greek_ETA",920:"Greek_THETA",921:"Greek_IOTA",922:"Greek_KAPPA",923:"Greek_LAMBDA",924:"Greek_MU",925:"Greek_NU",926:"Greek_XI",927:"Greek_OMICRON",928:"Greek_PI",929:"Greek_RHO",931:"Greek_SIGMA",932:"Greek_TAU",933:"Greek_UPSILON",934:"Greek_PHI",935:"Greek_CHI",936:"Greek_PSI",937:"Greek_OMEGA",945:"Greek_alpha",946:"Greek_beta",947:"Greek_gamma",948:"Greek_delta",949:"Greek_epsilon",950:"Greek_zeta",951:"Greek_eta",952:"Greek_theta",953:"Greek_iota",954:"Greek_kappa",955:"Greek_lambda",956:"Greek_mu",957:"Greek_nu",958:"Greek_xi",959:"Greek_omicron",960:"Greek_pi",961:"Greek_rho",963:"Greek_sigma",962:"Greek_finalsmallsigma",964:"Greek_tau",965:"Greek_upsilon",966:"Greek_phi",967:"Greek_chi",968:"Greek_psi",969:"Greek_omega",9143:"leftradical",8992:"topintegral",8993:"botintegral",9121:"topleftsqbracket",9123:"botleftsqbracket",9124:"toprightsqbracket",9126:"botrightsqbracket",9115:"topleftparens",9117:"botleftparens",9118:"toprightparens",9120:"botrightparens",9128:"leftmiddlecurlybrace",9132:"rightmiddlecurlybrace",8804:"lessthanequal",8800:"notequal",8805:"greaterthanequal",8747:"integral",8756:"therefore",8733:"variation",8734:"infinity",8711:"nabla",8764:"approximate",8771:"similarequal",8660:"ifonlyif",8658:"implies",8801:"identical",8730:"radical",8834:"includedin",8835:"includes",8745:"intersection",8746:"union",8743:"logicaland",8744:"logicalor",8706:"partialderivative",402:"function",8592:"leftarrow",8593:"uparrow",8594:"rightarrow",8595:"downarrow",9670:"soliddiamond",9618:"checkerboard",9225:"ht",9228:"ff",9229:"cr",9226:"lf",9252:"nl",9227:"vt",9496:"lowrightcorner",9488:"uprightcorner",9484:"upleftcorner",9492:"lowleftcorner",9532:"crossinglines",9146:"horizlinescan1",9147:"horizlinescan3",9472:"horizlinescan5",9148:"horizlinescan7",9149:"horizlinescan9",9500:"leftt",9508:"rightt",9524:"bott",9516:"topt",9474:"vertbar",8195:"emspace",8194:"enspace",8196:"em3space",8197:"em4space",8199:"digitspace",8200:"punctspace",8201:"thinspace",8202:"hairspace",8212:"emdash",8211:"endash",9251:"signifblank",8230:"ellipsis",8229:"doubbaselinedot",8531:"onethird",8532:"twothirds",8533:"onefifth",8534:"twofifths",8535:"threefifths",8536:"fourfifths",8537:"onesixth",8538:"fivesixths",8453:"careof",8210:"figdash",10216:"leftanglebracket",10217:"rightanglebracket",8539:"oneeighth",8540:"threeeighths",8541:"fiveeighths",8542:"seveneighths",8482:"trademark",9747:"signaturemark",9665:"leftopentriangle",9655:"rightopentriangle",9647:"emopenrectangle",8216:"leftsinglequotemark",8217:"rightsinglequotemark",8220:"leftdoublequotemark",8221:"rightdoublequotemark",8478:"prescription",8242:"minutes",8243:"seconds",10013:"latincross",9644:"filledrectbullet",9664:"filledlefttribullet",9654:"filledrighttribullet",9679:"emfilledcircle",9646:"emfilledrect",9702:"enopencircbullet",9643:"enopensquarebullet",9645:"openrectbullet",9651:"opentribulletup",9661:"opentribulletdown",9734:"openstar",8226:"enfilledcircbullet",9642:"enfilledsqbullet",9650:"filledtribulletup",9660:"filledtribulletdown",9756:"leftpointer",9758:"rightpointer",9827:"club",9830:"diamond",9829:"heart",10016:"maltesecross",8224:"dagger",8225:"doubledagger",10003:"checkmark",10007:"ballotcross",9839:"musicalsharp",9837:"musicalflat",9794:"malesymbol",9792:"femalesymbol",9742:"telephone",8981:"telephonerecorder",8471:"phonographcopyright",8248:"caret",8218:"singlelowquotemark",8222:"doublelowquotemark",8869:"downtack",8970:"downstile",8728:"jot",9109:"quad",8868:"uptack",9675:"circle",8968:"upstile",8866:"lefttack",8867:"righttack",8215:"hebrew_doublelowline",1488:"hebrew_aleph",1489:"hebrew_beth",1490:"hebrew_gimmel",1491:"hebrew_daleth",1492:"hebrew_he",1493:"hebrew_waw",1494:"hebrew_zayin",1495:"hebrew_het",1496:"hebrew_teth",1497:"hebrew_yod",1498:"hebrew_finalkaph",1499:"hebrew_kaph",1500:"hebrew_lamed",1501:"hebrew_finalmem",1502:"hebrew_mem",1503:"hebrew_finalnun",1504:"hebrew_nun",1505:"hebrew_samekh",1506:"hebrew_ayin",1507:"hebrew_finalpe",1508:"hebrew_pe",1509:"hebrew_finalzadi",1510:"hebrew_zadi",1511:"hebrew_qoph",1512:"hebrew_resh",1513:"hebrew_shin",1514:"hebrew_taw",3585:"Thai_kokai",3586:"Thai_khokhai",3587:"Thai_khokhuat",3588:"Thai_khokhwai",3589:"Thai_khokhon",3590:"Thai_khorakhang",3591:"Thai_ngongu",3592:"Thai_chochan",3593:"Thai_choching",3594:"Thai_chochang",3595:"Thai_soso",3596:"Thai_chochoe",3597:"Thai_yoying",3598:"Thai_dochada",3599:"Thai_topatak",3600:"Thai_thothan",3601:"Thai_thonangmontho",3602:"Thai_thophuthao",3603:"Thai_nonen",3604:"Thai_dodek",3605:"Thai_totao",3606:"Thai_thothung",3607:"Thai_thothahan",3608:"Thai_thothong",3609:"Thai_nonu",3610:"Thai_bobaimai",3611:"Thai_popla",3612:"Thai_phophung",3613:"Thai_fofa",3614:"Thai_phophan",3615:"Thai_fofan",3616:"Thai_phosamphao",3617:"Thai_moma",3618:"Thai_yoyak",3619:"Thai_rorua",3620:"Thai_ru",3621:"Thai_loling",3622:"Thai_lu",3623:"Thai_wowaen",3624:"Thai_sosala",3625:"Thai_sorusi",3626:"Thai_sosua",3627:"Thai_hohip",3628:"Thai_lochula",3629:"Thai_oang",3630:"Thai_honokhuk",3631:"Thai_paiyannoi",3632:"Thai_saraa",3633:"Thai_maihanakat",3634:"Thai_saraaa",3635:"Thai_saraam",3636:"Thai_sarai",3637:"Thai_saraii",3638:"Thai_saraue",3639:"Thai_sarauee",3640:"Thai_sarau",3641:"Thai_sarauu",3642:"Thai_phinthu",3647:"Thai_baht",3648:"Thai_sarae",3649:"Thai_saraae",3650:"Thai_sarao",3651:"Thai_saraaimaimuan",3652:"Thai_saraaimaimalai",3653:"Thai_lakkhangyao",3654:"Thai_maiyamok",3655:"Thai_maitaikhu",3656:"Thai_maiek",3657:"Thai_maitho",3658:"Thai_maitri",3659:"Thai_maichattawa",3660:"Thai_thanthakhat",3661:"Thai_nikhahit",3664:"Thai_leksun",3665:"Thai_leknung",3666:"Thai_leksong",3667:"Thai_leksam",3668:"Thai_leksi",3669:"Thai_lekha",3670:"Thai_lekhok",3671:"Thai_lekchet",3672:"Thai_lekpaet",3673:"Thai_lekkao",12593:"Hangul_Kiyeog",12594:"Hangul_SsangKiyeog",12595:"Hangul_KiyeogSios",12596:"Hangul_Nieun",12597:"Hangul_NieunJieuj",12598:"Hangul_NieunHieuh",12599:"Hangul_Dikeud",12600:"Hangul_SsangDikeud",12601:"Hangul_Rieul",12602:"Hangul_RieulKiyeog",12603:"Hangul_RieulMieum",12604:"Hangul_RieulPieub",12605:"Hangul_RieulSios",12606:"Hangul_RieulTieut",12607:"Hangul_RieulPhieuf",12608:"Hangul_RieulHieuh",12609:"Hangul_Mieum",12610:"Hangul_Pieub",12611:"Hangul_SsangPieub",12612:"Hangul_PieubSios",12613:"Hangul_Sios",12614:"Hangul_SsangSios",12615:"Hangul_Ieung",12616:"Hangul_Jieuj",12617:"Hangul_SsangJieuj",12618:"Hangul_Cieuc",12619:"Hangul_Khieuq",12620:"Hangul_Tieut",12621:"Hangul_Phieuf",12622:"Hangul_Hieuh",12623:"Hangul_A",12624:"Hangul_AE",12625:"Hangul_YA",12626:"Hangul_YAE",12627:"Hangul_EO",12628:"Hangul_E",12629:"Hangul_YEO",12630:"Hangul_YE",12631:"Hangul_O",12632:"Hangul_WA",12633:"Hangul_WAE",12634:"Hangul_OE",12635:"Hangul_YO",12636:"Hangul_U",12637:"Hangul_WEO",12638:"Hangul_WE",12639:"Hangul_WI",12640:"Hangul_YU",12641:"Hangul_EU",12642:"Hangul_YI",12643:"Hangul_I",4520:"Hangul_J_Kiyeog",4521:"Hangul_J_SsangKiyeog",4522:"Hangul_J_KiyeogSios",4523:"Hangul_J_Nieun",4524:"Hangul_J_NieunJieuj",4525:"Hangul_J_NieunHieuh",4526:"Hangul_J_Dikeud",4527:"Hangul_J_Rieul",4528:"Hangul_J_RieulKiyeog",4529:"Hangul_J_RieulMieum",4530:"Hangul_J_RieulPieub",4531:"Hangul_J_RieulSios",4532:"Hangul_J_RieulTieut",4533:"Hangul_J_RieulPhieuf",4534:"Hangul_J_RieulHieuh",4535:"Hangul_J_Mieum",4536:"Hangul_J_Pieub",4537:"Hangul_J_PieubSios",4538:"Hangul_J_Sios",4539:"Hangul_J_SsangSios",4540:"Hangul_J_Ieung",4541:"Hangul_J_Jieuj",4542:"Hangul_J_Cieuc",4543:"Hangul_J_Khieuq",4544:"Hangul_J_Tieut",4545:"Hangul_J_Phieuf",4546:"Hangul_J_Hieuh",12653:"Hangul_RieulYeorinHieuh",12657:"Hangul_SunkyeongeumMieum",12664:"Hangul_SunkyeongeumPieub",12671:"Hangul_PanSios",12673:"Hangul_KkogjiDalrinIeung",12676:"Hangul_SunkyeongeumPhieuf",12678:"Hangul_YeorinHieuh",12685:"Hangul_AraeA",12686:"Hangul_AraeAE",4587:"Hangul_J_PanSios",4592:"Hangul_J_KkogjiDalrinIeung",4601:"Hangul_J_YeorinHieuh",338:"OE",339:"oe",376:"Ydiaeresis",8352:"EcuSign",8353:"ColonSign",8354:"CruzeiroSign",8355:"FFrancSign",8356:"LiraSign",8357:"MillSign",8358:"NairaSign",8359:"PesetaSign",8360:"RupeeSign",8361:"WonSign",8362:"NewSheqelSign",8363:"DongSign",8364:"EuroSign",768:"dead_grave",769:"dead_acute",770:"dead_circumflex",771:"dead_tilde",772:"dead_macron",774:"dead_breve",775:"dead_abovedot",776:"dead_diaeresis",778:"dead_abovering",779:"dead_doubleacute",780:"dead_caron",807:"dead_cedilla",808:"dead_ogonek",837:"dead_iota",12441:"dead_voiced_sound",12442:"dead_semivoiced_sound",8:"BackSpace",9:"Tab",10:"Linefeed",11:"Clear",13:"Return",19:"Pause",20:"Scroll_Lock",21:"Sys_Req",27:"Escape",1169:"Ukrainian_ghe_with_upturn",1168:"Ukrainian_GHE_WITH_UPTURN",1415:"Armenian_ligature_ew",1417:"Armenian_verjaket",1373:"Armenian_but",1418:"Armenian_yentamna",1372:"Armenian_amanak",1371:"Armenian_shesht",1374:"Armenian_paruyk",1329:"Armenian_AYB",1377:"Armenian_ayb",1330:"Armenian_BEN",1378:"Armenian_ben",1331:"Armenian_GIM",1379:"Armenian_gim",1332:"Armenian_DA",1380:"Armenian_da",1333:"Armenian_YECH",1381:"Armenian_yech",1334:"Armenian_ZA",1382:"Armenian_za",1335:"Armenian_E",1383:"Armenian_e",1336:"Armenian_AT",1384:"Armenian_at",1337:"Armenian_TO",1385:"Armenian_to",1338:"Armenian_ZHE",1386:"Armenian_zhe",1339:"Armenian_INI",1387:"Armenian_ini",1340:"Armenian_LYUN",1388:"Armenian_lyun",1341:"Armenian_KHE",1389:"Armenian_khe",1342:"Armenian_TSA",1390:"Armenian_tsa",1343:"Armenian_KEN",1391:"Armenian_ken",1344:"Armenian_HO",1392:"Armenian_ho",1345:"Armenian_DZA",1393:"Armenian_dza",1346:"Armenian_GHAT",1394:"Armenian_ghat",1347:"Armenian_TCHE",1395:"Armenian_tche",1348:"Armenian_MEN",1396:"Armenian_men",1349:"Armenian_HI",1397:"Armenian_hi",1350:"Armenian_NU",1398:"Armenian_nu",1351:"Armenian_SHA",1399:"Armenian_sha",1352:"Armenian_VO",1400:"Armenian_vo",1353:"Armenian_CHA",1401:"Armenian_cha",1354:"Armenian_PE",1402:"Armenian_pe",1355:"Armenian_JE",1403:"Armenian_je",1356:"Armenian_RA",1404:"Armenian_ra",1357:"Armenian_SE",1405:"Armenian_se",1358:"Armenian_VEV",1406:"Armenian_vev",1359:"Armenian_TYUN",1407:"Armenian_tyun",1360:"Armenian_RE",1408:"Armenian_re",1361:"Armenian_TSO",1409:"Armenian_tso",1362:"Armenian_VYUN",1410:"Armenian_vyun",1363:"Armenian_PYUR",1411:"Armenian_pyur",1364:"Armenian_KE",1412:"Armenian_ke",1365:"Armenian_O",1413:"Armenian_o",1366:"Armenian_FE",1414:"Armenian_fe",1370:"Armenian_apostrophe",4304:"Georgian_an",4305:"Georgian_ban",4306:"Georgian_gan",4307:"Georgian_don",4308:"Georgian_en",4309:"Georgian_vin",4310:"Georgian_zen",4311:"Georgian_tan",4312:"Georgian_in",4313:"Georgian_kan",4314:"Georgian_las",4315:"Georgian_man",4316:"Georgian_nar",4317:"Georgian_on",4318:"Georgian_par",4319:"Georgian_zhar",4320:"Georgian_rae",4321:"Georgian_san",4322:"Georgian_tar",4323:"Georgian_un",4324:"Georgian_phar",4325:"Georgian_khar",4326:"Georgian_ghan",4327:"Georgian_qar",4328:"Georgian_shin",4329:"Georgian_chin",4330:"Georgian_can",4331:"Georgian_jil",4332:"Georgian_cil",4333:"Georgian_char",4334:"Georgian_xan",4335:"Georgian_jhan",4336:"Georgian_hae",4337:"Georgian_he",4338:"Georgian_hie",4339:"Georgian_we",4340:"Georgian_har",4341:"Georgian_hoe",4342:"Georgian_fi",7682:"Babovedot",7683:"babovedot",7690:"Dabovedot",7808:"Wgrave",7810:"Wacute",7691:"dabovedot",7922:"Ygrave",7710:"Fabovedot",7711:"fabovedot",7744:"Mabovedot",7745:"mabovedot",7766:"Pabovedot",7809:"wgrave",7767:"pabovedot",7811:"wacute",7776:"Sabovedot",7923:"ygrave",7812:"Wdiaeresis",7813:"wdiaeresis",7777:"sabovedot",372:"Wcircumflex",7786:"Tabovedot",374:"Ycircumflex",373:"wcircumflex",7787:"tabovedot",375:"ycircumflex",1776:"Farsi_0",1777:"Farsi_1",1778:"Farsi_2",1779:"Farsi_3",1780:"Farsi_4",1781:"Farsi_5",1782:"Farsi_6",1783:"Farsi_7",1784:"Farsi_8",1785:"Farsi_9",1642:"Arabic_percent",1648:"Arabic_superscript_alef",1657:"Arabic_tteh",1662:"Arabic_peh",1670:"Arabic_tcheh",1672:"Arabic_ddal",1681:"Arabic_rreh",1748:"Arabic_fullstop",1632:"Arabic_0",1633:"Arabic_1",1634:"Arabic_2",1635:"Arabic_3",1636:"Arabic_4",1637:"Arabic_5",1638:"Arabic_6",1639:"Arabic_7",1640:"Arabic_8",1641:"Arabic_9",1619:"Arabic_madda_above",1620:"Arabic_hamza_above",1621:"Arabic_hamza_below",1688:"Arabic_jeh",1700:"Arabic_veh",1705:"Arabic_keheh",1711:"Arabic_gaf",1722:"Arabic_noon_ghunna",1726:"Arabic_heh_doachashmee",1740:"Farsi_yeh",1746:"Arabic_yeh_baree",1729:"Arabic_heh_goal",1170:"Cyrillic_GHE_bar",1174:"Cyrillic_ZHE_descender",1178:"Cyrillic_KA_descender",1180:"Cyrillic_KA_vertstroke",1186:"Cyrillic_EN_descender",1198:"Cyrillic_U_straight",1200:"Cyrillic_U_straight_bar",1202:"Cyrillic_HA_descender",1206:"Cyrillic_CHE_descender",1208:"Cyrillic_CHE_vertstroke",1210:"Cyrillic_SHHA",1240:"Cyrillic_SCHWA",1250:"Cyrillic_I_macron",1256:"Cyrillic_O_bar",1262:"Cyrillic_U_macron",1171:"Cyrillic_ghe_bar",1175:"Cyrillic_zhe_descender",1179:"Cyrillic_ka_descender",1181:"Cyrillic_ka_vertstroke",1187:"Cyrillic_en_descender",1199:"Cyrillic_u_straight",1201:"Cyrillic_u_straight_bar",1203:"Cyrillic_ha_descender",1207:"Cyrillic_che_descender",1209:"Cyrillic_che_vertstroke",1211:"Cyrillic_shha",1241:"Cyrillic_schwa",1251:"Cyrillic_i_macron",1257:"Cyrillic_o_bar",1263:"Cyrillic_u_macron",7818:"Xabovedot",300:"Ibreve",437:"Zstroke",486:"Gcaron",415:"Obarred",7819:"xabovedot",301:"ibreve",438:"zstroke",487:"gcaron",466:"ocaron",629:"obarred",399:"SCHWA",601:"schwa",7734:"Lbelowdot",7735:"lbelowdot",7840:"Abelowdot",7841:"abelowdot",7842:"Ahook",7843:"ahook",7844:"Acircumflexacute",7845:"acircumflexacute",7846:"Acircumflexgrave",7847:"acircumflexgrave",7848:"Acircumflexhook",7849:"acircumflexhook",7850:"Acircumflextilde",7851:"acircumflextilde",7852:"Acircumflexbelowdot",7853:"acircumflexbelowdot",7854:"Abreveacute",7855:"abreveacute",7856:"Abrevegrave",7857:"abrevegrave",7858:"Abrevehook",7859:"abrevehook",7860:"Abrevetilde",7861:"abrevetilde",7862:"Abrevebelowdot",7863:"abrevebelowdot",7864:"Ebelowdot",7865:"ebelowdot",7866:"Ehook",7867:"ehook",7868:"Etilde",7869:"etilde",7870:"Ecircumflexacute",7871:"ecircumflexacute",7872:"Ecircumflexgrave",7873:"ecircumflexgrave",7874:"Ecircumflexhook",7875:"ecircumflexhook",7876:"Ecircumflextilde",7877:"ecircumflextilde",7878:"Ecircumflexbelowdot",7879:"ecircumflexbelowdot",7880:"Ihook",7881:"ihook",7882:"Ibelowdot",7883:"ibelowdot",7884:"Obelowdot",7885:"obelowdot",7886:"Ohook",7887:"ohook",7888:"Ocircumflexacute",7889:"ocircumflexacute",7890:"Ocircumflexgrave",7891:"ocircumflexgrave",7892:"Ocircumflexhook",7893:"ocircumflexhook",7894:"Ocircumflextilde",7895:"ocircumflextilde",7896:"Ocircumflexbelowdot",7897:"ocircumflexbelowdot",7898:"Ohornacute",7899:"ohornacute",7900:"Ohorngrave",7901:"ohorngrave",7902:"Ohornhook",7903:"ohornhook",7904:"Ohorntilde",7905:"ohorntilde",7906:"Ohornbelowdot",7907:"ohornbelowdot",7908:"Ubelowdot",7909:"ubelowdot",7910:"Uhook",7911:"uhook",7912:"Uhornacute",7913:"uhornacute",7914:"Uhorngrave",7915:"uhorngrave",7916:"Uhornhook",7917:"uhornhook",7918:"Uhorntilde",7919:"uhorntilde",7920:"Uhornbelowdot",7921:"uhornbelowdot",7924:"Ybelowdot",7925:"ybelowdot",7926:"Yhook",7927:"yhook",7928:"Ytilde",7929:"ytilde",416:"Ohorn",417:"ohorn",431:"Uhorn",432:"uhorn",803:"dead_belowdot",777:"dead_hook",795:"dead_horn"}),pe=Object.freeze({AltLeft:"Alt_L",AltRight:"Alt_R",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",ArrowUp:"Up",Backspace:"BackSpace",CapsLock:"Caps_Lock",ControlLeft:"Control_L",ControlRight:"Control_R",Enter:"Return",HyperLeft:"Hyper_L",HyperRight:"Hyper_R",NumLock:"Num_Lock",NumpadEnter:"Return",MetaLeft:"Meta_L",MetaRight:"Meta_R",PageDown:"Page_Down",PageUp:"Page_Up",ScrollLock:"Scroll_Lock",ShiftLeft:"Shift_L",ShiftRight:"Shift_R",SuperLeft:"Super_L",SuperRight:"Super_R"}),ue=new Set(["Clear","Copy","Cut","Delete","End","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Home","Insert","Paste","Redo","Tab","Undo"]);function me(e,t){var n="Unidentified";if(1===e.length){const t=e.charCodeAt(0);t in he&&(n=he[t])}else t in pe?n=pe[t]:ue.has(t)&&(n=t);return n}const _e=Object.freeze(["wheel","contextmenu","mousemove","mousedown","mouseup","touchstart","touchend","touchmove","touchcancel","keyup","keydown"]),fe=Object.freeze({mousemove:"MouseMove",mousedown:"MouseButtonPress",mouseup:"MouseButtonRelease"}),ge=Object.freeze({touchstart:"TouchDown",touchend:"TouchUp",touchmove:"TouchMotion",touchcancel:"TouchUp"}),Ce=Object.freeze({keydown:"KeyPress",keyup:"KeyRelease"});function ye(e){const t=[];return e.altKey&&t.push("mod1-mask"),e.ctrlKey&&t.push("control-mask"),e.metaKey&&t.push("meta-mask"),e.shiftKey&&t.push("shift-mask"),t.join("+")}class ve extends EventTarget{constructor(e,t){super(),this._rtcDataChannel=e,this._consumerSession=t,this._videoElement=null,this._videoElementComputedStyle=null,this._videoElementKeyboard=null,this._lastTouchEventTimestamp=0,this._requestCounter=0,e.addEventListener("close",()=>{this._rtcDataChannel===e&&this.close()}),e.addEventListener("error",t=>{if(this._rtcDataChannel===e){const e=t.error;this.dispatchEvent(new ErrorEvent("error",{message:e&&e.message||"Remote controller error",error:e||new Error("unknown error on the remote controller data channel")}))}}),e.addEventListener("message",e=>{try{const t=JSON.parse(e.data);"ControlResponseMessage"===t.type?this.dispatchEvent(new CustomEvent("controlResponse",{detail:t})):"InfoMessage"===t.type&&this.dispatchEvent(new CustomEvent("info",{detail:t}))}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot parse control message from signaling server",error:e}))}})}get rtcDataChannel(){return this._rtcDataChannel}get consumerSession(){return this._consumerSession}get videoElement(){return this._videoElement}attachVideoElement(e){if(e instanceof HTMLVideoElement&&e!==this._videoElement){this._videoElement&&this.attachVideoElement(null),this._videoElement=e,this._videoElementComputedStyle=window.getComputedStyle(e);for(const t of _e)e.addEventListener(t,this);e.setAttribute("tabindex","0")}else if(null===e&&this._videoElement){const e=this._videoElement;e.removeAttribute("tabindex"),this._videoElement=null,this._videoElementComputedStyle=null,this._lastTouchEventTimestamp=0;for(const t of _e)e.removeEventListener(t,this)}}sendControlRequest(e){try{if(!e||"object"!=typeof e&&"string"!=typeof e)throw new Error("invalid request");if(!this._rtcDataChannel)throw new Error("remote controller data channel is closed");let t={id:this._requestCounter++,request:e};return this._rtcDataChannel.send(JSON.stringify(t)),t.id}catch(e){return this.dispatchEvent(new ErrorEvent("error",{message:`cannot send control message over session ${this._consumerSession.sessionId} remote controller`,error:e})),-1}}close(){this.attachVideoElement(null);const e=this._rtcDataChannel;this._rtcDataChannel=null,e&&(e.close(),this.dispatchEvent(new Event("closed")))}_sendGstNavigationEvent(e){let t={type:"navigationEvent",event:e};this.sendControlRequest(t)}_computeVideoMousePosition(e){const t={x:0,y:0};if(!this._videoElement||this._videoElement.videoWidth<=0||this._videoElement.videoHeight<=0)return t;const n=parseFloat(this._videoElementComputedStyle.paddingLeft),r=parseFloat(this._videoElementComputedStyle.paddingRight),i=parseFloat(this._videoElementComputedStyle.paddingTop),o=parseFloat(this._videoElementComputedStyle.paddingBottom);if("offsetX"in e&&"offsetY"in e)t.x=e.offsetX-n,t.y=e.offsetY-i;else{const r=this._videoElement.getBoundingClientRect(),o={left:parseFloat(this._videoElementComputedStyle.borderLeftWidth),top:parseFloat(this._videoElementComputedStyle.borderTopWidth)};t.x=e.clientX-r.left-o.left-n,t.y=e.clientY-r.top-o.top-i}const s={x:this._videoElement.clientWidth-(n+r),y:this._videoElement.clientHeight-(i+o)},a=Math.min(s.x/this._videoElement.videoWidth,s.y/this._videoElement.videoHeight);s.x=Math.max(.5*(s.x-this._videoElement.videoWidth*a),0),s.y=Math.max(.5*(s.y-this._videoElement.videoHeight*a),0);const c=0!==a?1/a:0;return t.x=(t.x-s.x)*c,t.y=(t.y-s.y)*c,t.x=Math.min(Math.max(t.x,0),this._videoElement.videoWidth),t.y=Math.min(Math.max(t.y,0),this._videoElement.videoHeight),t}handleEvent(e){if(this._videoElement)switch(e.type){case"wheel":e.preventDefault();{const t=this._computeVideoMousePosition(e);this._sendGstNavigationEvent({event:"MouseScroll",x:t.x,y:t.y,delta_x:-e.deltaX,delta_y:-e.deltaY,modifier_state:ye(e)})}break;case"contextmenu":e.preventDefault();break;case"mousemove":case"mousedown":case"mouseup":e.preventDefault();{const t=this._computeVideoMousePosition(e),n={event:fe[e.type],x:t.x,y:t.y,modifier_state:ye(e)};"mousemove"!==e.type&&(n.button=e.button+1,"mousedown"===e.type&&0===e.button&&this._videoElement.focus()),this._sendGstNavigationEvent(n)}break;case"touchstart":case"touchend":case"touchmove":case"touchcancel":for(const t of e.changedTouches){const n=this._computeVideoMousePosition(t),r={event:ge[e.type],identifier:t.identifier,x:n.x,y:n.y,modifier_state:ye(e)};!("force"in t)||"touchstart"!==e.type&&"touchmove"!==e.type||(r.pressure=t.force),this._sendGstNavigationEvent(r)}e.timeStamp>this._lastTouchEventTimestamp&&(this._lastTouchEventTimestamp=e.timeStamp,this._sendGstNavigationEvent({event:"TouchFrame",modifier_state:ye(e)}));break;case"keyup":case"keydown":e.preventDefault();{const t={event:Ce[e.type],key:me(e.key,e.code),modifier_state:ye(e)};this._sendGstNavigationEvent(t)}}}}const be=ve;const Se=class extends le{constructor(e,t,n){super(e,t),this._streams=[],this._remoteController=null,this._pendingCandidates=[],this._mungeStereoHack=!1,this._offerOptions=n,this.addEventListener("closed",()=>{this._streams=[],this._pendingCandidates=[],this._remoteController&&this._remoteController.close()})}set mungeStereoHack(e){"boolean"==typeof e&&(this._mungeStereoHack=e)}get streams(){return this._streams}get remoteController(){return this._remoteController}connect(){if(!this._comChannel||this._state===ce.closed)return!1;if(this._state!==ce.idle)return!0;if(this._offerOptions)this.ensurePeerConnection(),this._rtcPeerConnection.createDataChannel("control"),this._rtcPeerConnection.createOffer(this._offerOptions).then(e=>{if(this._rtcPeerConnection&&e)return this._rtcPeerConnection.setLocalDescription(e);throw new Error("cannot send local offer to WebRTC peer")}).then(()=>{if(this._rtcPeerConnection&&this._comChannel){const e={type:"startSession",peerId:this._peerId,offer:this._rtcPeerConnection.localDescription.toJSON().sdp};if(!this._comChannel.send(e))throw new Error("cannot send startSession message to signaling server");this._state=ce.connecting,this.dispatchEvent(new Event("stateChanged"))}}).catch(e=>{this._state!==ce.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())});else{const e={type:"startSession",peerId:this._peerId};if(!this._comChannel.send(e))return this.dispatchEvent(new ErrorEvent("error",{message:"cannot connect consumer session",error:new Error("cannot send startSession message to signaling server")})),this.close(),!1;this._state=ce.connecting,this.dispatchEvent(new Event("stateChanged"))}return!0}onSessionStarted(e,t){if(this._peerId===e&&this._state===ce.connecting&&!this._sessionId){console.log("Session started",this._sessionId),this._sessionId=t;for(const e of this._pendingCandidates)console.log("Sending delayed ICE with session id",this._sessionId),this._comChannel.send({type:"peer",sessionId:this._sessionId,ice:e.toJSON()});this._pendingCandidates=[]}}ensurePeerConnection(){if(!this._rtcPeerConnection){const e=new RTCPeerConnection(this._comChannel.webrtcConfig);this._rtcPeerConnection=e,e.ontrack=t=>{if(this._rtcPeerConnection===e&&t.streams&&t.streams.length>0){this._state===ce.connecting&&(this._state=ce.streaming,this.dispatchEvent(new Event("stateChanged")));let e=!1;for(const n of t.streams)this._streams.includes(n)||(this._streams.push(n),e=!0);e&&this.dispatchEvent(new Event("streamsChanged"))}},e.ondatachannel=e=>{const t=e.channel;if(t&&"control"===t.label){if(this._remoteController){const e=this._remoteController;this._remoteController=null,e.close()}const e=new be(t,this);this._remoteController=e,this.dispatchEvent(new Event("remoteControllerChanged")),e.addEventListener("closed",()=>{this._remoteController===e&&(this._remoteController=null,this.dispatchEvent(new Event("remoteControllerChanged")))})}},e.onicecandidate=t=>{this._rtcPeerConnection===e&&t.candidate&&this._comChannel&&(this._sessionId?(console.log("Sending ICE with session id",this._sessionId),this._comChannel.send({type:"peer",sessionId:this._sessionId,ice:t.candidate.toJSON()})):this._pendingCandidates.push(t.candidate))},this.dispatchEvent(new Event("rtcPeerConnectionChanged"))}}mungeStereo(e,t){const n=/a=fmtp:.* sprop-stereo/g;let r=new Set;for(const t of e.matchAll(n)){const e=t[0].match(/a=fmtp:(\d+) .*/);e&&r.add(e[1])}for(const e of r){const n=new RegExp("a=fmtp:"+e+".*stereo");t.match(n)||(t=t.replaceAll("a=fmtp:"+e,"a=fmtp:"+e+" stereo=1;"))}return t}onSessionPeerMessage(e){if(this._state!==ce.closed&&this._comChannel&&this._sessionId)if(this.ensurePeerConnection(),e.sdp)this._offerOptions?this._rtcPeerConnection.setRemoteDescription(e.sdp).then(()=>{console.log("done")}).catch(e=>{this._state!==ce.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())}):this._rtcPeerConnection.setRemoteDescription(e.sdp).then(()=>this._rtcPeerConnection?this._rtcPeerConnection.createAnswer():null).then(t=>this._rtcPeerConnection&&t?(this._mungeStereoHack&&(t.sdp=this.mungeStereo(e.sdp.sdp,t.sdp)),this._rtcPeerConnection.setLocalDescription(t)):null).then(()=>{if(this._rtcPeerConnection&&this._comChannel){console.log("Sending SDP with session id",this._sessionId);const e={type:"peer",sessionId:this._sessionId,sdp:this._rtcPeerConnection.localDescription.toJSON()};if(!this._comChannel.send(e))throw new Error("cannot send local SDP configuration to WebRTC peer")}}).catch(e=>{this._state!==ce.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())});else{if(!e.ice)throw new Error(`invalid empty peer message received from consumer session ${this._sessionId}`);{const t=e.ice.candidate?new RTCIceCandidate(e.ice):null;this._rtcPeerConnection.addIceCandidate(t).catch(e=>{this._state!==ce.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during ICE handshake",error:e})),this.close())})}}}};class ke extends le{constructor(e,t,n,r){super(e,n),this._sessionId=t,this._state=ce.streaming;const i=new RTCPeerConnection(this._comChannel.webrtcConfig);this._rtcPeerConnection=i;for(const e of r.getTracks())i.addTrack(e,r);i.onicecandidate=e=>{this._rtcPeerConnection===i&&e.candidate&&this._comChannel&&this._comChannel.send({type:"peer",sessionId:this._sessionId,ice:e.candidate.toJSON()})},this.dispatchEvent(new Event("rtcPeerConnectionChanged")),i.setLocalDescription().then(()=>{if(this._rtcPeerConnection===i&&this._comChannel){const e={type:"peer",sessionId:this._sessionId,sdp:this._rtcPeerConnection.localDescription.toJSON()};if(!this._comChannel.send(e))throw new Error("cannot send local SDP configuration to WebRTC peer")}}).catch(e=>{this._state!==ce.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())})}onSessionPeerMessage(e){if(this._state!==ce.closed&&this._rtcPeerConnection)if(e.sdp)this._rtcPeerConnection.setRemoteDescription(e.sdp).catch(e=>{this._state!==ce.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())});else{if(!e.ice)throw new Error(`invalid empty peer message received from producer's client session ${this._peerId}`);{const t=new RTCIceCandidate(e.ice);this._rtcPeerConnection.addIceCandidate(t).catch(e=>{this._state!==ce.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during ICE handshake",error:e})),this.close())})}}}}class Te extends EventTarget{constructor(e,t,n){super(),this._comChannel=e,this._stream=t,this._state=ce.idle,this._clientSessions={},this._consumerId=n}get stream(){return this._stream}get state(){return this._state}start(){if(!this._comChannel||this._state===ce.closed)return!1;if(this._state!==ce.idle)return!0;const e={type:"setPeerStatus",roles:["listener","producer"],meta:this._comChannel.meta};return this._comChannel.send(e)?(this._state=ce.connecting,this.dispatchEvent(new Event("stateChanged")),!0):(this.dispatchEvent(new ErrorEvent("error",{message:"cannot start producer session",error:new Error("cannot register producer to signaling server")})),this.close(),!1)}close(){if(this._state!==ce.closed){for(const e of this._stream.getTracks())e.stop();this._state!==ce.idle&&this._comChannel&&this._comChannel.send({type:"setPeerStatus",roles:["listener"],meta:this._comChannel.meta}),this._state=ce.closed,this.dispatchEvent(new Event("stateChanged")),this._comChannel=null,this._stream=null;for(const e of Object.values(this._clientSessions))e.close();this._clientSessions={},this.dispatchEvent(new Event("closed"))}}onProducerRegistered(){if(this._state===ce.connecting&&(this._state=ce.streaming,this.dispatchEvent(new Event("stateChanged"))),this._consumerId){const e={type:"startSession",peerId:this._consumerId};this._comChannel.send(e)||(this.dispatchEvent(new ErrorEvent("error",{message:"cannot send session request to specified consumer",error:new Error("cannot send startSession message to signaling server")})),this.close())}}onStartSessionMessage(e){if(this._comChannel&&this._stream&&!(e.sessionId in this._clientSessions)){const t=new ke(e.peerId,e.sessionId,this._comChannel,this._stream);this._clientSessions[e.sessionId]=t,t.addEventListener("closed",e=>{const n=e.target.sessionId;n in this._clientSessions&&this._clientSessions[n]===t&&(delete this._clientSessions[n],this.dispatchEvent(new CustomEvent("clientConsumerRemoved",{detail:t})))}),t.addEventListener("error",e=>{this.dispatchEvent(new ErrorEvent("error",{message:`error from client consumer ${e.target.peerId}: ${e.message}`,error:e.error}))}),this.dispatchEvent(new CustomEvent("clientConsumerAdded",{detail:t}))}}onEndSessionMessage(e){e.sessionId in this._clientSessions&&this._clientSessions[e.sessionId].close()}onSessionPeerMessage(e){e.sessionId in this._clientSessions&&this._clientSessions[e.sessionId].onSessionPeerMessage(e)}}const Ee=Te,Pe=Object.freeze({welcome:"welcome",peerStatusChanged:"peerStatusChanged",list:"list",listConsumers:"listConsumers",sessionStarted:"sessionStarted",peer:"peer",startSession:"startSession",endSession:"endSession",error:"error"});function Re(e,t){if(!e||"object"!=typeof e)return null;const n={id:"",meta:{}};if(e.id&&"string"==typeof e.id)n.id=e.id;else{if(!e.peerId||"string"!=typeof e.peerId)return null;n.id=e.peerId}return n.id===t?null:(e.meta&&"object"==typeof e.meta&&(n.meta=e.meta),Object.freeze(n.meta),Object.freeze(n))}class we extends EventTarget{constructor(e,t,n){super(),this._meta=t,this._webrtcConfig=n,this._ws=new WebSocket(e),this._ready=!1,this._channelId="",this._producerSession=null,this._consumerSessions={},this._peers={},this._ws.onerror=e=>{this.dispatchEvent(new ErrorEvent("error",{message:e.message||"WebSocket error",error:e.error||new Error(this._ready?"transportation error":"cannot connect to signaling server")})),this.close()},this._ws.onclose=()=>{this._ready=!1,this._channelId="",this._ws=null,this.closeAllConsumerSessions(),this._producerSession&&(this._producerSession.close(),this._producerSession=null),this.dispatchEvent(new Event("closed"))},this._ws.onmessage=e=>{try{const n=JSON.parse(e.data);if(n&&"object"==typeof n)switch(n.type){case Pe.welcome:this._channelId=n.peerId;try{this._ws.send(JSON.stringify({type:"setPeerStatus",roles:["listener"],meta:t}))}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot initialize connection to signaling server",error:e})),this.close()}break;case Pe.peerStatusChanged:{if(n.peerId===this._channelId){!this._ready&&n.roles.includes("listener")&&(this._ready=!0,this.dispatchEvent(new Event("ready")),this.send({type:"list"}),this.send({type:"listConsumers"})),this._producerSession&&n.roles.includes("producer")&&this._producerSession.onProducerRegistered();break}const e=Re(n,this._channelId);if(!e)break;const t=this._peers[n.peerId]||[];this._peers[n.peerId]=n.roles;for(const r of["producer","consumer"])!t.includes(r)&&n.roles.includes(r)?this.dispatchEvent(new CustomEvent("peerAdded",{detail:{peer:e,role:r}})):t.includes(r)&&!n.roles.includes(r)&&this.dispatchEvent(new CustomEvent("peerRemoved",{detail:{peerId:n.peerId,role:r}}));break}case Pe.list:this.clearPeers("producer"),this.addPeers(n.producers,"producer");break;case Pe.listConsumers:this.clearPeers("consumer"),this.addPeers(n.consumers,"consumer");break;case Pe.sessionStarted:{const e=this.getConsumerSession(n.peerId);e&&(delete this._consumerSessions[n.peerId],e.onSessionStarted(n.peerId,n.sessionId),e.sessionId&&!(e.sessionId in this._consumerSessions)?this._consumerSessions[e.sessionId]=e:e.close())}break;case Pe.peer:{const e=this.getConsumerSession(n.sessionId);e?e.onSessionPeerMessage(n):this._producerSession&&this._producerSession.onSessionPeerMessage(n)}break;case Pe.startSession:this._producerSession&&this._producerSession.onStartSessionMessage(n);break;case Pe.endSession:{const e=this.getConsumerSession(n.sessionId);e?e.close():this._producerSession&&this._producerSession.onEndSessionMessage(n)}break;case Pe.error:this.dispatchEvent(new ErrorEvent("error",{message:"error received from signaling server",error:new Error(n.details)}));break;default:throw new Error(`unknown message type: "${n.type}"`)}}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot parse incoming message from signaling server",error:e}))}}}get meta(){return this._meta}get webrtcConfig(){return this._webrtcConfig}get ready(){return this._ready}get channelId(){return this._channelId}get producerSession(){return this._producerSession}createProducerSession(e,t){if(!(this._ready&&e instanceof MediaStream))return null;if(this._producerSession)return this._producerSession.stream===e?this._producerSession:null;const n=new Ee(this,e,t);return this._producerSession=n,n.addEventListener("closed",()=>{this._producerSession===n&&(this._producerSession=null)}),n}createConsumerSession(e,t){if(!this._ready||!e||"string"!=typeof e)return null;if(t&&"object"!=typeof t&&(t=void 0),e in this._consumerSessions)return this._consumerSessions[e];for(const t of Object.values(this._consumerSessions))if(t.peerId===e)return t;const n=new Se(e,this,t);return this._consumerSessions[e]=n,n.addEventListener("closed",e=>{let t=e.target.sessionId;t||(t=e.target.peerId),t in this._consumerSessions&&this._consumerSessions[t]===n&&delete this._consumerSessions[t]}),n}getConsumerSession(e){return e in this._consumerSessions?this._consumerSessions[e]:null}closeAllConsumerSessions(){for(const e of Object.values(this._consumerSessions))e.close();this._consumerSessions={}}send(e){if(this._ready&&e&&"object"==typeof e)try{return this._ws.send(JSON.stringify(e)),!0}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot send message to signaling server",error:e}))}return!1}close(){this._ws&&(this._ready=!1,this._channelId="",this._ws.close(),this.closeAllConsumerSessions(),this._producerSession&&(this._producerSession.close(),this._producerSession=null))}clearPeers(e){for(const t in this._peers)this._peers[t].includes(e)&&(delete this._peers[t],this.dispatchEvent(new CustomEvent("peerRemoved",{detail:{peerId:t,role:e}})))}addPeers(e,t){e.forEach(e=>{const n=Re(e,this._channelId);n&&(this._peers[n.id]=[t],this.dispatchEvent(new CustomEvent("peerAdded",{detail:{peer:n,role:t}})))})}}const Ae=we;class Ie{constructor(e){this._channel=null,this._producers={},this._consumers={},this._connectionListeners=[],this._peerListeners=[];const t=Object.assign({},se);e&&"object"==typeof e&&Object.assign(t,e),"object"!=typeof t.meta&&(t.meta=null),this._config=t,this.connectChannel()}registerConnectionListener(e){return!(!e||"object"!=typeof e||"function"!=typeof e.connected||"function"!=typeof e.disconnected)&&(this._connectionListeners.includes(e)||this._connectionListeners.push(e),!0)}unregisterConnectionListener(e){const t=this._connectionListeners.indexOf(e);return t>=0&&(this._connectionListeners.splice(t,1),!0)}unregisterAllConnectionListeners(){this._connectionListeners=[]}createProducerSession(e){return this._channel?this._channel.createProducerSession(e):null}createProducerSessionForConsumer(e,t){return this._channel?this._channel.createProducerSession(e,t):null}getAvailableProducers(){return Object.values(this._producers)}getAvailableConsumers(){return Object.values(this._consumers)}registerPeerListener(e){return!(!e||"object"!=typeof e||"function"!=typeof e.producerAdded&&"function"!=typeof e.producerRemoved&&"function"!=typeof e.consumerAdded&&"function"!=typeof e.consumerRemoved)&&(this._peerListeners.includes(e)||this._peerListeners.push(e),!0)}unregisterPeerListener(e){const t=this._peerListeners.indexOf(e);return t>=0&&(this._peerListeners.splice(t,1),!0)}unregisterAllPeerListeners(){this._peerListeners=[]}createConsumerSession(e){return this._channel?this._channel.createConsumerSession(e):null}createConsumerSessionWithOfferOptions(e,t){return this._channel?this._channel.createConsumerSession(e,t):null}connectChannel(){if(this._channel){const e=this._channel;this._channel=null,e.close();for(const e in this._producers)this.triggerProducerRemoved(e);for(const e in this._consumers)this.triggerConsumerRemoved(e);this._producers={},this._consumers={},this.triggerDisconnected()}this._channel=new Ae(this._config.signalingServerUrl,this._config.meta,this._config.webrtcConfig),this._channel.addEventListener("error",e=>{e.target===this._channel&&console.error(e.message,e.error)}),this._channel.addEventListener("closed",e=>{if(e.target===this._channel){this._channel=null;for(const e in this._producers)this.triggerProducerRemoved(e);for(const e in this._consumers)this.triggerConsumerRemoved(e);this._producers={},this._consumers={},this.triggerDisconnected(),this._config.reconnectionTimeout>0&&window.setTimeout(()=>{this.connectChannel()},this._config.reconnectionTimeout)}}),this._channel.addEventListener("ready",e=>{e.target===this._channel&&this.triggerConnected(this._channel.channelId)}),this._channel.addEventListener("peerAdded",e=>{e.target===this._channel&&("producer"===e.detail.role?this.triggerProducerAdded(e.detail.peer):this.triggerConsumerAdded(e.detail.peer))}),this._channel.addEventListener("peerRemoved",e=>{e.target===this._channel&&("producer"===e.detail.role?this.triggerProducerRemoved(e.detail.peerId):this.triggerConsumerRemoved(e.detail.peerId))})}triggerConnected(e){for(const t of this._connectionListeners)try{t.connected(e)}catch(e){console.error("a listener callback should not throw any exception",e)}}triggerDisconnected(){for(const e of this._connectionListeners)try{e.disconnected()}catch(e){console.error("a listener callback should not throw any exception",e)}}triggerProducerAdded(e){if(!(e.id in this._producers)){this._producers[e.id]=e;for(const t of this._peerListeners)if(t.producerAdded)try{t.producerAdded(e)}catch(e){console.error("a listener callback should not throw any exception",e)}}}triggerProducerRemoved(e){if(!(e in this._producers))return;const t=this._producers[e];delete this._producers[e];for(const e of this._peerListeners)if(e.producerRemoved)try{e.producerRemoved(t)}catch(e){console.error("a listener callback should not throw any exception",e)}}triggerConsumerAdded(e){if(!(e.id in this._consumers)){this._consumers[e.id]=e;for(const t of this._peerListeners)if(t.consumerAdded)try{t.consumerAdded(e)}catch(e){console.error("a listener callback should not throw any exception",e)}}}triggerConsumerRemoved(e){if(!(e in this._consumers))return;const t=this._consumers[e];delete this._consumers[e];for(const e of this._peerListeners)if(e.consumerRemoved)try{e.consumerRemoved(t)}catch(e){console.error("a listener callback should not throw any exception",e)}}}Ie.SessionState=ce;const xe=Ie;window.GstWebRTCAPI||(window.GstWebRTCAPI=xe)})()})();
+//# sourceMappingURL=gstwebrtc-api-3.0.0.min.js.map
\ No newline at end of file
diff --git a/web/javascript/webrtc/gstwebrtc-api-3.0.0.min.js.map b/web/javascript/webrtc/gstwebrtc-api-3.0.0.min.js.map
new file mode 100644
index 0000000..46726d2
--- /dev/null
+++ b/web/javascript/webrtc/gstwebrtc-api-3.0.0.min.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"gstwebrtc-api-3.0.0.min.js","mappings":";;;kCAIA,MAAMA,EAAW,CAIjBA,mBAA8B,WAC5B,OAAOC,KAAKC,SAASC,SAAS,IAAIC,UAAU,EAAG,GACjD,GAGAJ,EAASK,WAAaL,EAASM,qBAG/BN,EAASO,WAAa,SAASC,GAC7B,OAAOA,EAAKC,OAAOC,MAAM,MAAMC,IAAIC,GAAQA,EAAKH,OAClD,EAEAT,EAASa,cAAgB,SAASL,GAEhC,OADcA,EAAKE,MAAM,QACZC,IAAI,CAACG,EAAMC,KAAWA,EAAQ,EACzC,KAAOD,EAAOA,GAAML,OAAS,OACjC,EAGAT,EAASgB,eAAiB,SAASR,GACjC,MAAMS,EA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runtime/compat get default export","webpack://gstwebrtc-api/webpack/runtime/define property getters","webpack://gstwebrtc-api/webpack/runtime/hasOwnProperty shorthand","webpack://gstwebrtc-api/webpack/runtime/make namespace object","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/utils.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/chrome/getusermedia.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/chrome/getdisplaymedia.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/chrome/chrome_shim.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/firefox/getusermedia.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/firefox/getdisplaymedia.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/firefox/firefox_shim.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/safari/safari_shim.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/common_shim.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/adapter_factory.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/adapter_core.js","webpack://gstwebrtc-api/./src/config.js","webpack://gstwebrtc-api/./src/session-state.js","webpack://gstwebrtc-api/./src/webrtc-session.js","webpack://gstwebrtc-api/./src/keysyms.js","webpack://gstwebrtc-api/./src/remote-controller.js","webpack://gstwebrtc-api/./src/consumer-session.js","webpack://gstwebrtc-api/./src/producer-session.js","webpack://gstwebrtc-api/./src/com-channel.js","webpack://gstwebrtc-api/./src/gstwebrtc-api.js","webpack://gstwebrtc-api/./src/index.js"],"sourcesContent":["/* eslint-env node */\n'use strict';\n\n// SDP helpers.\nconst SDPUtils = {};\n\n// Generate an alphanumeric identifier for cname or mids.\n// TODO: use UUIDs instead? https://gist.github.com/jed/982883\nSDPUtils.generateIdentifier = function() {\n return Math.random().toString(36).substring(2, 12);\n};\n\n// The RTCP CNAME used by all peerconnections from the same JS.\nSDPUtils.localCName = SDPUtils.generateIdentifier();\n\n// Splits SDP into lines, dealing with both CRLF and LF.\nSDPUtils.splitLines = function(blob) {\n return blob.trim().split('\\n').map(line => line.trim());\n};\n// Splits SDP into sessionpart and mediasections. Ensures CRLF.\nSDPUtils.splitSections = function(blob) {\n const parts = blob.split('\\nm=');\n return parts.map((part, index) => (index > 0 ?\n 'm=' + part : part).trim() + '\\r\\n');\n};\n\n// Returns the session description.\nSDPUtils.getDescription = function(blob) {\n const sections = SDPUtils.splitSections(blob);\n return sections && sections[0];\n};\n\n// Returns the individual media sections.\nSDPUtils.getMediaSections = function(blob) {\n const sections = SDPUtils.splitSections(blob);\n sections.shift();\n return sections;\n};\n\n// Returns lines that start with a certain prefix.\nSDPUtils.matchPrefix = function(blob, prefix) {\n return SDPUtils.splitLines(blob).filter(line => line.indexOf(prefix) === 0);\n};\n\n// Parses an ICE candidate line. Sample input:\n// candidate:702786350 2 udp 41819902 8.8.8.8 60769 typ relay raddr 8.8.8.8\n// rport 55996\"\n// Input can be prefixed with a=.\nSDPUtils.parseCandidate = function(line) {\n let parts;\n // Parse both variants.\n if (line.indexOf('a=candidate:') === 0) {\n parts = line.substring(12).split(' ');\n } else {\n parts = line.substring(10).split(' ');\n }\n\n const candidate = {\n foundation: parts[0],\n component: {1: 'rtp', 2: 'rtcp'}[parts[1]] || parts[1],\n protocol: parts[2].toLowerCase(),\n priority: parseInt(parts[3], 10),\n ip: parts[4],\n address: parts[4], // address is an alias for ip.\n port: parseInt(parts[5], 10),\n // skip parts[6] == 'typ'\n type: parts[7],\n };\n\n for (let i = 8; i < parts.length; i += 2) {\n switch (parts[i]) {\n case 'raddr':\n candidate.relatedAddress = parts[i + 1];\n break;\n case 'rport':\n candidate.relatedPort = parseInt(parts[i + 1], 10);\n break;\n case 'tcptype':\n candidate.tcpType = parts[i + 1];\n break;\n case 'ufrag':\n candidate.ufrag = parts[i + 1]; // for backward compatibility.\n candidate.usernameFragment = parts[i + 1];\n break;\n default: // extension handling, in particular ufrag. Don't overwrite.\n if (candidate[parts[i]] === undefined) {\n candidate[parts[i]] = parts[i + 1];\n }\n break;\n }\n }\n return candidate;\n};\n\n// Translates a candidate object into SDP candidate attribute.\n// This does not include the a= prefix!\nSDPUtils.writeCandidate = function(candidate) {\n const sdp = [];\n sdp.push(candidate.foundation);\n\n const component = candidate.component;\n if (component === 'rtp') {\n sdp.push(1);\n } else if (component === 'rtcp') {\n sdp.push(2);\n } else {\n sdp.push(component);\n }\n sdp.push(candidate.protocol.toUpperCase());\n sdp.push(candidate.priority);\n sdp.push(candidate.address || candidate.ip);\n sdp.push(candidate.port);\n\n const type = candidate.type;\n sdp.push('typ');\n sdp.push(type);\n if (type !== 'host' && candidate.relatedAddress &&\n candidate.relatedPort) {\n sdp.push('raddr');\n sdp.push(candidate.relatedAddress);\n sdp.push('rport');\n sdp.push(candidate.relatedPort);\n }\n if (candidate.tcpType && candidate.protocol.toLowerCase() === 'tcp') {\n sdp.push('tcptype');\n sdp.push(candidate.tcpType);\n }\n if (candidate.usernameFragment || candidate.ufrag) {\n sdp.push('ufrag');\n sdp.push(candidate.usernameFragment || candidate.ufrag);\n }\n return 'candidate:' + sdp.join(' ');\n};\n\n// Parses an ice-options line, returns an array of option tags.\n// Sample input:\n// a=ice-options:foo bar\nSDPUtils.parseIceOptions = function(line) {\n return line.substring(14).split(' ');\n};\n\n// Parses a rtpmap line, returns RTCRtpCoddecParameters. Sample input:\n// a=rtpmap:111 opus/48000/2\nSDPUtils.parseRtpMap = function(line) {\n let parts = line.substring(9).split(' ');\n const parsed = {\n payloadType: parseInt(parts.shift(), 10), // was: id\n };\n\n parts = parts[0].split('/');\n\n parsed.name = parts[0];\n parsed.clockRate = parseInt(parts[1], 10); // was: clockrate\n parsed.channels = parts.length === 3 ? parseInt(parts[2], 10) : 1;\n // legacy alias, got renamed back to channels in ORTC.\n parsed.numChannels = parsed.channels;\n return parsed;\n};\n\n// Generates a rtpmap line from RTCRtpCodecCapability or\n// RTCRtpCodecParameters.\nSDPUtils.writeRtpMap = function(codec) {\n let pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n const channels = codec.channels || codec.numChannels || 1;\n return 'a=rtpmap:' + pt + ' ' + codec.name + '/' + codec.clockRate +\n (channels !== 1 ? '/' + channels : '') + '\\r\\n';\n};\n\n// Parses a extmap line (headerextension from RFC 5285). Sample input:\n// a=extmap:2 urn:ietf:params:rtp-hdrext:toffset\n// a=extmap:2/sendonly urn:ietf:params:rtp-hdrext:toffset\nSDPUtils.parseExtmap = function(line) {\n const parts = line.substring(9).split(' ');\n return {\n id: parseInt(parts[0], 10),\n direction: parts[0].indexOf('/') > 0 ? parts[0].split('/')[1] : 'sendrecv',\n uri: parts[1],\n attributes: parts.slice(2).join(' '),\n };\n};\n\n// Generates an extmap line from RTCRtpHeaderExtensionParameters or\n// RTCRtpHeaderExtension.\nSDPUtils.writeExtmap = function(headerExtension) {\n return 'a=extmap:' + (headerExtension.id || headerExtension.preferredId) +\n (headerExtension.direction && headerExtension.direction !== 'sendrecv'\n ? '/' + headerExtension.direction\n : '') +\n ' ' + headerExtension.uri +\n (headerExtension.attributes ? ' ' + headerExtension.attributes : '') +\n '\\r\\n';\n};\n\n// Parses a fmtp line, returns dictionary. Sample input:\n// a=fmtp:96 vbr=on;cng=on\n// Also deals with vbr=on; cng=on\n// Non-key-value such as telephone-events `0-15` get parsed as\n// {`0-15`:undefined}\nSDPUtils.parseFmtp = function(line) {\n const parsed = {};\n let kv;\n const parts = line.substring(line.indexOf(' ') + 1).split(';');\n for (let j = 0; j < parts.length; j++) {\n kv = parts[j].trim().split('=');\n parsed[kv[0].trim()] = kv[1];\n }\n return parsed;\n};\n\n// Generates a fmtp line from RTCRtpCodecCapability or RTCRtpCodecParameters.\nSDPUtils.writeFmtp = function(codec) {\n let line = '';\n let pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n if (codec.parameters && Object.keys(codec.parameters).length) {\n const params = [];\n Object.keys(codec.parameters).forEach(param => {\n if (codec.parameters[param] !== undefined) {\n params.push(param + '=' + codec.parameters[param]);\n } else {\n params.push(param);\n }\n });\n line += 'a=fmtp:' + pt + ' ' + params.join(';') + '\\r\\n';\n }\n return line;\n};\n\n// Parses a rtcp-fb line, returns RTCPRtcpFeedback object. Sample input:\n// a=rtcp-fb:98 nack rpsi\nSDPUtils.parseRtcpFb = function(line) {\n const parts = line.substring(line.indexOf(' ') + 1).split(' ');\n return {\n type: parts.shift(),\n parameter: parts.join(' '),\n };\n};\n\n// Generate a=rtcp-fb lines from RTCRtpCodecCapability or RTCRtpCodecParameters.\nSDPUtils.writeRtcpFb = function(codec) {\n let lines = '';\n let pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n if (codec.rtcpFeedback && codec.rtcpFeedback.length) {\n // FIXME: special handling for trr-int?\n codec.rtcpFeedback.forEach(fb => {\n lines += 'a=rtcp-fb:' + pt + ' ' + fb.type +\n (fb.parameter && fb.parameter.length ? ' ' + fb.parameter : '') +\n '\\r\\n';\n });\n }\n return lines;\n};\n\n// Parses a RFC 5576 ssrc media attribute. Sample input:\n// a=ssrc:3735928559 cname:something\nSDPUtils.parseSsrcMedia = function(line) {\n const sp = line.indexOf(' ');\n const parts = {\n ssrc: parseInt(line.substring(7, sp), 10),\n };\n const colon = line.indexOf(':', sp);\n if (colon > -1) {\n parts.attribute = line.substring(sp + 1, colon);\n parts.value = line.substring(colon + 1);\n } else {\n parts.attribute = line.substring(sp + 1);\n }\n return parts;\n};\n\n// Parse a ssrc-group line (see RFC 5576). Sample input:\n// a=ssrc-group:semantics 12 34\nSDPUtils.parseSsrcGroup = function(line) {\n const parts = line.substring(13).split(' ');\n return {\n semantics: parts.shift(),\n ssrcs: parts.map(ssrc => parseInt(ssrc, 10)),\n };\n};\n\n// Extracts the MID (RFC 5888) from a media section.\n// Returns the MID or undefined if no mid line was found.\nSDPUtils.getMid = function(mediaSection) {\n const mid = SDPUtils.matchPrefix(mediaSection, 'a=mid:')[0];\n if (mid) {\n return mid.substring(6);\n }\n};\n\n// Parses a fingerprint line for DTLS-SRTP.\nSDPUtils.parseFingerprint = function(line) {\n const parts = line.substring(14).split(' ');\n return {\n algorithm: parts[0].toLowerCase(), // algorithm is case-sensitive in Edge.\n value: parts[1].toUpperCase(), // the definition is upper-case in RFC 4572.\n };\n};\n\n// Extracts DTLS parameters from SDP media section or sessionpart.\n// FIXME: for consistency with other functions this should only\n// get the fingerprint line as input. See also getIceParameters.\nSDPUtils.getDtlsParameters = function(mediaSection, sessionpart) {\n const lines = SDPUtils.matchPrefix(mediaSection + sessionpart,\n 'a=fingerprint:');\n // Note: a=setup line is ignored since we use the 'auto' role in Edge.\n return {\n role: 'auto',\n fingerprints: lines.map(SDPUtils.parseFingerprint),\n };\n};\n\n// Serializes DTLS parameters to SDP.\nSDPUtils.writeDtlsParameters = function(params, setupType) {\n let sdp = 'a=setup:' + setupType + '\\r\\n';\n params.fingerprints.forEach(fp => {\n sdp += 'a=fingerprint:' + fp.algorithm + ' ' + fp.value + '\\r\\n';\n });\n return sdp;\n};\n\n// Parses a=crypto lines into\n// https://rawgit.com/aboba/edgertc/master/msortc-rs4.html#dictionary-rtcsrtpsdesparameters-members\nSDPUtils.parseCryptoLine = function(line) {\n const parts = line.substring(9).split(' ');\n return {\n tag: parseInt(parts[0], 10),\n cryptoSuite: parts[1],\n keyParams: parts[2],\n sessionParams: parts.slice(3),\n };\n};\n\nSDPUtils.writeCryptoLine = function(parameters) {\n return 'a=crypto:' + parameters.tag + ' ' +\n parameters.cryptoSuite + ' ' +\n (typeof parameters.keyParams === 'object'\n ? SDPUtils.writeCryptoKeyParams(parameters.keyParams)\n : parameters.keyParams) +\n (parameters.sessionParams ? ' ' + parameters.sessionParams.join(' ') : '') +\n '\\r\\n';\n};\n\n// Parses the crypto key parameters into\n// https://rawgit.com/aboba/edgertc/master/msortc-rs4.html#rtcsrtpkeyparam*\nSDPUtils.parseCryptoKeyParams = function(keyParams) {\n if (keyParams.indexOf('inline:') !== 0) {\n return null;\n }\n const parts = keyParams.substring(7).split('|');\n return {\n keyMethod: 'inline',\n keySalt: parts[0],\n lifeTime: parts[1],\n mkiValue: parts[2] ? parts[2].split(':')[0] : undefined,\n mkiLength: parts[2] ? parts[2].split(':')[1] : undefined,\n };\n};\n\nSDPUtils.writeCryptoKeyParams = function(keyParams) {\n return keyParams.keyMethod + ':'\n + keyParams.keySalt +\n (keyParams.lifeTime ? '|' + keyParams.lifeTime : '') +\n (keyParams.mkiValue && keyParams.mkiLength\n ? '|' + keyParams.mkiValue + ':' + keyParams.mkiLength\n : '');\n};\n\n// Extracts all SDES parameters.\nSDPUtils.getCryptoParameters = function(mediaSection, sessionpart) {\n const lines = SDPUtils.matchPrefix(mediaSection + sessionpart,\n 'a=crypto:');\n return lines.map(SDPUtils.parseCryptoLine);\n};\n\n// Parses ICE information from SDP media section or sessionpart.\n// FIXME: for consistency with other functions this should only\n// get the ice-ufrag and ice-pwd lines as input.\nSDPUtils.getIceParameters = function(mediaSection, sessionpart) {\n const ufrag = SDPUtils.matchPrefix(mediaSection + sessionpart,\n 'a=ice-ufrag:')[0];\n const pwd = SDPUtils.matchPrefix(mediaSection + sessionpart,\n 'a=ice-pwd:')[0];\n if (!(ufrag && pwd)) {\n return null;\n }\n return {\n usernameFragment: ufrag.substring(12),\n password: pwd.substring(10),\n };\n};\n\n// Serializes ICE parameters to SDP.\nSDPUtils.writeIceParameters = function(params) {\n let sdp = 'a=ice-ufrag:' + params.usernameFragment + '\\r\\n' +\n 'a=ice-pwd:' + params.password + '\\r\\n';\n if (params.iceLite) {\n sdp += 'a=ice-lite\\r\\n';\n }\n return sdp;\n};\n\n// Parses the SDP media section and returns RTCRtpParameters.\nSDPUtils.parseRtpParameters = function(mediaSection) {\n const description = {\n codecs: [],\n headerExtensions: [],\n fecMechanisms: [],\n rtcp: [],\n };\n const lines = SDPUtils.splitLines(mediaSection);\n const mline = lines[0].split(' ');\n description.profile = mline[2];\n for (let i = 3; i < mline.length; i++) { // find all codecs from mline[3..]\n const pt = mline[i];\n const rtpmapline = SDPUtils.matchPrefix(\n mediaSection, 'a=rtpmap:' + pt + ' ')[0];\n if (rtpmapline) {\n const codec = SDPUtils.parseRtpMap(rtpmapline);\n const fmtps = SDPUtils.matchPrefix(\n mediaSection, 'a=fmtp:' + pt + ' ');\n // Only the first a=fmtp: is considered.\n codec.parameters = fmtps.length ? SDPUtils.parseFmtp(fmtps[0]) : {};\n codec.rtcpFeedback = SDPUtils.matchPrefix(\n mediaSection, 'a=rtcp-fb:' + pt + ' ')\n .map(SDPUtils.parseRtcpFb);\n description.codecs.push(codec);\n // parse FEC mechanisms from rtpmap lines.\n switch (codec.name.toUpperCase()) {\n case 'RED':\n case 'ULPFEC':\n description.fecMechanisms.push(codec.name.toUpperCase());\n break;\n default: // only RED and ULPFEC are recognized as FEC mechanisms.\n break;\n }\n }\n }\n SDPUtils.matchPrefix(mediaSection, 'a=extmap:').forEach(line => {\n description.headerExtensions.push(SDPUtils.parseExtmap(line));\n });\n const wildcardRtcpFb = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-fb:* ')\n .map(SDPUtils.parseRtcpFb);\n description.codecs.forEach(codec => {\n wildcardRtcpFb.forEach(fb=> {\n const duplicate = codec.rtcpFeedback.find(existingFeedback => {\n return existingFeedback.type === fb.type &&\n existingFeedback.parameter === fb.parameter;\n });\n if (!duplicate) {\n codec.rtcpFeedback.push(fb);\n }\n });\n });\n // FIXME: parse rtcp.\n return description;\n};\n\n// Generates parts of the SDP media section describing the capabilities /\n// parameters.\nSDPUtils.writeRtpDescription = function(kind, caps) {\n let sdp = '';\n\n // Build the mline.\n sdp += 'm=' + kind + ' ';\n sdp += caps.codecs.length > 0 ? '9' : '0'; // reject if no codecs.\n sdp += ' ' + (caps.profile || 'UDP/TLS/RTP/SAVPF') + ' ';\n sdp += caps.codecs.map(codec => {\n if (codec.preferredPayloadType !== undefined) {\n return codec.preferredPayloadType;\n }\n return codec.payloadType;\n }).join(' ') + '\\r\\n';\n\n sdp += 'c=IN IP4 0.0.0.0\\r\\n';\n sdp += 'a=rtcp:9 IN IP4 0.0.0.0\\r\\n';\n\n // Add a=rtpmap lines for each codec. Also fmtp and rtcp-fb.\n caps.codecs.forEach(codec => {\n sdp += SDPUtils.writeRtpMap(codec);\n sdp += SDPUtils.writeFmtp(codec);\n sdp += SDPUtils.writeRtcpFb(codec);\n });\n let maxptime = 0;\n caps.codecs.forEach(codec => {\n if (codec.maxptime > maxptime) {\n maxptime = codec.maxptime;\n }\n });\n if (maxptime > 0) {\n sdp += 'a=maxptime:' + maxptime + '\\r\\n';\n }\n\n if (caps.headerExtensions) {\n caps.headerExtensions.forEach(extension => {\n sdp += SDPUtils.writeExtmap(extension);\n });\n }\n // FIXME: write fecMechanisms.\n return sdp;\n};\n\n// Parses the SDP media section and returns an array of\n// RTCRtpEncodingParameters.\nSDPUtils.parseRtpEncodingParameters = function(mediaSection) {\n const encodingParameters = [];\n const description = SDPUtils.parseRtpParameters(mediaSection);\n const hasRed = description.fecMechanisms.indexOf('RED') !== -1;\n const hasUlpfec = description.fecMechanisms.indexOf('ULPFEC') !== -1;\n\n // filter a=ssrc:... cname:, ignore PlanB-msid\n const ssrcs = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(line => SDPUtils.parseSsrcMedia(line))\n .filter(parts => parts.attribute === 'cname');\n const primarySsrc = ssrcs.length > 0 && ssrcs[0].ssrc;\n let secondarySsrc;\n\n const flows = SDPUtils.matchPrefix(mediaSection, 'a=ssrc-group:FID')\n .map(line => {\n const parts = line.substring(17).split(' ');\n return parts.map(part => parseInt(part, 10));\n });\n if (flows.length > 0 && flows[0].length > 1 && flows[0][0] === primarySsrc) {\n secondarySsrc = flows[0][1];\n }\n\n description.codecs.forEach(codec => {\n if (codec.name.toUpperCase() === 'RTX' && codec.parameters.apt) {\n let encParam = {\n ssrc: primarySsrc,\n codecPayloadType: parseInt(codec.parameters.apt, 10),\n };\n if (primarySsrc && secondarySsrc) {\n encParam.rtx = {ssrc: secondarySsrc};\n }\n encodingParameters.push(encParam);\n if (hasRed) {\n encParam = JSON.parse(JSON.stringify(encParam));\n encParam.fec = {\n ssrc: primarySsrc,\n mechanism: hasUlpfec ? 'red+ulpfec' : 'red',\n };\n encodingParameters.push(encParam);\n }\n }\n });\n if (encodingParameters.length === 0 && primarySsrc) {\n encodingParameters.push({\n ssrc: primarySsrc,\n });\n }\n\n // we support both b=AS and b=TIAS but interpret AS as TIAS.\n let bandwidth = SDPUtils.matchPrefix(mediaSection, 'b=');\n if (bandwidth.length) {\n if (bandwidth[0].indexOf('b=TIAS:') === 0) {\n bandwidth = parseInt(bandwidth[0].substring(7), 10);\n } else if (bandwidth[0].indexOf('b=AS:') === 0) {\n // use formula from JSEP to convert b=AS to TIAS value.\n bandwidth = parseInt(bandwidth[0].substring(5), 10) * 1000 * 0.95\n - (50 * 40 * 8);\n } else {\n bandwidth = undefined;\n }\n encodingParameters.forEach(params => {\n params.maxBitrate = bandwidth;\n });\n }\n return encodingParameters;\n};\n\n// parses http://draft.ortc.org/#rtcrtcpparameters*\nSDPUtils.parseRtcpParameters = function(mediaSection) {\n const rtcpParameters = {};\n\n // Gets the first SSRC. Note that with RTX there might be multiple\n // SSRCs.\n const remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(line => SDPUtils.parseSsrcMedia(line))\n .filter(obj => obj.attribute === 'cname')[0];\n if (remoteSsrc) {\n rtcpParameters.cname = remoteSsrc.value;\n rtcpParameters.ssrc = remoteSsrc.ssrc;\n }\n\n // Edge uses the compound attribute instead of reducedSize\n // compound is !reducedSize\n const rsize = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-rsize');\n rtcpParameters.reducedSize = rsize.length > 0;\n rtcpParameters.compound = rsize.length === 0;\n\n // parses the rtcp-mux attrіbute.\n // Note that Edge does not support unmuxed RTCP.\n const mux = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-mux');\n rtcpParameters.mux = mux.length > 0;\n\n return rtcpParameters;\n};\n\nSDPUtils.writeRtcpParameters = function(rtcpParameters) {\n let sdp = '';\n if (rtcpParameters.reducedSize) {\n sdp += 'a=rtcp-rsize\\r\\n';\n }\n if (rtcpParameters.mux) {\n sdp += 'a=rtcp-mux\\r\\n';\n }\n if (rtcpParameters.ssrc !== undefined && rtcpParameters.cname) {\n sdp += 'a=ssrc:' + rtcpParameters.ssrc +\n ' cname:' + rtcpParameters.cname + '\\r\\n';\n }\n return sdp;\n};\n\n\n// parses either a=msid: or a=ssrc:... msid lines and returns\n// the id of the MediaStream and MediaStreamTrack.\nSDPUtils.parseMsid = function(mediaSection) {\n let parts;\n const spec = SDPUtils.matchPrefix(mediaSection, 'a=msid:');\n if (spec.length === 1) {\n parts = spec[0].substring(7).split(' ');\n return {stream: parts[0], track: parts[1]};\n }\n const planB = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(line => SDPUtils.parseSsrcMedia(line))\n .filter(msidParts => msidParts.attribute === 'msid');\n if (planB.length > 0) {\n parts = planB[0].value.split(' ');\n return {stream: parts[0], track: parts[1]};\n }\n};\n\n// SCTP\n// parses draft-ietf-mmusic-sctp-sdp-26 first and falls back\n// to draft-ietf-mmusic-sctp-sdp-05\nSDPUtils.parseSctpDescription = function(mediaSection) {\n const mline = SDPUtils.parseMLine(mediaSection);\n const maxSizeLine = SDPUtils.matchPrefix(mediaSection, 'a=max-message-size:');\n let maxMessageSize;\n if (maxSizeLine.length > 0) {\n maxMessageSize = parseInt(maxSizeLine[0].substring(19), 10);\n }\n if (isNaN(maxMessageSize)) {\n maxMessageSize = 65536;\n }\n const sctpPort = SDPUtils.matchPrefix(mediaSection, 'a=sctp-port:');\n if (sctpPort.length > 0) {\n return {\n port: parseInt(sctpPort[0].substring(12), 10),\n protocol: mline.fmt,\n maxMessageSize,\n };\n }\n const sctpMapLines = SDPUtils.matchPrefix(mediaSection, 'a=sctpmap:');\n if (sctpMapLines.length > 0) {\n const parts = sctpMapLines[0]\n .substring(10)\n .split(' ');\n return {\n port: parseInt(parts[0], 10),\n protocol: parts[1],\n maxMessageSize,\n };\n }\n};\n\n// SCTP\n// outputs the draft-ietf-mmusic-sctp-sdp-26 version that all browsers\n// support by now receiving in this format, unless we originally parsed\n// as the draft-ietf-mmusic-sctp-sdp-05 format (indicated by the m-line\n// protocol of DTLS/SCTP -- without UDP/ or TCP/)\nSDPUtils.writeSctpDescription = function(media, sctp) {\n let output = [];\n if (media.protocol !== 'DTLS/SCTP') {\n output = [\n 'm=' + media.kind + ' 9 ' + media.protocol + ' ' + sctp.protocol + '\\r\\n',\n 'c=IN IP4 0.0.0.0\\r\\n',\n 'a=sctp-port:' + sctp.port + '\\r\\n',\n ];\n } else {\n output = [\n 'm=' + media.kind + ' 9 ' + media.protocol + ' ' + sctp.port + '\\r\\n',\n 'c=IN IP4 0.0.0.0\\r\\n',\n 'a=sctpmap:' + sctp.port + ' ' + sctp.protocol + ' 65535\\r\\n',\n ];\n }\n if (sctp.maxMessageSize !== undefined) {\n output.push('a=max-message-size:' + sctp.maxMessageSize + '\\r\\n');\n }\n return output.join('');\n};\n\n// Generate a session ID for SDP.\n// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-20#section-5.2.1\n// recommends using a cryptographically random +ve 64-bit value\n// but right now this should be acceptable and within the right range\nSDPUtils.generateSessionId = function() {\n return Math.random().toString().substr(2, 22);\n};\n\n// Write boiler plate for start of SDP\n// sessId argument is optional - if not supplied it will\n// be generated randomly\n// sessVersion is optional and defaults to 2\n// sessUser is optional and defaults to 'thisisadapterortc'\nSDPUtils.writeSessionBoilerplate = function(sessId, sessVer, sessUser) {\n let sessionId;\n const version = sessVer !== undefined ? sessVer : 2;\n if (sessId) {\n sessionId = sessId;\n } else {\n sessionId = SDPUtils.generateSessionId();\n }\n const user = sessUser || 'thisisadapterortc';\n // FIXME: sess-id should be an NTP timestamp.\n return 'v=0\\r\\n' +\n 'o=' + user + ' ' + sessionId + ' ' + version +\n ' IN IP4 127.0.0.1\\r\\n' +\n 's=-\\r\\n' +\n 't=0 0\\r\\n';\n};\n\n// Gets the direction from the mediaSection or the sessionpart.\nSDPUtils.getDirection = function(mediaSection, sessionpart) {\n // Look for sendrecv, sendonly, recvonly, inactive, default to sendrecv.\n const lines = SDPUtils.splitLines(mediaSection);\n for (let i = 0; i < lines.length; i++) {\n switch (lines[i]) {\n case 'a=sendrecv':\n case 'a=sendonly':\n case 'a=recvonly':\n case 'a=inactive':\n return lines[i].substring(2);\n default:\n // FIXME: What should happen here?\n }\n }\n if (sessionpart) {\n return SDPUtils.getDirection(sessionpart);\n }\n return 'sendrecv';\n};\n\nSDPUtils.getKind = function(mediaSection) {\n const lines = SDPUtils.splitLines(mediaSection);\n const mline = lines[0].split(' ');\n return mline[0].substring(2);\n};\n\nSDPUtils.isRejected = function(mediaSection) {\n return mediaSection.split(' ', 2)[1] === '0';\n};\n\nSDPUtils.parseMLine = function(mediaSection) {\n const lines = SDPUtils.splitLines(mediaSection);\n const parts = lines[0].substring(2).split(' ');\n return {\n kind: parts[0],\n port: parseInt(parts[1], 10),\n protocol: parts[2],\n fmt: parts.slice(3).join(' '),\n };\n};\n\nSDPUtils.parseOLine = function(mediaSection) {\n const line = SDPUtils.matchPrefix(mediaSection, 'o=')[0];\n const parts = line.substring(2).split(' ');\n return {\n username: parts[0],\n sessionId: parts[1],\n sessionVersion: parseInt(parts[2], 10),\n netType: parts[3],\n addressType: parts[4],\n address: parts[5],\n };\n};\n\n// a very naive interpretation of a valid SDP.\nSDPUtils.isValidSDP = function(blob) {\n if (typeof blob !== 'string' || blob.length === 0) {\n return false;\n }\n const lines = SDPUtils.splitLines(blob);\n for (let i = 0; i < lines.length; i++) {\n if (lines[i].length < 2 || lines[i].charAt(1) !== '=') {\n return false;\n }\n // TODO: check the modifier a bit more.\n }\n return true;\n};\n\n// Expose public methods.\nif (typeof module === 'object') {\n module.exports = SDPUtils;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nlet logDisabled_ = true;\nlet deprecationWarnings_ = true;\n\n/**\n * Extract browser version out of the provided user agent string.\n *\n * @param {!string} uastring userAgent string.\n * @param {!string} expr Regular expression used as match criteria.\n * @param {!number} pos position in the version string to be returned.\n * @return {!number} browser version.\n */\nexport function extractVersion(uastring, expr, pos) {\n const match = uastring.match(expr);\n return match && match.length >= pos && parseInt(match[pos], 10);\n}\n\n// Wraps the peerconnection event eventNameToWrap in a function\n// which returns the modified event object (or false to prevent\n// the event).\nexport function wrapPeerConnectionEvent(window, eventNameToWrap, wrapper) {\n if (!window.RTCPeerConnection) {\n return;\n }\n const proto = window.RTCPeerConnection.prototype;\n const nativeAddEventListener = proto.addEventListener;\n proto.addEventListener = function(nativeEventName, cb) {\n if (nativeEventName !== eventNameToWrap) {\n return nativeAddEventListener.apply(this, arguments);\n }\n const wrappedCallback = (e) => {\n const modifiedEvent = wrapper(e);\n if (modifiedEvent) {\n if (cb.handleEvent) {\n cb.handleEvent(modifiedEvent);\n } else {\n cb(modifiedEvent);\n }\n }\n };\n this._eventMap = this._eventMap || {};\n if (!this._eventMap[eventNameToWrap]) {\n this._eventMap[eventNameToWrap] = new Map();\n }\n this._eventMap[eventNameToWrap].set(cb, wrappedCallback);\n return nativeAddEventListener.apply(this, [nativeEventName,\n wrappedCallback]);\n };\n\n const nativeRemoveEventListener = proto.removeEventListener;\n proto.removeEventListener = function(nativeEventName, cb) {\n if (nativeEventName !== eventNameToWrap || !this._eventMap\n || !this._eventMap[eventNameToWrap]) {\n return nativeRemoveEventListener.apply(this, arguments);\n }\n if (!this._eventMap[eventNameToWrap].has(cb)) {\n return nativeRemoveEventListener.apply(this, arguments);\n }\n const unwrappedCb = this._eventMap[eventNameToWrap].get(cb);\n this._eventMap[eventNameToWrap].delete(cb);\n if (this._eventMap[eventNameToWrap].size === 0) {\n delete this._eventMap[eventNameToWrap];\n }\n if (Object.keys(this._eventMap).length === 0) {\n delete this._eventMap;\n }\n return nativeRemoveEventListener.apply(this, [nativeEventName,\n unwrappedCb]);\n };\n\n Object.defineProperty(proto, 'on' + eventNameToWrap, {\n get() {\n return this['_on' + eventNameToWrap];\n },\n set(cb) {\n if (this['_on' + eventNameToWrap]) {\n this.removeEventListener(eventNameToWrap,\n this['_on' + eventNameToWrap]);\n delete this['_on' + eventNameToWrap];\n }\n if (cb) {\n this.addEventListener(eventNameToWrap,\n this['_on' + eventNameToWrap] = cb);\n }\n },\n enumerable: true,\n configurable: true\n });\n}\n\nexport function disableLog(bool) {\n if (typeof bool !== 'boolean') {\n return new Error('Argument type: ' + typeof bool +\n '. Please use a boolean.');\n }\n logDisabled_ = bool;\n return (bool) ? 'adapter.js logging disabled' :\n 'adapter.js logging enabled';\n}\n\n/**\n * Disable or enable deprecation warnings\n * @param {!boolean} bool set to true to disable warnings.\n */\nexport function disableWarnings(bool) {\n if (typeof bool !== 'boolean') {\n return new Error('Argument type: ' + typeof bool +\n '. Please use a boolean.');\n }\n deprecationWarnings_ = !bool;\n return 'adapter.js deprecation warnings ' + (bool ? 'disabled' : 'enabled');\n}\n\nexport function log() {\n if (typeof window === 'object') {\n if (logDisabled_) {\n return;\n }\n if (typeof console !== 'undefined' && typeof console.log === 'function') {\n console.log.apply(console, arguments);\n }\n }\n}\n\n/**\n * Shows a deprecation warning suggesting the modern and spec-compatible API.\n */\nexport function deprecated(oldMethod, newMethod) {\n if (!deprecationWarnings_) {\n return;\n }\n console.warn(oldMethod + ' is deprecated, please use ' + newMethod +\n ' instead.');\n}\n\n/**\n * Browser detector.\n *\n * @return {object} result containing browser and version\n * properties.\n */\nexport function detectBrowser(window) {\n // Returned result object.\n const result = {browser: null, version: null};\n\n // Fail early if it's not a browser\n if (typeof window === 'undefined' || !window.navigator ||\n !window.navigator.userAgent) {\n result.browser = 'Not a browser.';\n return result;\n }\n\n const {navigator} = window;\n\n if (navigator.mozGetUserMedia) { // Firefox.\n result.browser = 'firefox';\n result.version = extractVersion(navigator.userAgent,\n /Firefox\\/(\\d+)\\./, 1);\n } else if (navigator.webkitGetUserMedia ||\n (window.isSecureContext === false && window.webkitRTCPeerConnection)) {\n // Chrome, Chromium, Webview, Opera.\n // Version matches Chrome/WebRTC version.\n // Chrome 74 removed webkitGetUserMedia on http as well so we need the\n // more complicated fallback to webkitRTCPeerConnection.\n result.browser = 'chrome';\n result.version = extractVersion(navigator.userAgent,\n /Chrom(e|ium)\\/(\\d+)\\./, 2);\n } else if (window.RTCPeerConnection &&\n navigator.userAgent.match(/AppleWebKit\\/(\\d+)\\./)) { // Safari.\n result.browser = 'safari';\n result.version = extractVersion(navigator.userAgent,\n /AppleWebKit\\/(\\d+)\\./, 1);\n result.supportsUnifiedPlan = window.RTCRtpTransceiver &&\n 'currentDirection' in window.RTCRtpTransceiver.prototype;\n } else { // Default fallthrough: not supported.\n result.browser = 'Not a supported browser.';\n return result;\n }\n\n return result;\n}\n\n/**\n * Checks if something is an object.\n *\n * @param {*} val The something you want to check.\n * @return true if val is an object, false otherwise.\n */\nfunction isObject(val) {\n return Object.prototype.toString.call(val) === '[object Object]';\n}\n\n/**\n * Remove all empty objects and undefined values\n * from a nested object -- an enhanced and vanilla version\n * of Lodash's `compact`.\n */\nexport function compactObject(data) {\n if (!isObject(data)) {\n return data;\n }\n\n return Object.keys(data).reduce(function(accumulator, key) {\n const isObj = isObject(data[key]);\n const value = isObj ? compactObject(data[key]) : data[key];\n const isEmptyObject = isObj && !Object.keys(value).length;\n if (value === undefined || isEmptyObject) {\n return accumulator;\n }\n return Object.assign(accumulator, {[key]: value});\n }, {});\n}\n\n/* iterates the stats graph recursively. */\nexport function walkStats(stats, base, resultSet) {\n if (!base || resultSet.has(base.id)) {\n return;\n }\n resultSet.set(base.id, base);\n Object.keys(base).forEach(name => {\n if (name.endsWith('Id')) {\n walkStats(stats, stats.get(base[name]), resultSet);\n } else if (name.endsWith('Ids')) {\n base[name].forEach(id => {\n walkStats(stats, stats.get(id), resultSet);\n });\n }\n });\n}\n\n/* filter getStats for a sender/receiver track. */\nexport function filterStats(result, track, outbound) {\n const streamStatsType = outbound ? 'outbound-rtp' : 'inbound-rtp';\n const filteredResult = new Map();\n if (track === null) {\n return filteredResult;\n }\n const trackStats = [];\n result.forEach(value => {\n if (value.type === 'track' &&\n value.trackIdentifier === track.id) {\n trackStats.push(value);\n }\n });\n trackStats.forEach(trackStat => {\n result.forEach(stats => {\n if (stats.type === streamStatsType && stats.trackId === trackStat.id) {\n walkStats(result, stats, filteredResult);\n }\n });\n });\n return filteredResult;\n}\n\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\nimport * as utils from '../utils.js';\nconst logging = utils.log;\n\nexport function shimGetUserMedia(window, browserDetails) {\n const navigator = window && window.navigator;\n\n if (!navigator.mediaDevices) {\n return;\n }\n\n const constraintsToChrome_ = function(c) {\n if (typeof c !== 'object' || c.mandatory || c.optional) {\n return c;\n }\n const cc = {};\n Object.keys(c).forEach(key => {\n if (key === 'require' || key === 'advanced' || key === 'mediaSource') {\n return;\n }\n const r = (typeof c[key] === 'object') ? c[key] : {ideal: c[key]};\n if (r.exact !== undefined && typeof r.exact === 'number') {\n r.min = r.max = r.exact;\n }\n const oldname_ = function(prefix, name) {\n if (prefix) {\n return prefix + name.charAt(0).toUpperCase() + name.slice(1);\n }\n return (name === 'deviceId') ? 'sourceId' : name;\n };\n if (r.ideal !== undefined) {\n cc.optional = cc.optional || [];\n let oc = {};\n if (typeof r.ideal === 'number') {\n oc[oldname_('min', key)] = r.ideal;\n cc.optional.push(oc);\n oc = {};\n oc[oldname_('max', key)] = r.ideal;\n cc.optional.push(oc);\n } else {\n oc[oldname_('', key)] = r.ideal;\n cc.optional.push(oc);\n }\n }\n if (r.exact !== undefined && typeof r.exact !== 'number') {\n cc.mandatory = cc.mandatory || {};\n cc.mandatory[oldname_('', key)] = r.exact;\n } else {\n ['min', 'max'].forEach(mix => {\n if (r[mix] !== undefined) {\n cc.mandatory = cc.mandatory || {};\n cc.mandatory[oldname_(mix, key)] = r[mix];\n }\n });\n }\n });\n if (c.advanced) {\n cc.optional = (cc.optional || []).concat(c.advanced);\n }\n return cc;\n };\n\n const shimConstraints_ = function(constraints, func) {\n if (browserDetails.version >= 61) {\n return func(constraints);\n }\n constraints = JSON.parse(JSON.stringify(constraints));\n if (constraints && typeof constraints.audio === 'object') {\n const remap = function(obj, a, b) {\n if (a in obj && !(b in obj)) {\n obj[b] = obj[a];\n delete obj[a];\n }\n };\n constraints = JSON.parse(JSON.stringify(constraints));\n remap(constraints.audio, 'autoGainControl', 'googAutoGainControl');\n remap(constraints.audio, 'noiseSuppression', 'googNoiseSuppression');\n constraints.audio = constraintsToChrome_(constraints.audio);\n }\n if (constraints && typeof constraints.video === 'object') {\n // Shim facingMode for mobile & surface pro.\n let face = constraints.video.facingMode;\n face = face && ((typeof face === 'object') ? face : {ideal: face});\n const getSupportedFacingModeLies = browserDetails.version < 66;\n\n if ((face && (face.exact === 'user' || face.exact === 'environment' ||\n face.ideal === 'user' || face.ideal === 'environment')) &&\n !(navigator.mediaDevices.getSupportedConstraints &&\n navigator.mediaDevices.getSupportedConstraints().facingMode &&\n !getSupportedFacingModeLies)) {\n delete constraints.video.facingMode;\n let matches;\n if (face.exact === 'environment' || face.ideal === 'environment') {\n matches = ['back', 'rear'];\n } else if (face.exact === 'user' || face.ideal === 'user') {\n matches = ['front'];\n }\n if (matches) {\n // Look for matches in label, or use last cam for back (typical).\n return navigator.mediaDevices.enumerateDevices()\n .then(devices => {\n devices = devices.filter(d => d.kind === 'videoinput');\n let dev = devices.find(d => matches.some(match =>\n d.label.toLowerCase().includes(match)));\n if (!dev && devices.length && matches.includes('back')) {\n dev = devices[devices.length - 1]; // more likely the back cam\n }\n if (dev) {\n constraints.video.deviceId = face.exact\n ? {exact: dev.deviceId}\n : {ideal: dev.deviceId};\n }\n constraints.video = constraintsToChrome_(constraints.video);\n logging('chrome: ' + JSON.stringify(constraints));\n return func(constraints);\n });\n }\n }\n constraints.video = constraintsToChrome_(constraints.video);\n }\n logging('chrome: ' + JSON.stringify(constraints));\n return func(constraints);\n };\n\n const shimError_ = function(e) {\n if (browserDetails.version >= 64) {\n return e;\n }\n return {\n name: {\n PermissionDeniedError: 'NotAllowedError',\n PermissionDismissedError: 'NotAllowedError',\n InvalidStateError: 'NotAllowedError',\n DevicesNotFoundError: 'NotFoundError',\n ConstraintNotSatisfiedError: 'OverconstrainedError',\n TrackStartError: 'NotReadableError',\n MediaDeviceFailedDueToShutdown: 'NotAllowedError',\n MediaDeviceKillSwitchOn: 'NotAllowedError',\n TabCaptureError: 'AbortError',\n ScreenCaptureError: 'AbortError',\n DeviceCaptureError: 'AbortError'\n }[e.name] || e.name,\n message: e.message,\n constraint: e.constraint || e.constraintName,\n toString() {\n return this.name + (this.message && ': ') + this.message;\n }\n };\n };\n\n const getUserMedia_ = function(constraints, onSuccess, onError) {\n shimConstraints_(constraints, c => {\n navigator.webkitGetUserMedia(c, onSuccess, e => {\n if (onError) {\n onError(shimError_(e));\n }\n });\n });\n };\n navigator.getUserMedia = getUserMedia_.bind(navigator);\n\n // Even though Chrome 45 has navigator.mediaDevices and a getUserMedia\n // function which returns a Promise, it does not accept spec-style\n // constraints.\n if (navigator.mediaDevices.getUserMedia) {\n const origGetUserMedia = navigator.mediaDevices.getUserMedia.\n bind(navigator.mediaDevices);\n navigator.mediaDevices.getUserMedia = function(cs) {\n return shimConstraints_(cs, c => origGetUserMedia(c).then(stream => {\n if (c.audio && !stream.getAudioTracks().length ||\n c.video && !stream.getVideoTracks().length) {\n stream.getTracks().forEach(track => {\n track.stop();\n });\n throw new DOMException('', 'NotFoundError');\n }\n return stream;\n }, e => Promise.reject(shimError_(e))));\n };\n }\n}\n","/*\n * Copyright (c) 2018 The adapter.js project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\nexport function shimGetDisplayMedia(window, getSourceId) {\n if (window.navigator.mediaDevices &&\n 'getDisplayMedia' in window.navigator.mediaDevices) {\n return;\n }\n if (!(window.navigator.mediaDevices)) {\n return;\n }\n // getSourceId is a function that returns a promise resolving with\n // the sourceId of the screen/window/tab to be shared.\n if (typeof getSourceId !== 'function') {\n console.error('shimGetDisplayMedia: getSourceId argument is not ' +\n 'a function');\n return;\n }\n window.navigator.mediaDevices.getDisplayMedia =\n function getDisplayMedia(constraints) {\n return getSourceId(constraints)\n .then(sourceId => {\n const widthSpecified = constraints.video && constraints.video.width;\n const heightSpecified = constraints.video &&\n constraints.video.height;\n const frameRateSpecified = constraints.video &&\n constraints.video.frameRate;\n constraints.video = {\n mandatory: {\n chromeMediaSource: 'desktop',\n chromeMediaSourceId: sourceId,\n maxFrameRate: frameRateSpecified || 3\n }\n };\n if (widthSpecified) {\n constraints.video.mandatory.maxWidth = widthSpecified;\n }\n if (heightSpecified) {\n constraints.video.mandatory.maxHeight = heightSpecified;\n }\n return window.navigator.mediaDevices.getUserMedia(constraints);\n });\n };\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\nimport * as utils from '../utils.js';\n\nexport {shimGetUserMedia} from './getusermedia';\nexport {shimGetDisplayMedia} from './getdisplaymedia';\n\nexport function shimMediaStream(window) {\n window.MediaStream = window.MediaStream || window.webkitMediaStream;\n}\n\nexport function shimOnTrack(window) {\n if (typeof window === 'object' && window.RTCPeerConnection && !('ontrack' in\n window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'ontrack', {\n get() {\n return this._ontrack;\n },\n set(f) {\n if (this._ontrack) {\n this.removeEventListener('track', this._ontrack);\n }\n this.addEventListener('track', this._ontrack = f);\n },\n enumerable: true,\n configurable: true\n });\n const origSetRemoteDescription =\n window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription =\n function setRemoteDescription() {\n if (!this._ontrackpoly) {\n this._ontrackpoly = (e) => {\n // onaddstream does not fire when a track is added to an existing\n // stream. But stream.onaddtrack is implemented so we use that.\n e.stream.addEventListener('addtrack', te => {\n let receiver;\n if (window.RTCPeerConnection.prototype.getReceivers) {\n receiver = this.getReceivers()\n .find(r => r.track && r.track.id === te.track.id);\n } else {\n receiver = {track: te.track};\n }\n\n const event = new Event('track');\n event.track = te.track;\n event.receiver = receiver;\n event.transceiver = {receiver};\n event.streams = [e.stream];\n this.dispatchEvent(event);\n });\n e.stream.getTracks().forEach(track => {\n let receiver;\n if (window.RTCPeerConnection.prototype.getReceivers) {\n receiver = this.getReceivers()\n .find(r => r.track && r.track.id === track.id);\n } else {\n receiver = {track};\n }\n const event = new Event('track');\n event.track = track;\n event.receiver = receiver;\n event.transceiver = {receiver};\n event.streams = [e.stream];\n this.dispatchEvent(event);\n });\n };\n this.addEventListener('addstream', this._ontrackpoly);\n }\n return origSetRemoteDescription.apply(this, arguments);\n };\n } else {\n // even if RTCRtpTransceiver is in window, it is only used and\n // emitted in unified-plan. Unfortunately this means we need\n // to unconditionally wrap the event.\n utils.wrapPeerConnectionEvent(window, 'track', e => {\n if (!e.transceiver) {\n Object.defineProperty(e, 'transceiver',\n {value: {receiver: e.receiver}});\n }\n return e;\n });\n }\n}\n\nexport function shimGetSendersWithDtmf(window) {\n // Overrides addTrack/removeTrack, depends on shimAddTrackRemoveTrack.\n if (typeof window === 'object' && window.RTCPeerConnection &&\n !('getSenders' in window.RTCPeerConnection.prototype) &&\n 'createDTMFSender' in window.RTCPeerConnection.prototype) {\n const shimSenderWithDtmf = function(pc, track) {\n return {\n track,\n get dtmf() {\n if (this._dtmf === undefined) {\n if (track.kind === 'audio') {\n this._dtmf = pc.createDTMFSender(track);\n } else {\n this._dtmf = null;\n }\n }\n return this._dtmf;\n },\n _pc: pc\n };\n };\n\n // augment addTrack when getSenders is not available.\n if (!window.RTCPeerConnection.prototype.getSenders) {\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n this._senders = this._senders || [];\n return this._senders.slice(); // return a copy of the internal state.\n };\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n window.RTCPeerConnection.prototype.addTrack =\n function addTrack(track, stream) {\n let sender = origAddTrack.apply(this, arguments);\n if (!sender) {\n sender = shimSenderWithDtmf(this, track);\n this._senders.push(sender);\n }\n return sender;\n };\n\n const origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack;\n window.RTCPeerConnection.prototype.removeTrack =\n function removeTrack(sender) {\n origRemoveTrack.apply(this, arguments);\n const idx = this._senders.indexOf(sender);\n if (idx !== -1) {\n this._senders.splice(idx, 1);\n }\n };\n }\n const origAddStream = window.RTCPeerConnection.prototype.addStream;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n this._senders = this._senders || [];\n origAddStream.apply(this, [stream]);\n stream.getTracks().forEach(track => {\n this._senders.push(shimSenderWithDtmf(this, track));\n });\n };\n\n const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n this._senders = this._senders || [];\n origRemoveStream.apply(this, [stream]);\n\n stream.getTracks().forEach(track => {\n const sender = this._senders.find(s => s.track === track);\n if (sender) { // remove sender\n this._senders.splice(this._senders.indexOf(sender), 1);\n }\n });\n };\n } else if (typeof window === 'object' && window.RTCPeerConnection &&\n 'getSenders' in window.RTCPeerConnection.prototype &&\n 'createDTMFSender' in window.RTCPeerConnection.prototype &&\n window.RTCRtpSender &&\n !('dtmf' in window.RTCRtpSender.prototype)) {\n const origGetSenders = window.RTCPeerConnection.prototype.getSenders;\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n const senders = origGetSenders.apply(this, []);\n senders.forEach(sender => sender._pc = this);\n return senders;\n };\n\n Object.defineProperty(window.RTCRtpSender.prototype, 'dtmf', {\n get() {\n if (this._dtmf === undefined) {\n if (this.track.kind === 'audio') {\n this._dtmf = this._pc.createDTMFSender(this.track);\n } else {\n this._dtmf = null;\n }\n }\n return this._dtmf;\n }\n });\n }\n}\n\nexport function shimGetStats(window) {\n if (!window.RTCPeerConnection) {\n return;\n }\n\n const origGetStats = window.RTCPeerConnection.prototype.getStats;\n window.RTCPeerConnection.prototype.getStats = function getStats() {\n const [selector, onSucc, onErr] = arguments;\n\n // If selector is a function then we are in the old style stats so just\n // pass back the original getStats format to avoid breaking old users.\n if (arguments.length > 0 && typeof selector === 'function') {\n return origGetStats.apply(this, arguments);\n }\n\n // When spec-style getStats is supported, return those when called with\n // either no arguments or the selector argument is null.\n if (origGetStats.length === 0 && (arguments.length === 0 ||\n typeof selector !== 'function')) {\n return origGetStats.apply(this, []);\n }\n\n const fixChromeStats_ = function(response) {\n const standardReport = {};\n const reports = response.result();\n reports.forEach(report => {\n const standardStats = {\n id: report.id,\n timestamp: report.timestamp,\n type: {\n localcandidate: 'local-candidate',\n remotecandidate: 'remote-candidate'\n }[report.type] || report.type\n };\n report.names().forEach(name => {\n standardStats[name] = report.stat(name);\n });\n standardReport[standardStats.id] = standardStats;\n });\n\n return standardReport;\n };\n\n // shim getStats with maplike support\n const makeMapStats = function(stats) {\n return new Map(Object.keys(stats).map(key => [key, stats[key]]));\n };\n\n if (arguments.length >= 2) {\n const successCallbackWrapper_ = function(response) {\n onSucc(makeMapStats(fixChromeStats_(response)));\n };\n\n return origGetStats.apply(this, [successCallbackWrapper_,\n selector]);\n }\n\n // promise-support\n return new Promise((resolve, reject) => {\n origGetStats.apply(this, [\n function(response) {\n resolve(makeMapStats(fixChromeStats_(response)));\n }, reject]);\n }).then(onSucc, onErr);\n };\n}\n\nexport function shimSenderReceiverGetStats(window) {\n if (!(typeof window === 'object' && window.RTCPeerConnection &&\n window.RTCRtpSender && window.RTCRtpReceiver)) {\n return;\n }\n\n // shim sender stats.\n if (!('getStats' in window.RTCRtpSender.prototype)) {\n const origGetSenders = window.RTCPeerConnection.prototype.getSenders;\n if (origGetSenders) {\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n const senders = origGetSenders.apply(this, []);\n senders.forEach(sender => sender._pc = this);\n return senders;\n };\n }\n\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n if (origAddTrack) {\n window.RTCPeerConnection.prototype.addTrack = function addTrack() {\n const sender = origAddTrack.apply(this, arguments);\n sender._pc = this;\n return sender;\n };\n }\n window.RTCRtpSender.prototype.getStats = function getStats() {\n const sender = this;\n return this._pc.getStats().then(result =>\n /* Note: this will include stats of all senders that\n * send a track with the same id as sender.track as\n * it is not possible to identify the RTCRtpSender.\n */\n utils.filterStats(result, sender.track, true));\n };\n }\n\n // shim receiver stats.\n if (!('getStats' in window.RTCRtpReceiver.prototype)) {\n const origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;\n if (origGetReceivers) {\n window.RTCPeerConnection.prototype.getReceivers =\n function getReceivers() {\n const receivers = origGetReceivers.apply(this, []);\n receivers.forEach(receiver => receiver._pc = this);\n return receivers;\n };\n }\n utils.wrapPeerConnectionEvent(window, 'track', e => {\n e.receiver._pc = e.srcElement;\n return e;\n });\n window.RTCRtpReceiver.prototype.getStats = function getStats() {\n const receiver = this;\n return this._pc.getStats().then(result =>\n utils.filterStats(result, receiver.track, false));\n };\n }\n\n if (!('getStats' in window.RTCRtpSender.prototype &&\n 'getStats' in window.RTCRtpReceiver.prototype)) {\n return;\n }\n\n // shim RTCPeerConnection.getStats(track).\n const origGetStats = window.RTCPeerConnection.prototype.getStats;\n window.RTCPeerConnection.prototype.getStats = function getStats() {\n if (arguments.length > 0 &&\n arguments[0] instanceof window.MediaStreamTrack) {\n const track = arguments[0];\n let sender;\n let receiver;\n let err;\n this.getSenders().forEach(s => {\n if (s.track === track) {\n if (sender) {\n err = true;\n } else {\n sender = s;\n }\n }\n });\n this.getReceivers().forEach(r => {\n if (r.track === track) {\n if (receiver) {\n err = true;\n } else {\n receiver = r;\n }\n }\n return r.track === track;\n });\n if (err || (sender && receiver)) {\n return Promise.reject(new DOMException(\n 'There are more than one sender or receiver for the track.',\n 'InvalidAccessError'));\n } else if (sender) {\n return sender.getStats();\n } else if (receiver) {\n return receiver.getStats();\n }\n return Promise.reject(new DOMException(\n 'There is no sender or receiver for the track.',\n 'InvalidAccessError'));\n }\n return origGetStats.apply(this, arguments);\n };\n}\n\nexport function shimAddTrackRemoveTrackWithNative(window) {\n // shim addTrack/removeTrack with native variants in order to make\n // the interactions with legacy getLocalStreams behave as in other browsers.\n // Keeps a mapping stream.id => [stream, rtpsenders...]\n window.RTCPeerConnection.prototype.getLocalStreams =\n function getLocalStreams() {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n return Object.keys(this._shimmedLocalStreams)\n .map(streamId => this._shimmedLocalStreams[streamId][0]);\n };\n\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n window.RTCPeerConnection.prototype.addTrack =\n function addTrack(track, stream) {\n if (!stream) {\n return origAddTrack.apply(this, arguments);\n }\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n\n const sender = origAddTrack.apply(this, arguments);\n if (!this._shimmedLocalStreams[stream.id]) {\n this._shimmedLocalStreams[stream.id] = [stream, sender];\n } else if (this._shimmedLocalStreams[stream.id].indexOf(sender) === -1) {\n this._shimmedLocalStreams[stream.id].push(sender);\n }\n return sender;\n };\n\n const origAddStream = window.RTCPeerConnection.prototype.addStream;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n\n stream.getTracks().forEach(track => {\n const alreadyExists = this.getSenders().find(s => s.track === track);\n if (alreadyExists) {\n throw new DOMException('Track already exists.',\n 'InvalidAccessError');\n }\n });\n const existingSenders = this.getSenders();\n origAddStream.apply(this, arguments);\n const newSenders = this.getSenders()\n .filter(newSender => existingSenders.indexOf(newSender) === -1);\n this._shimmedLocalStreams[stream.id] = [stream].concat(newSenders);\n };\n\n const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n delete this._shimmedLocalStreams[stream.id];\n return origRemoveStream.apply(this, arguments);\n };\n\n const origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack;\n window.RTCPeerConnection.prototype.removeTrack =\n function removeTrack(sender) {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n if (sender) {\n Object.keys(this._shimmedLocalStreams).forEach(streamId => {\n const idx = this._shimmedLocalStreams[streamId].indexOf(sender);\n if (idx !== -1) {\n this._shimmedLocalStreams[streamId].splice(idx, 1);\n }\n if (this._shimmedLocalStreams[streamId].length === 1) {\n delete this._shimmedLocalStreams[streamId];\n }\n });\n }\n return origRemoveTrack.apply(this, arguments);\n };\n}\n\nexport function shimAddTrackRemoveTrack(window, browserDetails) {\n if (!window.RTCPeerConnection) {\n return;\n }\n // shim addTrack and removeTrack.\n if (window.RTCPeerConnection.prototype.addTrack &&\n browserDetails.version >= 65) {\n return shimAddTrackRemoveTrackWithNative(window);\n }\n\n // also shim pc.getLocalStreams when addTrack is shimmed\n // to return the original streams.\n const origGetLocalStreams = window.RTCPeerConnection.prototype\n .getLocalStreams;\n window.RTCPeerConnection.prototype.getLocalStreams =\n function getLocalStreams() {\n const nativeStreams = origGetLocalStreams.apply(this);\n this._reverseStreams = this._reverseStreams || {};\n return nativeStreams.map(stream => this._reverseStreams[stream.id]);\n };\n\n const origAddStream = window.RTCPeerConnection.prototype.addStream;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n this._streams = this._streams || {};\n this._reverseStreams = this._reverseStreams || {};\n\n stream.getTracks().forEach(track => {\n const alreadyExists = this.getSenders().find(s => s.track === track);\n if (alreadyExists) {\n throw new DOMException('Track already exists.',\n 'InvalidAccessError');\n }\n });\n // Add identity mapping for consistency with addTrack.\n // Unless this is being used with a stream from addTrack.\n if (!this._reverseStreams[stream.id]) {\n const newStream = new window.MediaStream(stream.getTracks());\n this._streams[stream.id] = newStream;\n this._reverseStreams[newStream.id] = stream;\n stream = newStream;\n }\n origAddStream.apply(this, [stream]);\n };\n\n const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n this._streams = this._streams || {};\n this._reverseStreams = this._reverseStreams || {};\n\n origRemoveStream.apply(this, [(this._streams[stream.id] || stream)]);\n delete this._reverseStreams[(this._streams[stream.id] ?\n this._streams[stream.id].id : stream.id)];\n delete this._streams[stream.id];\n };\n\n window.RTCPeerConnection.prototype.addTrack =\n function addTrack(track, stream) {\n if (this.signalingState === 'closed') {\n throw new DOMException(\n 'The RTCPeerConnection\\'s signalingState is \\'closed\\'.',\n 'InvalidStateError');\n }\n const streams = [].slice.call(arguments, 1);\n if (streams.length !== 1 ||\n !streams[0].getTracks().find(t => t === track)) {\n // this is not fully correct but all we can manage without\n // [[associated MediaStreams]] internal slot.\n throw new DOMException(\n 'The adapter.js addTrack polyfill only supports a single ' +\n ' stream which is associated with the specified track.',\n 'NotSupportedError');\n }\n\n const alreadyExists = this.getSenders().find(s => s.track === track);\n if (alreadyExists) {\n throw new DOMException('Track already exists.',\n 'InvalidAccessError');\n }\n\n this._streams = this._streams || {};\n this._reverseStreams = this._reverseStreams || {};\n const oldStream = this._streams[stream.id];\n if (oldStream) {\n // this is using odd Chrome behaviour, use with caution:\n // https://bugs.chromium.org/p/webrtc/issues/detail?id=7815\n // Note: we rely on the high-level addTrack/dtmf shim to\n // create the sender with a dtmf sender.\n oldStream.addTrack(track);\n\n // Trigger ONN async.\n Promise.resolve().then(() => {\n this.dispatchEvent(new Event('negotiationneeded'));\n });\n } else {\n const newStream = new window.MediaStream([track]);\n this._streams[stream.id] = newStream;\n this._reverseStreams[newStream.id] = stream;\n this.addStream(newStream);\n }\n return this.getSenders().find(s => s.track === track);\n };\n\n // replace the internal stream id with the external one and\n // vice versa.\n function replaceInternalStreamId(pc, description) {\n let sdp = description.sdp;\n Object.keys(pc._reverseStreams || []).forEach(internalId => {\n const externalStream = pc._reverseStreams[internalId];\n const internalStream = pc._streams[externalStream.id];\n sdp = sdp.replace(new RegExp(internalStream.id, 'g'),\n externalStream.id);\n });\n return new RTCSessionDescription({\n type: description.type,\n sdp\n });\n }\n function replaceExternalStreamId(pc, description) {\n let sdp = description.sdp;\n Object.keys(pc._reverseStreams || []).forEach(internalId => {\n const externalStream = pc._reverseStreams[internalId];\n const internalStream = pc._streams[externalStream.id];\n sdp = sdp.replace(new RegExp(externalStream.id, 'g'),\n internalStream.id);\n });\n return new RTCSessionDescription({\n type: description.type,\n sdp\n });\n }\n ['createOffer', 'createAnswer'].forEach(function(method) {\n const nativeMethod = window.RTCPeerConnection.prototype[method];\n const methodObj = {[method]() {\n const args = arguments;\n const isLegacyCall = arguments.length &&\n typeof arguments[0] === 'function';\n if (isLegacyCall) {\n return nativeMethod.apply(this, [\n (description) => {\n const desc = replaceInternalStreamId(this, description);\n args[0].apply(null, [desc]);\n },\n (err) => {\n if (args[1]) {\n args[1].apply(null, err);\n }\n }, arguments[2]\n ]);\n }\n return nativeMethod.apply(this, arguments)\n .then(description => replaceInternalStreamId(this, description));\n }};\n window.RTCPeerConnection.prototype[method] = methodObj[method];\n });\n\n const origSetLocalDescription =\n window.RTCPeerConnection.prototype.setLocalDescription;\n window.RTCPeerConnection.prototype.setLocalDescription =\n function setLocalDescription() {\n if (!arguments.length || !arguments[0].type) {\n return origSetLocalDescription.apply(this, arguments);\n }\n arguments[0] = replaceExternalStreamId(this, arguments[0]);\n return origSetLocalDescription.apply(this, arguments);\n };\n\n // TODO: mangle getStats: https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamstats-streamidentifier\n\n const origLocalDescription = Object.getOwnPropertyDescriptor(\n window.RTCPeerConnection.prototype, 'localDescription');\n Object.defineProperty(window.RTCPeerConnection.prototype,\n 'localDescription', {\n get() {\n const description = origLocalDescription.get.apply(this);\n if (description.type === '') {\n return description;\n }\n return replaceInternalStreamId(this, description);\n }\n });\n\n window.RTCPeerConnection.prototype.removeTrack =\n function removeTrack(sender) {\n if (this.signalingState === 'closed') {\n throw new DOMException(\n 'The RTCPeerConnection\\'s signalingState is \\'closed\\'.',\n 'InvalidStateError');\n }\n // We can not yet check for sender instanceof RTCRtpSender\n // since we shim RTPSender. So we check if sender._pc is set.\n if (!sender._pc) {\n throw new DOMException('Argument 1 of RTCPeerConnection.removeTrack ' +\n 'does not implement interface RTCRtpSender.', 'TypeError');\n }\n const isLocal = sender._pc === this;\n if (!isLocal) {\n throw new DOMException('Sender was not created by this connection.',\n 'InvalidAccessError');\n }\n\n // Search for the native stream the senders track belongs to.\n this._streams = this._streams || {};\n let stream;\n Object.keys(this._streams).forEach(streamid => {\n const hasTrack = this._streams[streamid].getTracks()\n .find(track => sender.track === track);\n if (hasTrack) {\n stream = this._streams[streamid];\n }\n });\n\n if (stream) {\n if (stream.getTracks().length === 1) {\n // if this is the last track of the stream, remove the stream. This\n // takes care of any shimmed _senders.\n this.removeStream(this._reverseStreams[stream.id]);\n } else {\n // relying on the same odd chrome behaviour as above.\n stream.removeTrack(sender.track);\n }\n this.dispatchEvent(new Event('negotiationneeded'));\n }\n };\n}\n\nexport function shimPeerConnection(window, browserDetails) {\n if (!window.RTCPeerConnection && window.webkitRTCPeerConnection) {\n // very basic support for old versions.\n window.RTCPeerConnection = window.webkitRTCPeerConnection;\n }\n if (!window.RTCPeerConnection) {\n return;\n }\n\n // shim implicit creation of RTCSessionDescription/RTCIceCandidate\n if (browserDetails.version < 53) {\n ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']\n .forEach(function(method) {\n const nativeMethod = window.RTCPeerConnection.prototype[method];\n const methodObj = {[method]() {\n arguments[0] = new ((method === 'addIceCandidate') ?\n window.RTCIceCandidate :\n window.RTCSessionDescription)(arguments[0]);\n return nativeMethod.apply(this, arguments);\n }};\n window.RTCPeerConnection.prototype[method] = methodObj[method];\n });\n }\n}\n\n// Attempt to fix ONN in plan-b mode.\nexport function fixNegotiationNeeded(window, browserDetails) {\n utils.wrapPeerConnectionEvent(window, 'negotiationneeded', e => {\n const pc = e.target;\n if (browserDetails.version < 72 || (pc.getConfiguration &&\n pc.getConfiguration().sdpSemantics === 'plan-b')) {\n if (pc.signalingState !== 'stable') {\n return;\n }\n }\n return e;\n });\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nimport * as utils from '../utils';\n\nexport function shimGetUserMedia(window, browserDetails) {\n const navigator = window && window.navigator;\n const MediaStreamTrack = window && window.MediaStreamTrack;\n\n navigator.getUserMedia = function(constraints, onSuccess, onError) {\n // Replace Firefox 44+'s deprecation warning with unprefixed version.\n utils.deprecated('navigator.getUserMedia',\n 'navigator.mediaDevices.getUserMedia');\n navigator.mediaDevices.getUserMedia(constraints).then(onSuccess, onError);\n };\n\n if (!(browserDetails.version > 55 &&\n 'autoGainControl' in navigator.mediaDevices.getSupportedConstraints())) {\n const remap = function(obj, a, b) {\n if (a in obj && !(b in obj)) {\n obj[b] = obj[a];\n delete obj[a];\n }\n };\n\n const nativeGetUserMedia = navigator.mediaDevices.getUserMedia.\n bind(navigator.mediaDevices);\n navigator.mediaDevices.getUserMedia = function(c) {\n if (typeof c === 'object' && typeof c.audio === 'object') {\n c = JSON.parse(JSON.stringify(c));\n remap(c.audio, 'autoGainControl', 'mozAutoGainControl');\n remap(c.audio, 'noiseSuppression', 'mozNoiseSuppression');\n }\n return nativeGetUserMedia(c);\n };\n\n if (MediaStreamTrack && MediaStreamTrack.prototype.getSettings) {\n const nativeGetSettings = MediaStreamTrack.prototype.getSettings;\n MediaStreamTrack.prototype.getSettings = function() {\n const obj = nativeGetSettings.apply(this, arguments);\n remap(obj, 'mozAutoGainControl', 'autoGainControl');\n remap(obj, 'mozNoiseSuppression', 'noiseSuppression');\n return obj;\n };\n }\n\n if (MediaStreamTrack && MediaStreamTrack.prototype.applyConstraints) {\n const nativeApplyConstraints =\n MediaStreamTrack.prototype.applyConstraints;\n MediaStreamTrack.prototype.applyConstraints = function(c) {\n if (this.kind === 'audio' && typeof c === 'object') {\n c = JSON.parse(JSON.stringify(c));\n remap(c, 'autoGainControl', 'mozAutoGainControl');\n remap(c, 'noiseSuppression', 'mozNoiseSuppression');\n }\n return nativeApplyConstraints.apply(this, [c]);\n };\n }\n }\n}\n","/*\n * Copyright (c) 2018 The adapter.js project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nexport function shimGetDisplayMedia(window, preferredMediaSource) {\n if (window.navigator.mediaDevices &&\n 'getDisplayMedia' in window.navigator.mediaDevices) {\n return;\n }\n if (!(window.navigator.mediaDevices)) {\n return;\n }\n window.navigator.mediaDevices.getDisplayMedia =\n function getDisplayMedia(constraints) {\n if (!(constraints && constraints.video)) {\n const err = new DOMException('getDisplayMedia without video ' +\n 'constraints is undefined');\n err.name = 'NotFoundError';\n // from https://heycam.github.io/webidl/#idl-DOMException-error-names\n err.code = 8;\n return Promise.reject(err);\n }\n if (constraints.video === true) {\n constraints.video = {mediaSource: preferredMediaSource};\n } else {\n constraints.video.mediaSource = preferredMediaSource;\n }\n return window.navigator.mediaDevices.getUserMedia(constraints);\n };\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nimport * as utils from '../utils';\nexport {shimGetUserMedia} from './getusermedia';\nexport {shimGetDisplayMedia} from './getdisplaymedia';\n\nexport function shimOnTrack(window) {\n if (typeof window === 'object' && window.RTCTrackEvent &&\n ('receiver' in window.RTCTrackEvent.prototype) &&\n !('transceiver' in window.RTCTrackEvent.prototype)) {\n Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', {\n get() {\n return {receiver: this.receiver};\n }\n });\n }\n}\n\nexport function shimPeerConnection(window, browserDetails) {\n if (typeof window !== 'object' ||\n !(window.RTCPeerConnection || window.mozRTCPeerConnection)) {\n return; // probably media.peerconnection.enabled=false in about:config\n }\n if (!window.RTCPeerConnection && window.mozRTCPeerConnection) {\n // very basic support for old versions.\n window.RTCPeerConnection = window.mozRTCPeerConnection;\n }\n\n if (browserDetails.version < 53) {\n // shim away need for obsolete RTCIceCandidate/RTCSessionDescription.\n ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']\n .forEach(function(method) {\n const nativeMethod = window.RTCPeerConnection.prototype[method];\n const methodObj = {[method]() {\n arguments[0] = new ((method === 'addIceCandidate') ?\n window.RTCIceCandidate :\n window.RTCSessionDescription)(arguments[0]);\n return nativeMethod.apply(this, arguments);\n }};\n window.RTCPeerConnection.prototype[method] = methodObj[method];\n });\n }\n\n const modernStatsTypes = {\n inboundrtp: 'inbound-rtp',\n outboundrtp: 'outbound-rtp',\n candidatepair: 'candidate-pair',\n localcandidate: 'local-candidate',\n remotecandidate: 'remote-candidate'\n };\n\n const nativeGetStats = window.RTCPeerConnection.prototype.getStats;\n window.RTCPeerConnection.prototype.getStats = function getStats() {\n const [selector, onSucc, onErr] = arguments;\n return nativeGetStats.apply(this, [selector || null])\n .then(stats => {\n if (browserDetails.version < 53 && !onSucc) {\n // Shim only promise getStats with spec-hyphens in type names\n // Leave callback version alone; misc old uses of forEach before Map\n try {\n stats.forEach(stat => {\n stat.type = modernStatsTypes[stat.type] || stat.type;\n });\n } catch (e) {\n if (e.name !== 'TypeError') {\n throw e;\n }\n // Avoid TypeError: \"type\" is read-only, in old versions. 34-43ish\n stats.forEach((stat, i) => {\n stats.set(i, Object.assign({}, stat, {\n type: modernStatsTypes[stat.type] || stat.type\n }));\n });\n }\n }\n return stats;\n })\n .then(onSucc, onErr);\n };\n}\n\nexport function shimSenderGetStats(window) {\n if (!(typeof window === 'object' && window.RTCPeerConnection &&\n window.RTCRtpSender)) {\n return;\n }\n if (window.RTCRtpSender && 'getStats' in window.RTCRtpSender.prototype) {\n return;\n }\n const origGetSenders = window.RTCPeerConnection.prototype.getSenders;\n if (origGetSenders) {\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n const senders = origGetSenders.apply(this, []);\n senders.forEach(sender => sender._pc = this);\n return senders;\n };\n }\n\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n if (origAddTrack) {\n window.RTCPeerConnection.prototype.addTrack = function addTrack() {\n const sender = origAddTrack.apply(this, arguments);\n sender._pc = this;\n return sender;\n };\n }\n window.RTCRtpSender.prototype.getStats = function getStats() {\n return this.track ? this._pc.getStats(this.track) :\n Promise.resolve(new Map());\n };\n}\n\nexport function shimReceiverGetStats(window) {\n if (!(typeof window === 'object' && window.RTCPeerConnection &&\n window.RTCRtpSender)) {\n return;\n }\n if (window.RTCRtpSender && 'getStats' in window.RTCRtpReceiver.prototype) {\n return;\n }\n const origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;\n if (origGetReceivers) {\n window.RTCPeerConnection.prototype.getReceivers = function getReceivers() {\n const receivers = origGetReceivers.apply(this, []);\n receivers.forEach(receiver => receiver._pc = this);\n return receivers;\n };\n }\n utils.wrapPeerConnectionEvent(window, 'track', e => {\n e.receiver._pc = e.srcElement;\n return e;\n });\n window.RTCRtpReceiver.prototype.getStats = function getStats() {\n return this._pc.getStats(this.track);\n };\n}\n\nexport function shimRemoveStream(window) {\n if (!window.RTCPeerConnection ||\n 'removeStream' in window.RTCPeerConnection.prototype) {\n return;\n }\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n utils.deprecated('removeStream', 'removeTrack');\n this.getSenders().forEach(sender => {\n if (sender.track && stream.getTracks().includes(sender.track)) {\n this.removeTrack(sender);\n }\n });\n };\n}\n\nexport function shimRTCDataChannel(window) {\n // rename DataChannel to RTCDataChannel (native fix in FF60):\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1173851\n if (window.DataChannel && !window.RTCDataChannel) {\n window.RTCDataChannel = window.DataChannel;\n }\n}\n\nexport function shimAddTransceiver(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n const origAddTransceiver = window.RTCPeerConnection.prototype.addTransceiver;\n if (origAddTransceiver) {\n window.RTCPeerConnection.prototype.addTransceiver =\n function addTransceiver() {\n this.setParametersPromises = [];\n // WebIDL input coercion and validation\n let sendEncodings = arguments[1] && arguments[1].sendEncodings;\n if (sendEncodings === undefined) {\n sendEncodings = [];\n }\n sendEncodings = [...sendEncodings];\n const shouldPerformCheck = sendEncodings.length > 0;\n if (shouldPerformCheck) {\n // If sendEncodings params are provided, validate grammar\n sendEncodings.forEach((encodingParam) => {\n if ('rid' in encodingParam) {\n const ridRegex = /^[a-z0-9]{0,16}$/i;\n if (!ridRegex.test(encodingParam.rid)) {\n throw new TypeError('Invalid RID value provided.');\n }\n }\n if ('scaleResolutionDownBy' in encodingParam) {\n if (!(parseFloat(encodingParam.scaleResolutionDownBy) >= 1.0)) {\n throw new RangeError('scale_resolution_down_by must be >= 1.0');\n }\n }\n if ('maxFramerate' in encodingParam) {\n if (!(parseFloat(encodingParam.maxFramerate) >= 0)) {\n throw new RangeError('max_framerate must be >= 0.0');\n }\n }\n });\n }\n const transceiver = origAddTransceiver.apply(this, arguments);\n if (shouldPerformCheck) {\n // Check if the init options were applied. If not we do this in an\n // asynchronous way and save the promise reference in a global object.\n // This is an ugly hack, but at the same time is way more robust than\n // checking the sender parameters before and after the createOffer\n // Also note that after the createoffer we are not 100% sure that\n // the params were asynchronously applied so we might miss the\n // opportunity to recreate offer.\n const {sender} = transceiver;\n const params = sender.getParameters();\n if (!('encodings' in params) ||\n // Avoid being fooled by patched getParameters() below.\n (params.encodings.length === 1 &&\n Object.keys(params.encodings[0]).length === 0)) {\n params.encodings = sendEncodings;\n sender.sendEncodings = sendEncodings;\n this.setParametersPromises.push(sender.setParameters(params)\n .then(() => {\n delete sender.sendEncodings;\n }).catch(() => {\n delete sender.sendEncodings;\n })\n );\n }\n }\n return transceiver;\n };\n }\n}\n\nexport function shimGetParameters(window) {\n if (!(typeof window === 'object' && window.RTCRtpSender)) {\n return;\n }\n const origGetParameters = window.RTCRtpSender.prototype.getParameters;\n if (origGetParameters) {\n window.RTCRtpSender.prototype.getParameters =\n function getParameters() {\n const params = origGetParameters.apply(this, arguments);\n if (!('encodings' in params)) {\n params.encodings = [].concat(this.sendEncodings || [{}]);\n }\n return params;\n };\n }\n}\n\nexport function shimCreateOffer(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n const origCreateOffer = window.RTCPeerConnection.prototype.createOffer;\n window.RTCPeerConnection.prototype.createOffer = function createOffer() {\n if (this.setParametersPromises && this.setParametersPromises.length) {\n return Promise.all(this.setParametersPromises)\n .then(() => {\n return origCreateOffer.apply(this, arguments);\n })\n .finally(() => {\n this.setParametersPromises = [];\n });\n }\n return origCreateOffer.apply(this, arguments);\n };\n}\n\nexport function shimCreateAnswer(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n const origCreateAnswer = window.RTCPeerConnection.prototype.createAnswer;\n window.RTCPeerConnection.prototype.createAnswer = function createAnswer() {\n if (this.setParametersPromises && this.setParametersPromises.length) {\n return Promise.all(this.setParametersPromises)\n .then(() => {\n return origCreateAnswer.apply(this, arguments);\n })\n .finally(() => {\n this.setParametersPromises = [];\n });\n }\n return origCreateAnswer.apply(this, arguments);\n };\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n'use strict';\nimport * as utils from '../utils';\n\nexport function shimLocalStreamsAPI(window) {\n if (typeof window !== 'object' || !window.RTCPeerConnection) {\n return;\n }\n if (!('getLocalStreams' in window.RTCPeerConnection.prototype)) {\n window.RTCPeerConnection.prototype.getLocalStreams =\n function getLocalStreams() {\n if (!this._localStreams) {\n this._localStreams = [];\n }\n return this._localStreams;\n };\n }\n if (!('addStream' in window.RTCPeerConnection.prototype)) {\n const _addTrack = window.RTCPeerConnection.prototype.addTrack;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n if (!this._localStreams) {\n this._localStreams = [];\n }\n if (!this._localStreams.includes(stream)) {\n this._localStreams.push(stream);\n }\n // Try to emulate Chrome's behaviour of adding in audio-video order.\n // Safari orders by track id.\n stream.getAudioTracks().forEach(track => _addTrack.call(this, track,\n stream));\n stream.getVideoTracks().forEach(track => _addTrack.call(this, track,\n stream));\n };\n\n window.RTCPeerConnection.prototype.addTrack =\n function addTrack(track, ...streams) {\n if (streams) {\n streams.forEach((stream) => {\n if (!this._localStreams) {\n this._localStreams = [stream];\n } else if (!this._localStreams.includes(stream)) {\n this._localStreams.push(stream);\n }\n });\n }\n return _addTrack.apply(this, arguments);\n };\n }\n if (!('removeStream' in window.RTCPeerConnection.prototype)) {\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n if (!this._localStreams) {\n this._localStreams = [];\n }\n const index = this._localStreams.indexOf(stream);\n if (index === -1) {\n return;\n }\n this._localStreams.splice(index, 1);\n const tracks = stream.getTracks();\n this.getSenders().forEach(sender => {\n if (tracks.includes(sender.track)) {\n this.removeTrack(sender);\n }\n });\n };\n }\n}\n\nexport function shimRemoteStreamsAPI(window) {\n if (typeof window !== 'object' || !window.RTCPeerConnection) {\n return;\n }\n if (!('getRemoteStreams' in window.RTCPeerConnection.prototype)) {\n window.RTCPeerConnection.prototype.getRemoteStreams =\n function getRemoteStreams() {\n return this._remoteStreams ? this._remoteStreams : [];\n };\n }\n if (!('onaddstream' in window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'onaddstream', {\n get() {\n return this._onaddstream;\n },\n set(f) {\n if (this._onaddstream) {\n this.removeEventListener('addstream', this._onaddstream);\n this.removeEventListener('track', this._onaddstreampoly);\n }\n this.addEventListener('addstream', this._onaddstream = f);\n this.addEventListener('track', this._onaddstreampoly = (e) => {\n e.streams.forEach(stream => {\n if (!this._remoteStreams) {\n this._remoteStreams = [];\n }\n if (this._remoteStreams.includes(stream)) {\n return;\n }\n this._remoteStreams.push(stream);\n const event = new Event('addstream');\n event.stream = stream;\n this.dispatchEvent(event);\n });\n });\n }\n });\n const origSetRemoteDescription =\n window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription =\n function setRemoteDescription() {\n const pc = this;\n if (!this._onaddstreampoly) {\n this.addEventListener('track', this._onaddstreampoly = function(e) {\n e.streams.forEach(stream => {\n if (!pc._remoteStreams) {\n pc._remoteStreams = [];\n }\n if (pc._remoteStreams.indexOf(stream) >= 0) {\n return;\n }\n pc._remoteStreams.push(stream);\n const event = new Event('addstream');\n event.stream = stream;\n pc.dispatchEvent(event);\n });\n });\n }\n return origSetRemoteDescription.apply(pc, arguments);\n };\n }\n}\n\nexport function shimCallbacksAPI(window) {\n if (typeof window !== 'object' || !window.RTCPeerConnection) {\n return;\n }\n const prototype = window.RTCPeerConnection.prototype;\n const origCreateOffer = prototype.createOffer;\n const origCreateAnswer = prototype.createAnswer;\n const setLocalDescription = prototype.setLocalDescription;\n const setRemoteDescription = prototype.setRemoteDescription;\n const addIceCandidate = prototype.addIceCandidate;\n\n prototype.createOffer =\n function createOffer(successCallback, failureCallback) {\n const options = (arguments.length >= 2) ? arguments[2] : arguments[0];\n const promise = origCreateOffer.apply(this, [options]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n\n prototype.createAnswer =\n function createAnswer(successCallback, failureCallback) {\n const options = (arguments.length >= 2) ? arguments[2] : arguments[0];\n const promise = origCreateAnswer.apply(this, [options]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n\n let withCallback = function(description, successCallback, failureCallback) {\n const promise = setLocalDescription.apply(this, [description]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.setLocalDescription = withCallback;\n\n withCallback = function(description, successCallback, failureCallback) {\n const promise = setRemoteDescription.apply(this, [description]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.setRemoteDescription = withCallback;\n\n withCallback = function(candidate, successCallback, failureCallback) {\n const promise = addIceCandidate.apply(this, [candidate]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.addIceCandidate = withCallback;\n}\n\nexport function shimGetUserMedia(window) {\n const navigator = window && window.navigator;\n\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n // shim not needed in Safari 12.1\n const mediaDevices = navigator.mediaDevices;\n const _getUserMedia = mediaDevices.getUserMedia.bind(mediaDevices);\n navigator.mediaDevices.getUserMedia = (constraints) => {\n return _getUserMedia(shimConstraints(constraints));\n };\n }\n\n if (!navigator.getUserMedia && navigator.mediaDevices &&\n navigator.mediaDevices.getUserMedia) {\n navigator.getUserMedia = function getUserMedia(constraints, cb, errcb) {\n navigator.mediaDevices.getUserMedia(constraints)\n .then(cb, errcb);\n }.bind(navigator);\n }\n}\n\nexport function shimConstraints(constraints) {\n if (constraints && constraints.video !== undefined) {\n return Object.assign({},\n constraints,\n {video: utils.compactObject(constraints.video)}\n );\n }\n\n return constraints;\n}\n\nexport function shimRTCIceServerUrls(window) {\n if (!window.RTCPeerConnection) {\n return;\n }\n // migrate from non-spec RTCIceServer.url to RTCIceServer.urls\n const OrigPeerConnection = window.RTCPeerConnection;\n window.RTCPeerConnection =\n function RTCPeerConnection(pcConfig, pcConstraints) {\n if (pcConfig && pcConfig.iceServers) {\n const newIceServers = [];\n for (let i = 0; i < pcConfig.iceServers.length; i++) {\n let server = pcConfig.iceServers[i];\n if (server.urls === undefined && server.url) {\n utils.deprecated('RTCIceServer.url', 'RTCIceServer.urls');\n server = JSON.parse(JSON.stringify(server));\n server.urls = server.url;\n delete server.url;\n newIceServers.push(server);\n } else {\n newIceServers.push(pcConfig.iceServers[i]);\n }\n }\n pcConfig.iceServers = newIceServers;\n }\n return new OrigPeerConnection(pcConfig, pcConstraints);\n };\n window.RTCPeerConnection.prototype = OrigPeerConnection.prototype;\n // wrap static methods. Currently just generateCertificate.\n if ('generateCertificate' in OrigPeerConnection) {\n Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', {\n get() {\n return OrigPeerConnection.generateCertificate;\n }\n });\n }\n}\n\nexport function shimTrackEventTransceiver(window) {\n // Add event.transceiver member over deprecated event.receiver\n if (typeof window === 'object' && window.RTCTrackEvent &&\n 'receiver' in window.RTCTrackEvent.prototype &&\n !('transceiver' in window.RTCTrackEvent.prototype)) {\n Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', {\n get() {\n return {receiver: this.receiver};\n }\n });\n }\n}\n\nexport function shimCreateOfferLegacy(window) {\n const origCreateOffer = window.RTCPeerConnection.prototype.createOffer;\n window.RTCPeerConnection.prototype.createOffer =\n function createOffer(offerOptions) {\n if (offerOptions) {\n if (typeof offerOptions.offerToReceiveAudio !== 'undefined') {\n // support bit values\n offerOptions.offerToReceiveAudio =\n !!offerOptions.offerToReceiveAudio;\n }\n const audioTransceiver = this.getTransceivers().find(transceiver =>\n transceiver.receiver.track.kind === 'audio');\n if (offerOptions.offerToReceiveAudio === false && audioTransceiver) {\n if (audioTransceiver.direction === 'sendrecv') {\n if (audioTransceiver.setDirection) {\n audioTransceiver.setDirection('sendonly');\n } else {\n audioTransceiver.direction = 'sendonly';\n }\n } else if (audioTransceiver.direction === 'recvonly') {\n if (audioTransceiver.setDirection) {\n audioTransceiver.setDirection('inactive');\n } else {\n audioTransceiver.direction = 'inactive';\n }\n }\n } else if (offerOptions.offerToReceiveAudio === true &&\n !audioTransceiver) {\n this.addTransceiver('audio', {direction: 'recvonly'});\n }\n\n if (typeof offerOptions.offerToReceiveVideo !== 'undefined') {\n // support bit values\n offerOptions.offerToReceiveVideo =\n !!offerOptions.offerToReceiveVideo;\n }\n const videoTransceiver = this.getTransceivers().find(transceiver =>\n transceiver.receiver.track.kind === 'video');\n if (offerOptions.offerToReceiveVideo === false && videoTransceiver) {\n if (videoTransceiver.direction === 'sendrecv') {\n if (videoTransceiver.setDirection) {\n videoTransceiver.setDirection('sendonly');\n } else {\n videoTransceiver.direction = 'sendonly';\n }\n } else if (videoTransceiver.direction === 'recvonly') {\n if (videoTransceiver.setDirection) {\n videoTransceiver.setDirection('inactive');\n } else {\n videoTransceiver.direction = 'inactive';\n }\n }\n } else if (offerOptions.offerToReceiveVideo === true &&\n !videoTransceiver) {\n this.addTransceiver('video', {direction: 'recvonly'});\n }\n }\n return origCreateOffer.apply(this, arguments);\n };\n}\n\nexport function shimAudioContext(window) {\n if (typeof window !== 'object' || window.AudioContext) {\n return;\n }\n window.AudioContext = window.webkitAudioContext;\n}\n\n","/*\n * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nimport SDPUtils from 'sdp';\nimport * as utils from './utils';\n\nexport function shimRTCIceCandidate(window) {\n // foundation is arbitrarily chosen as an indicator for full support for\n // https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface\n if (!window.RTCIceCandidate || (window.RTCIceCandidate && 'foundation' in\n window.RTCIceCandidate.prototype)) {\n return;\n }\n\n const NativeRTCIceCandidate = window.RTCIceCandidate;\n window.RTCIceCandidate = function RTCIceCandidate(args) {\n // Remove the a= which shouldn't be part of the candidate string.\n if (typeof args === 'object' && args.candidate &&\n args.candidate.indexOf('a=') === 0) {\n args = JSON.parse(JSON.stringify(args));\n args.candidate = args.candidate.substring(2);\n }\n\n if (args.candidate && args.candidate.length) {\n // Augment the native candidate with the parsed fields.\n const nativeCandidate = new NativeRTCIceCandidate(args);\n const parsedCandidate = SDPUtils.parseCandidate(args.candidate);\n for (const key in parsedCandidate) {\n if (!(key in nativeCandidate)) {\n Object.defineProperty(nativeCandidate, key,\n {value: parsedCandidate[key]});\n }\n }\n\n // Override serializer to not serialize the extra attributes.\n nativeCandidate.toJSON = function toJSON() {\n return {\n candidate: nativeCandidate.candidate,\n sdpMid: nativeCandidate.sdpMid,\n sdpMLineIndex: nativeCandidate.sdpMLineIndex,\n usernameFragment: nativeCandidate.usernameFragment,\n };\n };\n return nativeCandidate;\n }\n return new NativeRTCIceCandidate(args);\n };\n window.RTCIceCandidate.prototype = NativeRTCIceCandidate.prototype;\n\n // Hook up the augmented candidate in onicecandidate and\n // addEventListener('icecandidate', ...)\n utils.wrapPeerConnectionEvent(window, 'icecandidate', e => {\n if (e.candidate) {\n Object.defineProperty(e, 'candidate', {\n value: new window.RTCIceCandidate(e.candidate),\n writable: 'false'\n });\n }\n return e;\n });\n}\n\nexport function shimRTCIceCandidateRelayProtocol(window) {\n if (!window.RTCIceCandidate || (window.RTCIceCandidate && 'relayProtocol' in\n window.RTCIceCandidate.prototype)) {\n return;\n }\n\n // Hook up the augmented candidate in onicecandidate and\n // addEventListener('icecandidate', ...)\n utils.wrapPeerConnectionEvent(window, 'icecandidate', e => {\n if (e.candidate) {\n const parsedCandidate = SDPUtils.parseCandidate(e.candidate.candidate);\n if (parsedCandidate.type === 'relay') {\n // This is a libwebrtc-specific mapping of local type preference\n // to relayProtocol.\n e.candidate.relayProtocol = {\n 0: 'tls',\n 1: 'tcp',\n 2: 'udp',\n }[parsedCandidate.priority >> 24];\n }\n }\n return e;\n });\n}\n\nexport function shimMaxMessageSize(window, browserDetails) {\n if (!window.RTCPeerConnection) {\n return;\n }\n\n if (!('sctp' in window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'sctp', {\n get() {\n return typeof this._sctp === 'undefined' ? null : this._sctp;\n }\n });\n }\n\n const sctpInDescription = function(description) {\n if (!description || !description.sdp) {\n return false;\n }\n const sections = SDPUtils.splitSections(description.sdp);\n sections.shift();\n return sections.some(mediaSection => {\n const mLine = SDPUtils.parseMLine(mediaSection);\n return mLine && mLine.kind === 'application'\n && mLine.protocol.indexOf('SCTP') !== -1;\n });\n };\n\n const getRemoteFirefoxVersion = function(description) {\n // TODO: Is there a better solution for detecting Firefox?\n const match = description.sdp.match(/mozilla...THIS_IS_SDPARTA-(\\d+)/);\n if (match === null || match.length < 2) {\n return -1;\n }\n const version = parseInt(match[1], 10);\n // Test for NaN (yes, this is ugly)\n return version !== version ? -1 : version;\n };\n\n const getCanSendMaxMessageSize = function(remoteIsFirefox) {\n // Every implementation we know can send at least 64 KiB.\n // Note: Although Chrome is technically able to send up to 256 KiB, the\n // data does not reach the other peer reliably.\n // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=8419\n let canSendMaxMessageSize = 65536;\n if (browserDetails.browser === 'firefox') {\n if (browserDetails.version < 57) {\n if (remoteIsFirefox === -1) {\n // FF < 57 will send in 16 KiB chunks using the deprecated PPID\n // fragmentation.\n canSendMaxMessageSize = 16384;\n } else {\n // However, other FF (and RAWRTC) can reassemble PPID-fragmented\n // messages. Thus, supporting ~2 GiB when sending.\n canSendMaxMessageSize = 2147483637;\n }\n } else if (browserDetails.version < 60) {\n // Currently, all FF >= 57 will reset the remote maximum message size\n // to the default value when a data channel is created at a later\n // stage. :(\n // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831\n canSendMaxMessageSize =\n browserDetails.version === 57 ? 65535 : 65536;\n } else {\n // FF >= 60 supports sending ~2 GiB\n canSendMaxMessageSize = 2147483637;\n }\n }\n return canSendMaxMessageSize;\n };\n\n const getMaxMessageSize = function(description, remoteIsFirefox) {\n // Note: 65536 bytes is the default value from the SDP spec. Also,\n // every implementation we know supports receiving 65536 bytes.\n let maxMessageSize = 65536;\n\n // FF 57 has a slightly incorrect default remote max message size, so\n // we need to adjust it here to avoid a failure when sending.\n // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1425697\n if (browserDetails.browser === 'firefox'\n && browserDetails.version === 57) {\n maxMessageSize = 65535;\n }\n\n const match = SDPUtils.matchPrefix(description.sdp,\n 'a=max-message-size:');\n if (match.length > 0) {\n maxMessageSize = parseInt(match[0].substring(19), 10);\n } else if (browserDetails.browser === 'firefox' &&\n remoteIsFirefox !== -1) {\n // If the maximum message size is not present in the remote SDP and\n // both local and remote are Firefox, the remote peer can receive\n // ~2 GiB.\n maxMessageSize = 2147483637;\n }\n return maxMessageSize;\n };\n\n const origSetRemoteDescription =\n window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription =\n function setRemoteDescription() {\n this._sctp = null;\n // Chrome decided to not expose .sctp in plan-b mode.\n // As usual, adapter.js has to do an 'ugly worakaround'\n // to cover up the mess.\n if (browserDetails.browser === 'chrome' && browserDetails.version >= 76) {\n const {sdpSemantics} = this.getConfiguration();\n if (sdpSemantics === 'plan-b') {\n Object.defineProperty(this, 'sctp', {\n get() {\n return typeof this._sctp === 'undefined' ? null : this._sctp;\n },\n enumerable: true,\n configurable: true,\n });\n }\n }\n\n if (sctpInDescription(arguments[0])) {\n // Check if the remote is FF.\n const isFirefox = getRemoteFirefoxVersion(arguments[0]);\n\n // Get the maximum message size the local peer is capable of sending\n const canSendMMS = getCanSendMaxMessageSize(isFirefox);\n\n // Get the maximum message size of the remote peer.\n const remoteMMS = getMaxMessageSize(arguments[0], isFirefox);\n\n // Determine final maximum message size\n let maxMessageSize;\n if (canSendMMS === 0 && remoteMMS === 0) {\n maxMessageSize = Number.POSITIVE_INFINITY;\n } else if (canSendMMS === 0 || remoteMMS === 0) {\n maxMessageSize = Math.max(canSendMMS, remoteMMS);\n } else {\n maxMessageSize = Math.min(canSendMMS, remoteMMS);\n }\n\n // Create a dummy RTCSctpTransport object and the 'maxMessageSize'\n // attribute.\n const sctp = {};\n Object.defineProperty(sctp, 'maxMessageSize', {\n get() {\n return maxMessageSize;\n }\n });\n this._sctp = sctp;\n }\n\n return origSetRemoteDescription.apply(this, arguments);\n };\n}\n\nexport function shimSendThrowTypeError(window) {\n if (!(window.RTCPeerConnection &&\n 'createDataChannel' in window.RTCPeerConnection.prototype)) {\n return;\n }\n\n // Note: Although Firefox >= 57 has a native implementation, the maximum\n // message size can be reset for all data channels at a later stage.\n // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831\n\n function wrapDcSend(dc, pc) {\n const origDataChannelSend = dc.send;\n dc.send = function send() {\n const data = arguments[0];\n const length = data.length || data.size || data.byteLength;\n if (dc.readyState === 'open' &&\n pc.sctp && length > pc.sctp.maxMessageSize) {\n throw new TypeError('Message too large (can send a maximum of ' +\n pc.sctp.maxMessageSize + ' bytes)');\n }\n return origDataChannelSend.apply(dc, arguments);\n };\n }\n const origCreateDataChannel =\n window.RTCPeerConnection.prototype.createDataChannel;\n window.RTCPeerConnection.prototype.createDataChannel =\n function createDataChannel() {\n const dataChannel = origCreateDataChannel.apply(this, arguments);\n wrapDcSend(dataChannel, this);\n return dataChannel;\n };\n utils.wrapPeerConnectionEvent(window, 'datachannel', e => {\n wrapDcSend(e.channel, e.target);\n return e;\n });\n}\n\n\n/* shims RTCConnectionState by pretending it is the same as iceConnectionState.\n * See https://bugs.chromium.org/p/webrtc/issues/detail?id=6145#c12\n * for why this is a valid hack in Chrome. In Firefox it is slightly incorrect\n * since DTLS failures would be hidden. See\n * https://bugzilla.mozilla.org/show_bug.cgi?id=1265827\n * for the Firefox tracking bug.\n */\nexport function shimConnectionState(window) {\n if (!window.RTCPeerConnection ||\n 'connectionState' in window.RTCPeerConnection.prototype) {\n return;\n }\n const proto = window.RTCPeerConnection.prototype;\n Object.defineProperty(proto, 'connectionState', {\n get() {\n return {\n completed: 'connected',\n checking: 'connecting'\n }[this.iceConnectionState] || this.iceConnectionState;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(proto, 'onconnectionstatechange', {\n get() {\n return this._onconnectionstatechange || null;\n },\n set(cb) {\n if (this._onconnectionstatechange) {\n this.removeEventListener('connectionstatechange',\n this._onconnectionstatechange);\n delete this._onconnectionstatechange;\n }\n if (cb) {\n this.addEventListener('connectionstatechange',\n this._onconnectionstatechange = cb);\n }\n },\n enumerable: true,\n configurable: true\n });\n\n ['setLocalDescription', 'setRemoteDescription'].forEach((method) => {\n const origMethod = proto[method];\n proto[method] = function() {\n if (!this._connectionstatechangepoly) {\n this._connectionstatechangepoly = e => {\n const pc = e.target;\n if (pc._lastConnectionState !== pc.connectionState) {\n pc._lastConnectionState = pc.connectionState;\n const newEvent = new Event('connectionstatechange', e);\n pc.dispatchEvent(newEvent);\n }\n return e;\n };\n this.addEventListener('iceconnectionstatechange',\n this._connectionstatechangepoly);\n }\n return origMethod.apply(this, arguments);\n };\n });\n}\n\nexport function removeExtmapAllowMixed(window, browserDetails) {\n /* remove a=extmap-allow-mixed for webrtc.org < M71 */\n if (!window.RTCPeerConnection) {\n return;\n }\n if (browserDetails.browser === 'chrome' && browserDetails.version >= 71) {\n return;\n }\n if (browserDetails.browser === 'safari' && browserDetails.version >= 605) {\n return;\n }\n const nativeSRD = window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription =\n function setRemoteDescription(desc) {\n if (desc && desc.sdp && desc.sdp.indexOf('\\na=extmap-allow-mixed') !== -1) {\n const sdp = desc.sdp.split('\\n').filter((line) => {\n return line.trim() !== 'a=extmap-allow-mixed';\n }).join('\\n');\n // Safari enforces read-only-ness of RTCSessionDescription fields.\n if (window.RTCSessionDescription &&\n desc instanceof window.RTCSessionDescription) {\n arguments[0] = new window.RTCSessionDescription({\n type: desc.type,\n sdp,\n });\n } else {\n desc.sdp = sdp;\n }\n }\n return nativeSRD.apply(this, arguments);\n };\n}\n\nexport function shimAddIceCandidateNullOrEmpty(window, browserDetails) {\n // Support for addIceCandidate(null or undefined)\n // as well as addIceCandidate({candidate: \"\", ...})\n // https://bugs.chromium.org/p/chromium/issues/detail?id=978582\n // Note: must be called before other polyfills which change the signature.\n if (!(window.RTCPeerConnection && window.RTCPeerConnection.prototype)) {\n return;\n }\n const nativeAddIceCandidate =\n window.RTCPeerConnection.prototype.addIceCandidate;\n if (!nativeAddIceCandidate || nativeAddIceCandidate.length === 0) {\n return;\n }\n window.RTCPeerConnection.prototype.addIceCandidate =\n function addIceCandidate() {\n if (!arguments[0]) {\n if (arguments[1]) {\n arguments[1].apply(null);\n }\n return Promise.resolve();\n }\n // Firefox 68+ emits and processes {candidate: \"\", ...}, ignore\n // in older versions.\n // Native support for ignoring exists for Chrome M77+.\n // Safari ignores as well, exact version unknown but works in the same\n // version that also ignores addIceCandidate(null).\n if (((browserDetails.browser === 'chrome' && browserDetails.version < 78)\n || (browserDetails.browser === 'firefox'\n && browserDetails.version < 68)\n || (browserDetails.browser === 'safari'))\n && arguments[0] && arguments[0].candidate === '') {\n return Promise.resolve();\n }\n return nativeAddIceCandidate.apply(this, arguments);\n };\n}\n\n// Note: Make sure to call this ahead of APIs that modify\n// setLocalDescription.length\nexport function shimParameterlessSetLocalDescription(window, browserDetails) {\n if (!(window.RTCPeerConnection && window.RTCPeerConnection.prototype)) {\n return;\n }\n const nativeSetLocalDescription =\n window.RTCPeerConnection.prototype.setLocalDescription;\n if (!nativeSetLocalDescription || nativeSetLocalDescription.length === 0) {\n return;\n }\n window.RTCPeerConnection.prototype.setLocalDescription =\n function setLocalDescription() {\n let desc = arguments[0] || {};\n if (typeof desc !== 'object' || (desc.type && desc.sdp)) {\n return nativeSetLocalDescription.apply(this, arguments);\n }\n // The remaining steps should technically happen when SLD comes off the\n // RTCPeerConnection's operations chain (not ahead of going on it), but\n // this is too difficult to shim. Instead, this shim only covers the\n // common case where the operations chain is empty. This is imperfect, but\n // should cover many cases. Rationale: Even if we can't reduce the glare\n // window to zero on imperfect implementations, there's value in tapping\n // into the perfect negotiation pattern that several browsers support.\n desc = {type: desc.type, sdp: desc.sdp};\n if (!desc.type) {\n switch (this.signalingState) {\n case 'stable':\n case 'have-local-offer':\n case 'have-remote-pranswer':\n desc.type = 'offer';\n break;\n default:\n desc.type = 'answer';\n break;\n }\n }\n if (desc.sdp || (desc.type !== 'offer' && desc.type !== 'answer')) {\n return nativeSetLocalDescription.apply(this, [desc]);\n }\n const func = desc.type === 'offer' ? this.createOffer : this.createAnswer;\n return func.apply(this)\n .then(d => nativeSetLocalDescription.apply(this, [d]));\n };\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\nimport * as utils from './utils';\n\n// Browser shims.\nimport * as chromeShim from './chrome/chrome_shim';\nimport * as firefoxShim from './firefox/firefox_shim';\nimport * as safariShim from './safari/safari_shim';\nimport * as commonShim from './common_shim';\nimport * as sdp from 'sdp';\n\n// Shimming starts here.\nexport function adapterFactory({window} = {}, options = {\n shimChrome: true,\n shimFirefox: true,\n shimSafari: true,\n}) {\n // Utils.\n const logging = utils.log;\n const browserDetails = utils.detectBrowser(window);\n\n const adapter = {\n browserDetails,\n commonShim,\n extractVersion: utils.extractVersion,\n disableLog: utils.disableLog,\n disableWarnings: utils.disableWarnings,\n // Expose sdp as a convenience. For production apps include directly.\n sdp,\n };\n\n // Shim browser if found.\n switch (browserDetails.browser) {\n case 'chrome':\n if (!chromeShim || !chromeShim.shimPeerConnection ||\n !options.shimChrome) {\n logging('Chrome shim is not included in this adapter release.');\n return adapter;\n }\n if (browserDetails.version === null) {\n logging('Chrome shim can not determine version, not shimming.');\n return adapter;\n }\n logging('adapter.js shimming chrome.');\n // Export to the adapter global object visible in the browser.\n adapter.browserShim = chromeShim;\n\n // Must be called before shimPeerConnection.\n commonShim.shimAddIceCandidateNullOrEmpty(window, browserDetails);\n commonShim.shimParameterlessSetLocalDescription(window, browserDetails);\n\n chromeShim.shimGetUserMedia(window, browserDetails);\n chromeShim.shimMediaStream(window, browserDetails);\n chromeShim.shimPeerConnection(window, browserDetails);\n chromeShim.shimOnTrack(window, browserDetails);\n chromeShim.shimAddTrackRemoveTrack(window, browserDetails);\n chromeShim.shimGetSendersWithDtmf(window, browserDetails);\n chromeShim.shimGetStats(window, browserDetails);\n chromeShim.shimSenderReceiverGetStats(window, browserDetails);\n chromeShim.fixNegotiationNeeded(window, browserDetails);\n\n commonShim.shimRTCIceCandidate(window, browserDetails);\n commonShim.shimRTCIceCandidateRelayProtocol(window, browserDetails);\n commonShim.shimConnectionState(window, browserDetails);\n commonShim.shimMaxMessageSize(window, browserDetails);\n commonShim.shimSendThrowTypeError(window, browserDetails);\n commonShim.removeExtmapAllowMixed(window, browserDetails);\n break;\n case 'firefox':\n if (!firefoxShim || !firefoxShim.shimPeerConnection ||\n !options.shimFirefox) {\n logging('Firefox shim is not included in this adapter release.');\n return adapter;\n }\n logging('adapter.js shimming firefox.');\n // Export to the adapter global object visible in the browser.\n adapter.browserShim = firefoxShim;\n\n // Must be called before shimPeerConnection.\n commonShim.shimAddIceCandidateNullOrEmpty(window, browserDetails);\n commonShim.shimParameterlessSetLocalDescription(window, browserDetails);\n\n firefoxShim.shimGetUserMedia(window, browserDetails);\n firefoxShim.shimPeerConnection(window, browserDetails);\n firefoxShim.shimOnTrack(window, browserDetails);\n firefoxShim.shimRemoveStream(window, browserDetails);\n firefoxShim.shimSenderGetStats(window, browserDetails);\n firefoxShim.shimReceiverGetStats(window, browserDetails);\n firefoxShim.shimRTCDataChannel(window, browserDetails);\n firefoxShim.shimAddTransceiver(window, browserDetails);\n firefoxShim.shimGetParameters(window, browserDetails);\n firefoxShim.shimCreateOffer(window, browserDetails);\n firefoxShim.shimCreateAnswer(window, browserDetails);\n\n commonShim.shimRTCIceCandidate(window, browserDetails);\n commonShim.shimConnectionState(window, browserDetails);\n commonShim.shimMaxMessageSize(window, browserDetails);\n commonShim.shimSendThrowTypeError(window, browserDetails);\n break;\n case 'safari':\n if (!safariShim || !options.shimSafari) {\n logging('Safari shim is not included in this adapter release.');\n return adapter;\n }\n logging('adapter.js shimming safari.');\n // Export to the adapter global object visible in the browser.\n adapter.browserShim = safariShim;\n\n // Must be called before shimCallbackAPI.\n commonShim.shimAddIceCandidateNullOrEmpty(window, browserDetails);\n commonShim.shimParameterlessSetLocalDescription(window, browserDetails);\n\n safariShim.shimRTCIceServerUrls(window, browserDetails);\n safariShim.shimCreateOfferLegacy(window, browserDetails);\n safariShim.shimCallbacksAPI(window, browserDetails);\n safariShim.shimLocalStreamsAPI(window, browserDetails);\n safariShim.shimRemoteStreamsAPI(window, browserDetails);\n safariShim.shimTrackEventTransceiver(window, browserDetails);\n safariShim.shimGetUserMedia(window, browserDetails);\n safariShim.shimAudioContext(window, browserDetails);\n\n commonShim.shimRTCIceCandidate(window, browserDetails);\n commonShim.shimRTCIceCandidateRelayProtocol(window, browserDetails);\n commonShim.shimMaxMessageSize(window, browserDetails);\n commonShim.shimSendThrowTypeError(window, browserDetails);\n commonShim.removeExtmapAllowMixed(window, browserDetails);\n break;\n default:\n logging('Unsupported browser!');\n break;\n }\n\n return adapter;\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n\n'use strict';\n\nimport {adapterFactory} from './adapter_factory.js';\n\nconst adapter =\n adapterFactory({window: typeof window === 'undefined' ? undefined : window});\nexport default adapter;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\n/**\n * GStreamer WebRTC configuration.\n *
The config can be passed on creation of the GstWebRTCAPI class.
\n * @typedef {object} GstWebRTCConfig\n * @property {object} meta=null - Client free-form information that will be exchanged with all peers through the\n * signaling meta property, its content depends on your application.\n * @property {string} signalingServerUrl=ws://127.0.0.1:8443 - The WebRTC signaling server URL.\n * @property {number} reconnectionTimeout=2500 - Timeout in milliseconds to reconnect to the signaling server in\n * case of an unexpected disconnection.\n * @property {object} webrtcConfig={iceServers...} - The WebRTC peer connection configuration passed to\n * {@link RTCPeerConnection}. Default configuration only includes a list of free STUN servers\n * (stun[0-4].l.google.com:19302).\n */\n\n/**\n * Default GstWebRTCAPI configuration.\n * @type {GstWebRTCConfig}\n */\nconst defaultConfig = Object.freeze({\n meta: null,\n signalingServerUrl: \"ws://127.0.0.1:8443\",\n reconnectionTimeout: 2500,\n webrtcConfig: {\n iceServers: [\n {\n urls: [\n \"stun:stun.l.google.com:19302\",\n \"stun:stun1.l.google.com:19302\"\n ]\n }\n ],\n bundlePolicy: \"max-bundle\"\n }\n});\n\nexport default defaultConfig;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\n/**\n * Session states enumeration. \n * Session state always increases from idle to closed and never switches backwards.\n * @enum {number}\n * @readonly\n */\nconst SessionState = /** @type {const} */ {\n /**\n * (0) Default state when creating a new session, goes to connecting when starting the session.\n */\n idle: 0,\n /**\n * (1) Session is trying to connect to remote peers, goes to streaming in case of\n * success or closed in case of error.\n */\n connecting: 1,\n /**\n * (2) Session is correctly connected to remote peers and currently streaming audio/video, goes\n * to closed when any peer closes the session.\n */\n streaming: 2,\n /**\n * (3) Session is closed and can be garbage collected, state will not change anymore.\n */\n closed: 3\n};\nObject.freeze(SessionState);\n\nexport default SessionState;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport SessionState from \"./session-state.js\";\n\n/** @import ProducerSession from \"./producer-session.js\"; */\n/** @import ClientSession from \"./producer-session.js\"; */\n\n/**\n * Event name: \"error\". \n * Triggered when any kind of error occurs.\n *
When emitted by a session, it is in general an unrecoverable error. Normally, the session is automatically closed\n * but in the specific case of a {@link ProducerSession}, when the error occurs on an underlying\n * {@link ClientSession} between the producer session and a remote client consuming the streamed media,\n * then only the failing {@link ClientSession} is closed. The producer session can keep on serving the\n * other consumer peers.
The remote control data channel is created by the GStreamer webrtcsink element on the producer side. Then it is\n * announced through the consumer session thanks to the {@link gstWebRTCAPI#event:RemoteControllerChangedEvent}\n * event.
\n *
You can attach an {@link HTMLVideoElement} to the remote controller, then all mouse and keyboard events\n * emitted by this element will be automatically relayed to the remote producer.
\n * @extends {EventTarget}\n * @fires {@link GstWebRTCAPI#event:ErrorEvent}\n * @fires {@link GstWebRTCAPI#event:ClosedEvent}\n * @fires {@link GstWebRTCAPI#event:InfoEvent}\n * @fires {@link GstWebRTCAPI#event:ControlResponseEvent}\n * @see ConsumerSession#remoteController\n * @see RemoteController#attachVideoElement\n * @see https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/tree/main/net/webrtc/gstwebrtc-api#produce-a-gstreamer-interactive-webrtc-stream-with-remote-control\n */\nclass RemoteController extends EventTarget {\n constructor(rtcDataChannel, consumerSession) {\n super();\n\n this._rtcDataChannel = rtcDataChannel;\n this._consumerSession = consumerSession;\n\n this._videoElement = null;\n this._videoElementComputedStyle = null;\n this._videoElementKeyboard = null;\n this._lastTouchEventTimestamp = 0;\n this._requestCounter = 0;\n\n rtcDataChannel.addEventListener(\"close\", () => {\n if (this._rtcDataChannel === rtcDataChannel) {\n this.close();\n }\n });\n\n rtcDataChannel.addEventListener(\"error\", (event) => {\n if (this._rtcDataChannel === rtcDataChannel) {\n const error = event.error;\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: (error && error.message) || \"Remote controller error\",\n error: error || new Error(\"unknown error on the remote controller data channel\")\n }));\n }\n });\n\n rtcDataChannel.addEventListener(\"message\", (event) => {\n try {\n const msg = JSON.parse(event.data);\n\n if (msg.type === \"ControlResponseMessage\") {\n this.dispatchEvent(new CustomEvent(\"controlResponse\", { detail: msg }));\n } else if (msg.type === \"InfoMessage\") {\n this.dispatchEvent(new CustomEvent(\"info\", { detail: msg }));\n }\n } catch (ex) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot parse control message from signaling server\",\n error: ex\n }));\n }\n });\n }\n\n\n /**\n * The underlying WebRTC data channel connected to a remote GStreamer webrtcsink producer offering remote control.\n * The value may be null if the remote controller has been closed.\n * @type {RTCDataChannel}\n * @readonly\n */\n get rtcDataChannel() {\n return this._rtcDataChannel;\n }\n\n /**\n * The consumer session associated with this remote controller.\n * @type {ConsumerSession}\n * @readonly\n */\n get consumerSession() {\n return this._consumerSession;\n }\n\n /**\n * The video element that is currently used to send all mouse and keyboard events to the remote producer. Value may\n * be null if no video element is attached.\n * @type {HTMLVideoElement}\n * @readonly\n * @see RemoteController#attachVideoElement\n */\n get videoElement() {\n return this._videoElement;\n }\n\n /**\n * Associates a video element with this remote controller. \n * When a video element is attached to this remote controller, all mouse and keyboard events emitted by this\n * element will be sent to the remote GStreamer webrtcink producer.\n * @param {HTMLVideoElement|null} element - the video element to use to relay mouse and keyboard events,\n * or null to detach any previously attached element. If the provided element parameter is not null and not a\n * valid instance of an {@link HTMLVideoElement}, then the method does nothing.\n */\n attachVideoElement(element) {\n if ((element instanceof HTMLVideoElement) && (element !== this._videoElement)) {\n if (this._videoElement) {\n this.attachVideoElement(null);\n }\n\n this._videoElement = element;\n this._videoElementComputedStyle = window.getComputedStyle(element);\n\n for (const eventName of eventsNames) {\n element.addEventListener(eventName, this);\n }\n\n element.setAttribute(\"tabindex\", \"0\");\n } else if ((element === null) && this._videoElement) {\n const previousElement = this._videoElement;\n previousElement.removeAttribute(\"tabindex\");\n\n this._videoElement = null;\n this._videoElementComputedStyle = null;\n\n this._lastTouchEventTimestamp = 0;\n\n for (const eventName of eventsNames) {\n previousElement.removeEventListener(eventName, this);\n }\n }\n }\n\n /**\n * Send a request over the control data channel. \n *\n * @fires {@link GstWebRTCAPI#event:ErrorEvent}\n * @param {object|string} request - The request to send over the channel\n * @returns {number} The identifier attributed to the request, or -1 if an exception occurred\n */\n sendControlRequest(request) {\n try {\n if (!request || ((typeof (request) !== \"object\") && (typeof (request) !== \"string\"))) {\n throw new Error(\"invalid request\");\n }\n\n if (!this._rtcDataChannel) {\n throw new Error(\"remote controller data channel is closed\");\n }\n\n let message = {\n id: this._requestCounter++,\n request: request\n };\n\n this._rtcDataChannel.send(JSON.stringify(message));\n\n return message.id;\n } catch (ex) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: `cannot send control message over session ${this._consumerSession.sessionId} remote controller`,\n error: ex\n }));\n return -1;\n }\n }\n\n /**\n * Closes the remote controller channel. \n * It immediately shuts down the underlying WebRTC data channel connected to a remote GStreamer webrtcsink\n * producer and detaches any video element that may be used to relay mouse and keyboard events.\n */\n close() {\n this.attachVideoElement(null);\n\n const rtcDataChannel = this._rtcDataChannel;\n this._rtcDataChannel = null;\n\n if (rtcDataChannel) {\n rtcDataChannel.close();\n this.dispatchEvent(new Event(\"closed\"));\n }\n }\n\n _sendGstNavigationEvent(data) {\n let request = {\n type: \"navigationEvent\",\n event: data\n };\n this.sendControlRequest(request);\n }\n\n _computeVideoMousePosition(event) {\n const mousePos = { x: 0, y: 0 };\n if (!this._videoElement || (this._videoElement.videoWidth <= 0) || (this._videoElement.videoHeight <= 0)) {\n return mousePos;\n }\n\n const padding = {\n left: parseFloat(this._videoElementComputedStyle.paddingLeft),\n right: parseFloat(this._videoElementComputedStyle.paddingRight),\n top: parseFloat(this._videoElementComputedStyle.paddingTop),\n bottom: parseFloat(this._videoElementComputedStyle.paddingBottom)\n };\n\n if ((\"offsetX\" in event) && (\"offsetY\" in event)) {\n mousePos.x = event.offsetX - padding.left;\n mousePos.y = event.offsetY - padding.top;\n } else {\n const clientRect = this._videoElement.getBoundingClientRect();\n const border = {\n left: parseFloat(this._videoElementComputedStyle.borderLeftWidth),\n top: parseFloat(this._videoElementComputedStyle.borderTopWidth)\n };\n mousePos.x = event.clientX - clientRect.left - border.left - padding.left;\n mousePos.y = event.clientY - clientRect.top - border.top - padding.top;\n }\n\n const videoOffset = {\n x: this._videoElement.clientWidth - (padding.left + padding.right),\n y: this._videoElement.clientHeight - (padding.top + padding.bottom)\n };\n\n const ratio = Math.min(videoOffset.x / this._videoElement.videoWidth, videoOffset.y / this._videoElement.videoHeight);\n videoOffset.x = Math.max(0.5 * (videoOffset.x - this._videoElement.videoWidth * ratio), 0);\n videoOffset.y = Math.max(0.5 * (videoOffset.y - this._videoElement.videoHeight * ratio), 0);\n\n const invRatio = (ratio !== 0) ? (1 / ratio) : 0;\n mousePos.x = (mousePos.x - videoOffset.x) * invRatio;\n mousePos.y = (mousePos.y - videoOffset.y) * invRatio;\n\n mousePos.x = Math.min(Math.max(mousePos.x, 0), this._videoElement.videoWidth);\n mousePos.y = Math.min(Math.max(mousePos.y, 0), this._videoElement.videoHeight);\n\n return mousePos;\n }\n\n handleEvent(event) {\n if (!this._videoElement) {\n return;\n }\n\n switch (event.type) {\n case \"wheel\":\n event.preventDefault();\n {\n const mousePos = this._computeVideoMousePosition(event);\n this._sendGstNavigationEvent({\n event: \"MouseScroll\",\n x: mousePos.x,\n y: mousePos.y,\n delta_x: -event.deltaX, // eslint-disable-line camelcase\n delta_y: -event.deltaY, // eslint-disable-line camelcase\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n });\n }\n break;\n\n case \"contextmenu\":\n event.preventDefault();\n break;\n\n case \"mousemove\":\n case \"mousedown\":\n case \"mouseup\":\n event.preventDefault();\n {\n const mousePos = this._computeVideoMousePosition(event);\n const data = {\n event: mouseEventsNames[event.type],\n x: mousePos.x,\n y: mousePos.y,\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n };\n\n if (event.type !== \"mousemove\") {\n data.button = event.button + 1;\n\n if ((event.type === \"mousedown\") && (event.button === 0)) {\n this._videoElement.focus();\n }\n }\n\n this._sendGstNavigationEvent(data);\n }\n break;\n\n case \"touchstart\":\n case \"touchend\":\n case \"touchmove\":\n case \"touchcancel\":\n for (const touch of event.changedTouches) {\n const mousePos = this._computeVideoMousePosition(touch);\n const data = {\n event: touchEventsNames[event.type],\n identifier: touch.identifier,\n x: mousePos.x,\n y: mousePos.y,\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n };\n\n if ((\"force\" in touch) && ((event.type === \"touchstart\") || (event.type === \"touchmove\"))) {\n data.pressure = touch.force;\n }\n\n this._sendGstNavigationEvent(data);\n }\n\n if (event.timeStamp > this._lastTouchEventTimestamp) {\n this._lastTouchEventTimestamp = event.timeStamp;\n this._sendGstNavigationEvent({\n event: \"TouchFrame\",\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n });\n }\n break;\n case \"keyup\":\n case \"keydown\":\n event.preventDefault();\n {\n const data = {\n event: keyboardEventsNames[event.type],\n key: getKeysymString(event.key, event.code),\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n };\n this._sendGstNavigationEvent(data);\n }\n break;\n }\n }\n}\n\nexport default RemoteController;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport WebRTCSession from \"./webrtc-session.js\";\nimport SessionState from \"./session-state.js\";\nimport RemoteController from \"./remote-controller.js\";\n\n/**\n * Event name: \"streamsChanged\". \n * Triggered when the underlying media streams of a {@link ConsumerSession} change.\n * @event GstWebRTCAPI#StreamsChangedEvent\n * @type {Event}\n * @see ConsumerSession#streams\n */\n/**\n * Event name: \"remoteControllerChanged\". \n * Triggered when the underlying remote controller of a {@link ConsumerSession} changes.\n * @event GstWebRTCAPI#RemoteControllerChangedEvent\n * @type {Event}\n * @see ConsumerSession#remoteController\n */\n\n/**\n * @class ConsumerSession\n * @hideconstructor\n * @classdesc Consumer session managing a peer-to-peer WebRTC channel between a remote producer and this client\n * instance.\n *
Call {@link GstWebRTCAPI#createConsumerSession} to create a ConsumerSession instance.
\n * @extends {WebRTCSession}\n * @fires {@link GstWebRTCAPI#event:StreamsChangedEvent}\n * @fires {@link GstWebRTCAPI#event:RemoteControllerChangedEvent}\n */\nclass ConsumerSession extends WebRTCSession {\n constructor(peerId, comChannel, offerOptions) {\n super(peerId, comChannel);\n this._streams = [];\n this._remoteController = null;\n this._pendingCandidates = [];\n this._mungeStereoHack = false;\n\n this._offerOptions = offerOptions;\n\n this.addEventListener(\"closed\", () => {\n this._streams = [];\n this._pendingCandidates = [];\n\n if (this._remoteController) {\n this._remoteController.close();\n }\n });\n }\n\n /**\n * Defines whether the SDP should be munged in order to enable stereo with chrome.\n * @method\n * @param {boolean} enable - Enable or disable the hack, default is false\n */\n set mungeStereoHack(enable) {\n if (typeof (enable) !== \"boolean\") { return; }\n\n this._mungeStereoHack = enable;\n }\n\n /**\n * The array of remote media streams consumed locally through this WebRTC channel.\n * @type {MediaStream[]}\n * @readonly\n */\n get streams() {\n return this._streams;\n }\n\n /**\n * The remote controller associated with this WebRTC consumer session. Value may be null if consumer session\n * has no remote controller.\n * @type {RemoteController}\n * @readonly\n */\n get remoteController() {\n return this._remoteController;\n }\n\n /**\n * Connects the consumer session to its remote producer. \n * This method must be called after creating the consumer session in order to start receiving the remote streams.\n * It registers this consumer session to the signaling server and gets ready to receive audio/video streams.\n *
Even on success, streaming can fail later if any error occurs during or after connection. In order to know\n * the effective streaming state, you should be listening to the [error]{@link GstWebRTCAPI#event:ErrorEvent},\n * [stateChanged]{@link GstWebRTCAPI#event:StateChangedEvent} and/or [closed]{@link GstWebRTCAPI#event:ClosedEvent}\n * events.
\n * @returns {boolean} true in case of success (may fail later during or after connection) or false in case of\n * immediate error (wrong session state or no connection to the signaling server).\n */\n connect() {\n if (!this._comChannel || (this._state === SessionState.closed)) {\n return false;\n }\n\n if (this._state !== SessionState.idle) {\n return true;\n }\n\n if (this._offerOptions) {\n this.ensurePeerConnection();\n\n this._rtcPeerConnection.createDataChannel(\"control\");\n\n this._rtcPeerConnection.createOffer(this._offerOptions).then((desc) => {\n if (this._rtcPeerConnection && desc) {\n return this._rtcPeerConnection.setLocalDescription(desc);\n } else {\n throw new Error(\"cannot send local offer to WebRTC peer\");\n }\n }).then(() => {\n if (this._rtcPeerConnection && this._comChannel) {\n const msg = {\n type: \"startSession\",\n peerId: this._peerId,\n offer: this._rtcPeerConnection.localDescription.toJSON().sdp\n };\n if (!this._comChannel.send(msg)) {\n throw new Error(\"cannot send startSession message to signaling server\");\n }\n this._state = SessionState.connecting;\n this.dispatchEvent(new Event(\"stateChanged\"));\n }\n }).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during SDP handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n } else {\n const msg = {\n type: \"startSession\",\n peerId: this._peerId\n };\n if (!this._comChannel.send(msg)) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot connect consumer session\",\n error: new Error(\"cannot send startSession message to signaling server\")\n }));\n\n this.close();\n return false;\n }\n\n this._state = SessionState.connecting;\n this.dispatchEvent(new Event(\"stateChanged\"));\n }\n\n return true;\n }\n\n onSessionStarted(peerId, sessionId) {\n if ((this._peerId === peerId) && (this._state === SessionState.connecting) && !this._sessionId) {\n console.log(\"Session started\", this._sessionId);\n this._sessionId = sessionId;\n\n for (const candidate of this._pendingCandidates) {\n console.log(\"Sending delayed ICE with session id\", this._sessionId);\n this._comChannel.send({\n type: \"peer\",\n sessionId: this._sessionId,\n ice: candidate.toJSON()\n });\n }\n\n this._pendingCandidates = [];\n }\n }\n\n ensurePeerConnection() {\n if (!this._rtcPeerConnection) {\n const connection = new RTCPeerConnection(this._comChannel.webrtcConfig);\n this._rtcPeerConnection = connection;\n\n connection.ontrack = (event) => {\n if ((this._rtcPeerConnection === connection) && event.streams && (event.streams.length > 0)) {\n if (this._state === SessionState.connecting) {\n this._state = SessionState.streaming;\n this.dispatchEvent(new Event(\"stateChanged\"));\n }\n\n let streamsChanged = false;\n for (const stream of event.streams) {\n if (!this._streams.includes(stream)) {\n this._streams.push(stream);\n streamsChanged = true;\n }\n }\n\n if (streamsChanged) {\n this.dispatchEvent(new Event(\"streamsChanged\"));\n }\n }\n };\n\n connection.ondatachannel = (event) => {\n const rtcDataChannel = event.channel;\n if (rtcDataChannel && (rtcDataChannel.label === \"control\")) {\n if (this._remoteController) {\n const previousController = this._remoteController;\n this._remoteController = null;\n previousController.close();\n }\n\n const remoteController = new RemoteController(rtcDataChannel, this);\n this._remoteController = remoteController;\n this.dispatchEvent(new Event(\"remoteControllerChanged\"));\n\n remoteController.addEventListener(\"closed\", () => {\n if (this._remoteController === remoteController) {\n this._remoteController = null;\n this.dispatchEvent(new Event(\"remoteControllerChanged\"));\n }\n });\n }\n };\n\n connection.onicecandidate = (event) => {\n if ((this._rtcPeerConnection === connection) && event.candidate && this._comChannel) {\n if (this._sessionId) {\n console.log(\"Sending ICE with session id\", this._sessionId);\n this._comChannel.send({\n type: \"peer\",\n sessionId: this._sessionId,\n ice: event.candidate.toJSON()\n });\n } else {\n this._pendingCandidates.push(event.candidate);\n }\n }\n };\n\n this.dispatchEvent(new Event(\"rtcPeerConnectionChanged\"));\n }\n }\n\n // Work around Chrome not handling stereo Opus correctly.\n // See\n // https://chromium.googlesource.com/external/webrtc/+/194e3bcc53ffa3e98045934377726cb25d7579d2/webrtc/media/engine/webrtcvoiceengine.cc#302\n // https://bugs.chromium.org/p/webrtc/issues/detail?id=8133\n //\n // Technically it's against the spec to modify the SDP\n // but there's no other API for this and this seems to\n // be the only possible workaround at this time.\n mungeStereo(offerSdp, answerSdp) {\n const stereoRegexp = /a=fmtp:.* sprop-stereo/g;\n let stereoPayloads = new Set();\n for (const m of offerSdp.matchAll(stereoRegexp)) {\n const payloadMatch = m[0].match(/a=fmtp:(\\d+) .*/);\n if (payloadMatch) {\n stereoPayloads.add(payloadMatch[1]);\n }\n }\n\n for (const payload of stereoPayloads) {\n const isStereoRegexp = new RegExp(\"a=fmtp:\" + payload + \".*stereo\");\n const answerIsStereo = answerSdp.match(isStereoRegexp);\n\n if (!answerIsStereo) {\n answerSdp = answerSdp.replaceAll(\"a=fmtp:\" + payload, \"a=fmtp:\" + payload + \" stereo=1;\");\n }\n }\n\n return answerSdp;\n }\n\n onSessionPeerMessage(msg) {\n if ((this._state === SessionState.closed) || !this._comChannel || !this._sessionId) {\n return;\n }\n\n this.ensurePeerConnection();\n\n if (msg.sdp) {\n if (this._offerOptions) {\n this._rtcPeerConnection.setRemoteDescription(msg.sdp).then(() => {\n console.log(\"done\");\n }).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during SDP handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n } else {\n this._rtcPeerConnection.setRemoteDescription(msg.sdp).then(() => {\n if (this._rtcPeerConnection) {\n return this._rtcPeerConnection.createAnswer();\n } else {\n return null;\n }\n }).then((desc) => {\n if (this._rtcPeerConnection && desc) {\n if (this._mungeStereoHack) {\n desc.sdp = this.mungeStereo(msg.sdp.sdp, desc.sdp);\n }\n\n return this._rtcPeerConnection.setLocalDescription(desc);\n } else {\n return null;\n }\n }).then(() => {\n if (this._rtcPeerConnection && this._comChannel) {\n console.log(\"Sending SDP with session id\", this._sessionId);\n const sdp = {\n type: \"peer\",\n sessionId: this._sessionId,\n sdp: this._rtcPeerConnection.localDescription.toJSON()\n };\n if (!this._comChannel.send(sdp)) {\n throw new Error(\"cannot send local SDP configuration to WebRTC peer\");\n }\n }\n }).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during SDP handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n }\n } else if (msg.ice) {\n const candidate = msg.ice.candidate ? new RTCIceCandidate(msg.ice) : null;\n this._rtcPeerConnection.addIceCandidate(candidate).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during ICE handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n } else {\n throw new Error(`invalid empty peer message received from consumer session ${this._sessionId}`);\n }\n }\n}\n\nexport default ConsumerSession;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport WebRTCSession from \"./webrtc-session.js\";\nimport SessionState from \"./session-state.js\";\n\n/**\n * @class ClientSession\n * @hideconstructor\n * @classdesc Client session representing a link between a remote consumer and a local producer session.\n * @extends {WebRTCSession}\n */\nclass ClientSession extends WebRTCSession {\n constructor(peerId, sessionId, comChannel, stream) {\n super(peerId, comChannel);\n this._sessionId = sessionId;\n this._state = SessionState.streaming;\n\n const connection = new RTCPeerConnection(this._comChannel.webrtcConfig);\n this._rtcPeerConnection = connection;\n\n for (const track of stream.getTracks()) {\n connection.addTrack(track, stream);\n }\n\n connection.onicecandidate = (event) => {\n if ((this._rtcPeerConnection === connection) && event.candidate && this._comChannel) {\n this._comChannel.send({\n type: \"peer\",\n sessionId: this._sessionId,\n ice: event.candidate.toJSON()\n });\n }\n };\n\n this.dispatchEvent(new Event(\"rtcPeerConnectionChanged\"));\n\n connection.setLocalDescription().then(() => {\n if ((this._rtcPeerConnection === connection) && this._comChannel) {\n const sdp = {\n type: \"peer\",\n sessionId: this._sessionId,\n sdp: this._rtcPeerConnection.localDescription.toJSON()\n };\n if (!this._comChannel.send(sdp)) {\n throw new Error(\"cannot send local SDP configuration to WebRTC peer\");\n }\n }\n }).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during SDP handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n }\n\n onSessionPeerMessage(msg) {\n if ((this._state === SessionState.closed) || !this._rtcPeerConnection) {\n return;\n }\n\n if (msg.sdp) {\n this._rtcPeerConnection.setRemoteDescription(msg.sdp).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during SDP handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n } else if (msg.ice) {\n const candidate = new RTCIceCandidate(msg.ice);\n this._rtcPeerConnection.addIceCandidate(candidate).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during ICE handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n } else {\n throw new Error(`invalid empty peer message received from producer's client session ${this._peerId}`);\n }\n }\n}\n\n/**\n * Event name: \"clientConsumerAdded\". \n * Triggered when a remote consumer peer connects to a local {@link ProducerSession}.\n * @event GstWebRTCAPI#ClientConsumerAddedEvent\n * @type {CustomEvent}\n * @property {ClientSession} detail - The WebRTC session associated with the added consumer peer.\n * @see ProducerSession\n */\n/**\n * Event name: \"clientConsumerRemoved\". \n * Triggered when a remote consumer peer disconnects from a local {@link ProducerSession}.\n * @event GstWebRTCAPI#ClientConsumerRemovedEvent\n * @type {CustomEvent}\n * @property {ClientSession} detail - The WebRTC session associated with the removed consumer peer.\n * @see ProducerSession\n */\n\n/**\n * @class ProducerSession\n * @hideconstructor\n * @classdesc Producer session managing the streaming out of a local {@link MediaStream}. \n * It manages all underlying WebRTC connections to each peer client consuming the stream.\n *
Call {@link GstWebRTCAPI#createProducerSession} to create a ProducerSession instance.
\n * @extends {EventTarget}\n * @fires {@link GstWebRTCAPI#event:ErrorEvent}\n * @fires {@link GstWebRTCAPI#event:StateChangedEvent}\n * @fires {@link GstWebRTCAPI#event:ClosedEvent}\n * @fires {@link GstWebRTCAPI#event:ClientConsumerAddedEvent}\n * @fires {@link GstWebRTCAPI#event:ClientConsumerRemovedEvent}\n */\nclass ProducerSession extends EventTarget {\n constructor(comChannel, stream, consumerId) {\n super();\n\n this._comChannel = comChannel;\n this._stream = stream;\n this._state = SessionState.idle;\n this._clientSessions = {};\n this._consumerId = consumerId;\n }\n\n /**\n * The local stream produced out by this session.\n * @type {MediaStream}\n * @readonly\n */\n get stream() {\n return this._stream;\n }\n\n /**\n * The current producer session state.\n * @type {SessionState}\n * @readonly\n */\n get state() {\n return this._state;\n }\n\n /**\n * Starts the producer session. \n * This method must be called after creating the producer session in order to start streaming. It registers this\n * producer session to the signaling server and gets ready to serve peer requests from consumers.\n *
Even on success, streaming can fail later if any error occurs during or after connection. In order to know\n * the effective streaming state, you should be listening to the [error]{@link GstWebRTCAPI#event:ErrorEvent},\n * [stateChanged]{@link GstWebRTCAPI#event:StateChangedEvent} and/or [closed]{@link GstWebRTCAPI#event:ClosedEvent}\n * events.
\n * @returns {boolean} true in case of success (may fail later during or after connection) or false in case of\n * immediate error (wrong session state or no connection to the signaling server).\n */\n start() {\n if (!this._comChannel || (this._state === SessionState.closed)) {\n return false;\n }\n\n if (this._state !== SessionState.idle) {\n return true;\n }\n\n const msg = {\n type: \"setPeerStatus\",\n roles: [\"listener\", \"producer\"],\n meta: this._comChannel.meta\n };\n if (!this._comChannel.send(msg)) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot start producer session\",\n error: new Error(\"cannot register producer to signaling server\")\n }));\n\n this.close();\n return false;\n }\n\n this._state = SessionState.connecting;\n this.dispatchEvent(new Event(\"stateChanged\"));\n return true;\n }\n\n /**\n * Terminates the producer session. \n * It immediately disconnects all peer consumers attached to this producer session and unregisters the producer\n * from the signaling server.\n */\n close() {\n if (this._state !== SessionState.closed) {\n for (const track of this._stream.getTracks()) {\n track.stop();\n }\n\n if ((this._state !== SessionState.idle) && this._comChannel) {\n this._comChannel.send({\n type: \"setPeerStatus\",\n roles: [\"listener\"],\n meta: this._comChannel.meta\n });\n }\n\n this._state = SessionState.closed;\n this.dispatchEvent(new Event(\"stateChanged\"));\n\n this._comChannel = null;\n this._stream = null;\n\n for (const clientSession of Object.values(this._clientSessions)) {\n clientSession.close();\n }\n this._clientSessions = {};\n\n this.dispatchEvent(new Event(\"closed\"));\n }\n }\n\n onProducerRegistered() {\n if (this._state === SessionState.connecting) {\n this._state = SessionState.streaming;\n this.dispatchEvent(new Event(\"stateChanged\"));\n }\n\n if (this._consumerId) {\n const msg = {\n type: \"startSession\",\n peerId: this._consumerId\n };\n if (!this._comChannel.send(msg)) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot send session request to specified consumer\",\n error: new Error(\"cannot send startSession message to signaling server\")\n }));\n\n this.close();\n }\n }\n }\n\n onStartSessionMessage(msg) {\n if (this._comChannel && this._stream && !(msg.sessionId in this._clientSessions)) {\n const session = new ClientSession(msg.peerId, msg.sessionId, this._comChannel, this._stream);\n this._clientSessions[msg.sessionId] = session;\n\n session.addEventListener(\"closed\", (event) => {\n const sessionId = event.target.sessionId;\n if ((sessionId in this._clientSessions) && (this._clientSessions[sessionId] === session)) {\n delete this._clientSessions[sessionId];\n this.dispatchEvent(new CustomEvent(\"clientConsumerRemoved\", { detail: session }));\n }\n });\n\n session.addEventListener(\"error\", (event) => {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: `error from client consumer ${event.target.peerId}: ${event.message}`,\n error: event.error\n }));\n });\n\n this.dispatchEvent(new CustomEvent(\"clientConsumerAdded\", { detail: session }));\n }\n }\n\n onEndSessionMessage(msg) {\n if (msg.sessionId in this._clientSessions) {\n this._clientSessions[msg.sessionId].close();\n }\n }\n\n onSessionPeerMessage(msg) {\n if (msg.sessionId in this._clientSessions) {\n this._clientSessions[msg.sessionId].onSessionPeerMessage(msg);\n }\n }\n}\n\nexport default ProducerSession;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport ConsumerSession from \"./consumer-session.js\";\nimport ProducerSession from \"./producer-session.js\";\n\nconst SignallingServerMessageType = Object.freeze({\n welcome: \"welcome\",\n peerStatusChanged: \"peerStatusChanged\",\n list: \"list\",\n listConsumers: \"listConsumers\",\n sessionStarted: \"sessionStarted\",\n peer: \"peer\",\n startSession: \"startSession\",\n endSession: \"endSession\",\n error: \"error\"\n});\n\nfunction normalizePeer(peer, excludedId) {\n if (!peer || (typeof (peer) !== \"object\")) {\n return null;\n }\n\n const normalizedPeer = {\n id: \"\",\n meta: {}\n };\n\n if (peer.id && (typeof (peer.id) === \"string\")) {\n normalizedPeer.id = peer.id;\n } else if (peer.peerId && (typeof (peer.peerId) === \"string\")) {\n normalizedPeer.id = peer.peerId;\n } else {\n return null;\n }\n\n if (normalizedPeer.id === excludedId) {\n return null;\n }\n\n if (peer.meta && (typeof (peer.meta) === \"object\")) {\n normalizedPeer.meta = peer.meta;\n }\n\n Object.freeze(normalizedPeer.meta);\n return Object.freeze(normalizedPeer);\n}\n\nclass ComChannel extends EventTarget {\n constructor(url, meta, webrtcConfig) {\n super();\n\n this._meta = meta;\n this._webrtcConfig = webrtcConfig;\n this._ws = new WebSocket(url);\n this._ready = false;\n this._channelId = \"\";\n this._producerSession = null;\n this._consumerSessions = {};\n this._peers = {};\n\n this._ws.onerror = (event) => {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: event.message || \"WebSocket error\",\n error: event.error || new Error(\n this._ready ? \"transportation error\" : \"cannot connect to signaling server\")\n }));\n this.close();\n };\n\n this._ws.onclose = () => {\n this._ready = false;\n this._channelId = \"\";\n this._ws = null;\n\n this.closeAllConsumerSessions();\n\n if (this._producerSession) {\n this._producerSession.close();\n this._producerSession = null;\n }\n\n this.dispatchEvent(new Event(\"closed\"));\n };\n\n this._ws.onmessage = (event) => {\n try {\n const msg = JSON.parse(event.data);\n if (msg && (typeof (msg) === \"object\")) {\n switch (msg.type) {\n\n case SignallingServerMessageType.welcome:\n this._channelId = msg.peerId;\n try {\n this._ws.send(JSON.stringify({\n type: \"setPeerStatus\",\n roles: [\"listener\"],\n meta: meta\n }));\n } catch (ex) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot initialize connection to signaling server\",\n error: ex\n }));\n this.close();\n }\n break;\n\n case SignallingServerMessageType.peerStatusChanged: {\n if (msg.peerId === this._channelId) {\n if (!this._ready && msg.roles.includes(\"listener\")) {\n this._ready = true;\n this.dispatchEvent(new Event(\"ready\"));\n this.send({ type: \"list\" });\n this.send({ type: \"listConsumers\"});\n }\n\n if (this._producerSession && msg.roles.includes(\"producer\")) {\n this._producerSession.onProducerRegistered();\n }\n\n break;\n }\n\n const peer = normalizePeer(msg, this._channelId);\n if (!peer) {\n break;\n }\n\n const oldRoles = this._peers[msg.peerId] || [];\n this._peers[msg.peerId] = msg.roles;\n for (const role of [\"producer\", \"consumer\"]) {\n if (!oldRoles.includes(role) && msg.roles.includes(role)) {\n this.dispatchEvent(new CustomEvent(\"peerAdded\", { detail: { peer, role } }));\n } else if (oldRoles.includes(role) && !msg.roles.includes(role)) {\n this.dispatchEvent(new CustomEvent(\"peerRemoved\", { detail: { peerId: msg.peerId, role } }));\n }\n }\n break;\n }\n\n case SignallingServerMessageType.list: {\n this.clearPeers(\"producer\");\n this.addPeers(msg.producers, \"producer\");\n break;\n }\n\n case SignallingServerMessageType.listConsumers: {\n this.clearPeers(\"consumer\");\n this.addPeers(msg.consumers, \"consumer\");\n break;\n }\n\n case SignallingServerMessageType.sessionStarted:\n {\n const session = this.getConsumerSession(msg.peerId);\n if (session) {\n delete this._consumerSessions[msg.peerId];\n\n session.onSessionStarted(msg.peerId, msg.sessionId);\n if (session.sessionId && !(session.sessionId in this._consumerSessions)) {\n this._consumerSessions[session.sessionId] = session;\n } else {\n session.close();\n }\n }\n }\n break;\n\n case SignallingServerMessageType.peer:\n {\n const session = this.getConsumerSession(msg.sessionId);\n if (session) {\n session.onSessionPeerMessage(msg);\n } else if (this._producerSession) {\n this._producerSession.onSessionPeerMessage(msg);\n }\n }\n break;\n\n case SignallingServerMessageType.startSession:\n if (this._producerSession) {\n this._producerSession.onStartSessionMessage(msg);\n }\n break;\n\n case SignallingServerMessageType.endSession:\n {\n const session = this.getConsumerSession(msg.sessionId);\n if (session) {\n session.close();\n } else if (this._producerSession) {\n this._producerSession.onEndSessionMessage(msg);\n }\n }\n break;\n\n case SignallingServerMessageType.error:\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"error received from signaling server\",\n error: new Error(msg.details)\n }));\n break;\n\n default:\n throw new Error(`unknown message type: \"${msg.type}\"`);\n }\n }\n } catch (ex) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot parse incoming message from signaling server\",\n error: ex\n }));\n }\n };\n }\n\n get meta() {\n return this._meta;\n }\n\n get webrtcConfig() {\n return this._webrtcConfig;\n }\n\n get ready() {\n return this._ready;\n }\n\n get channelId() {\n return this._channelId;\n }\n\n get producerSession() {\n return this._producerSession;\n }\n\n createProducerSession(stream, consumerId) {\n if (!this._ready || !(stream instanceof MediaStream)) {\n return null;\n }\n\n if (this._producerSession) {\n if (this._producerSession.stream === stream) {\n return this._producerSession;\n } else {\n return null;\n }\n }\n\n const session = new ProducerSession(this, stream, consumerId);\n this._producerSession = session;\n\n session.addEventListener(\"closed\", () => {\n if (this._producerSession === session) {\n this._producerSession = null;\n }\n });\n\n return session;\n }\n\n createConsumerSession(producerId, offerOptions) {\n if (!this._ready || !producerId || (typeof (producerId) !== \"string\")) {\n return null;\n }\n\n if (offerOptions && (typeof(offerOptions) !== \"object\")) {\n offerOptions = undefined;\n }\n\n if (producerId in this._consumerSessions) {\n return this._consumerSessions[producerId];\n }\n\n for (const session of Object.values(this._consumerSessions)) {\n if (session.peerId === producerId) {\n return session;\n }\n }\n\n const session = new ConsumerSession(producerId, this, offerOptions);\n this._consumerSessions[producerId] = session;\n\n session.addEventListener(\"closed\", (event) => {\n let sessionId = event.target.sessionId;\n if (!sessionId) {\n sessionId = event.target.peerId;\n }\n\n if ((sessionId in this._consumerSessions) && (this._consumerSessions[sessionId] === session)) {\n delete this._consumerSessions[sessionId];\n }\n });\n\n return session;\n }\n\n getConsumerSession(sessionId) {\n if (sessionId in this._consumerSessions) {\n return this._consumerSessions[sessionId];\n } else {\n return null;\n }\n }\n\n closeAllConsumerSessions() {\n for (const session of Object.values(this._consumerSessions)) {\n session.close();\n }\n\n this._consumerSessions = {};\n }\n\n send(data) {\n if (this._ready && data && (typeof (data) === \"object\")) {\n try {\n this._ws.send(JSON.stringify(data));\n return true;\n } catch (ex) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot send message to signaling server\",\n error: ex\n }));\n }\n }\n\n return false;\n }\n\n close() {\n if (this._ws) {\n this._ready = false;\n this._channelId = \"\";\n this._ws.close();\n\n this.closeAllConsumerSessions();\n\n if (this._producerSession) {\n this._producerSession.close();\n this._producerSession = null;\n }\n }\n }\n\n clearPeers(role) {\n for (const peerId in this._peers) {\n if (this._peers[peerId].includes(role)) {\n delete this._peers[peerId];\n this.dispatchEvent(new CustomEvent(\"peerRemoved\", { detail: { peerId, role } }));\n }\n }\n }\n\n addPeers(items, role) {\n items.forEach(item => {\n const peer = normalizePeer(item, this._channelId);\n if (peer) {\n this._peers[peer.id] = [role];\n this.dispatchEvent(new CustomEvent(\"peerAdded\", { detail: { peer, role } }));\n }\n });\n };\n}\n\nexport default ComChannel;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport defaultConfig from \"./config.js\";\nimport ComChannel from \"./com-channel.js\";\nimport SessionState from \"./session-state.js\";\n\n/** @import ConsumerSession from \"./consumer-session.js\"; */\n/** @import ProducerSession from \"./producer-session.js\"; */\n/** @import GstWebRTCConfig from \"./config.js\"; */\n/** @import RTCOfferOptions from \"typescript/lib/lib.dom.js\"; */\n\nclass GstWebRTCAPI {\n /**\n * @class GstWebRTCAPI\n * @classdesc The API entry point that manages a WebRTC.\n * @constructor\n * @param {GstWebRTCConfig} [userConfig] - The user configuration. \n * Only the parameters different from the default ones need to be provided.\n */\n constructor(userConfig) {\n this._channel = null;\n this._producers = {};\n this._consumers = {};\n this._connectionListeners = [];\n this._peerListeners = [];\n\n const config = Object.assign({}, defaultConfig);\n if (userConfig && (typeof (userConfig) === \"object\")) {\n Object.assign(config, userConfig);\n }\n\n if (typeof (config.meta) !== \"object\") {\n config.meta = null;\n }\n\n this._config = config;\n this.connectChannel();\n }\n\n /**\n * @interface ConnectionListener\n */\n /**\n * Callback method called when this client connects to the WebRTC signaling server.\n * The callback implementation should not throw any exception.\n * @method ConnectionListener#connected\n * @abstract\n * @param {string} clientId - The unique identifier of this WebRTC client. This identifier is provided by the\n * signaling server to uniquely identify each connected peer.\n */\n /**\n * Callback method called when this client disconnects from the WebRTC signaling server.\n * The callback implementation should not throw any exception.\n * @method ConnectionListener#disconnected\n * @abstract\n */\n\n /**\n * Registers a connection listener that will be called each time the WebRTC API connects to or disconnects from the\n * signaling server.\n * @param {ConnectionListener} listener - The connection listener to register.\n * @returns {boolean} true in case of success (or if the listener was already registered), or false if the listener\n * doesn't implement all callback functions and cannot be registered.\n */\n registerConnectionListener(listener) {\n if (!listener || (typeof (listener) !== \"object\") ||\n (typeof (listener.connected) !== \"function\") ||\n (typeof (listener.disconnected) !== \"function\")) {\n return false;\n }\n\n if (!this._connectionListeners.includes(listener)) {\n this._connectionListeners.push(listener);\n }\n\n return true;\n }\n\n /**\n * Unregisters a connection listener. \n * The removed listener will never be called again and can be garbage collected.\n * @param {ConnectionListener} listener - The connection listener to unregister.\n * @returns {boolean} true if the listener is found and unregistered, or false if the listener was not previously\n * registered.\n */\n unregisterConnectionListener(listener) {\n const idx = this._connectionListeners.indexOf(listener);\n if (idx >= 0) {\n this._connectionListeners.splice(idx, 1);\n return true;\n }\n\n return false;\n }\n\n /**\n * Unregisters all previously registered connection listeners.\n */\n unregisterAllConnectionListeners() {\n this._connectionListeners = [];\n }\n\n /**\n * Creates a new producer session.\n *
You can only create one producer session at a time. \n * To request streaming from a new stream you will first need to close the previous producer session.
\n *
You can only request a producer session while you are connected to the signaling server. You can use the\n * {@link ConnectionListener} interface and {@link GstWebRTCAPI#registerConnectionListener} method to\n * listen to the connection state.
\n * @param {MediaStream} stream - The audio/video stream to offer as a producer through WebRTC.\n * @returns {ProducerSession} The created producer session or null in case of error. To start streaming,\n * you still need to call {@link ProducerSession#start} after adding on the returned session all the event\n * listeners you may need.\n */\n createProducerSession(stream) {\n if (this._channel) {\n return this._channel.createProducerSession(stream);\n }\n return null;\n }\n\n createProducerSessionForConsumer(stream, consumerId) {\n if (this._channel) {\n return this._channel.createProducerSession(stream, consumerId);\n }\n return null;\n }\n\n /**\n * Information about a remote peer registered by the signaling server.\n * @typedef {object} Peer\n * @readonly\n * @property {string} id - The unique peer identifier set by the signaling server (always non-empty).\n * @property {object} meta - Free-form object containing extra information about the peer (always non-null,\n * but may be empty). Its content depends on your application.\n */\n\n /**\n * Gets the list of all remote WebRTC producers available on the signaling server.\n *
The remote producers list is only populated once you've connected to the signaling server. You can use the\n * {@link ConnectionListener} interface and {@link GstWebRTCAPI#registerConnectionListener} method to\n * listen to the connection state.
\n * @returns {Peer[]} The list of remote WebRTC producers available.\n */\n getAvailableProducers() {\n return Object.values(this._producers);\n }\n\n /**\n * Gets the list of all remote WebRTC consumers available on the signaling server.\n *
The remote consumer list is only populated once you've connected to the signaling server. You can use the\n * {@link ConnectionListener} interface and {@link GstWebRTCAPI#registerConnectionListener} method to\n * listen to the connection state.
\n * @returns {Peer[]} The list of remote WebRTC consumers available.\n */\n getAvailableConsumers() {\n return Object.values(this._consumers);\n }\n\n /**\n * @interface PeerListener\n */\n /**\n * Callback method called when a remote producer is added on the signaling server.\n * The callback implementation should not throw any exception.\n * @method PeerListener#producerAdded\n * @abstract\n * @param {Peer} producer - The remote producer added on server-side.\n */\n /**\n * Callback method called when a remote producer is removed from the signaling server.\n * The callback implementation should not throw any exception.\n * @method PeerListener#producerRemoved\n * @abstract\n * @param {Peer} producer - The remote producer removed on server-side.\n */\n /**\n * Callback method called when a remote consumer is added on the signaling server.\n * The callback implementation should not throw any exception.\n * @method PeerListener#consumerAdded\n * @abstract\n * @param {Peer} consumer - The remote consumer added on server-side.\n * */\n /**\n * Callback method called when a remote consumer is removed from the signaling server.\n * The callback implementation should not throw any exception.\n * @method PeerListener#consumerRemoved\n * @abstract\n * @param {Peer} consumer - The remote consumer removed on server-side.\n * */\n\n /**\n * Registers a listener that will be called each time a peer is added or removed on the signaling server.\n * The listener can implement all or only some of the callback methods.\n * @param {PeerListener} listener - The peer listener to register.\n * @returns {boolean} true in case of success (or if the listener was already registered), or false if the listener\n * doesn't implement any methods from PeerListener and cannot be registered.\n */\n registerPeerListener(listener) {\n // refuse if no methods from PeerListener are implemented\n if (!listener || (typeof (listener) !== \"object\") ||\n ((typeof (listener.producerAdded) !== \"function\") &&\n (typeof (listener.producerRemoved) !== \"function\") &&\n (typeof (listener.consumerAdded) !== \"function\") &&\n (typeof (listener.consumerRemoved) !== \"function\"))) {\n return false;\n }\n\n if (!this._peerListeners.includes(listener)) {\n this._peerListeners.push(listener);\n }\n\n return true;\n }\n\n /**\n * Unregisters a peer listener. \n * The removed listener will never be called again and can be garbage collected.\n * @param {PeerListener} listener - The peer listener to unregister.\n * @returns {boolean} true if the listener is found and unregistered, or false if the listener was not previously\n * registered.\n */\n unregisterPeerListener(listener) {\n const idx = this._peerListeners.indexOf(listener);\n if (idx >= 0) {\n this._peerListeners.splice(idx, 1);\n return true;\n }\n\n return false;\n }\n\n /**\n * Unregisters all previously registered peer listeners.\n */\n unregisterAllPeerListeners() {\n this._peerListeners = [];\n }\n\n /**\n * Creates a consumer session by connecting the local client to a remote WebRTC producer.\n *
You can only create one consumer session per remote producer.
\n *
You can only request a new consumer session while you are connected to the signaling server. You can use the\n * {@link ConnectionListener} interface and {@link GstWebRTCAPI#registerConnectionListener} method to\n * listen to the connection state.
\n * @param {string} producerId - The unique identifier of the remote producer to connect to.\n * @returns {ConsumerSession} The WebRTC session between the selected remote producer and this local\n * consumer, or null in case of error. To start connecting and receiving the remote streams, you still need to call\n * {@link ConsumerSession#connect} after adding on the returned session all the event listeners you may\n * need.\n */\n createConsumerSession(producerId) {\n if (this._channel) {\n return this._channel.createConsumerSession(producerId);\n }\n return null;\n }\n\n /**\n * Creates a consumer session by connecting the local client to a remote WebRTC producer and creating the offer.\n *
See {@link GstWebRTCAPI#createConsumerSession} for more information
\n * @param {string} producerId - The unique identifier of the remote producer to connect to.\n * @param {RTCOfferOptions} offerOptions - An object to use when creating the offer.\n * @returns {ConsumerSession} The WebRTC session between the selected remote producer and this local\n * consumer, or null in case of error. To start connecting and receiving the remote streams, you still need to call\n * {@link ConsumerSession#connect} after adding on the returned session all the event listeners you may\n * need.\n */\n createConsumerSessionWithOfferOptions(producerId, offerOptions) {\n if (this._channel) {\n return this._channel.createConsumerSession(producerId, offerOptions);\n }\n return null;\n }\n\n connectChannel() {\n if (this._channel) {\n const oldChannel = this._channel;\n this._channel = null;\n oldChannel.close();\n for (const key in this._producers) {\n this.triggerProducerRemoved(key);\n }\n for (const key in this._consumers) {\n this.triggerConsumerRemoved(key);\n }\n this._producers = {};\n this._consumers = {};\n this.triggerDisconnected();\n }\n\n this._channel = new ComChannel(\n this._config.signalingServerUrl,\n this._config.meta,\n this._config.webrtcConfig\n );\n\n this._channel.addEventListener(\"error\", (event) => {\n if (event.target === this._channel) {\n console.error(event.message, event.error);\n }\n });\n\n this._channel.addEventListener(\"closed\", (event) => {\n if (event.target !== this._channel) {\n return;\n }\n this._channel = null;\n for (const key in this._producers) {\n this.triggerProducerRemoved(key);\n }\n for (const key in this._consumers) {\n this.triggerConsumerRemoved(key);\n }\n this._producers = {};\n this._consumers = {};\n this.triggerDisconnected();\n if (this._config.reconnectionTimeout > 0) {\n window.setTimeout(() => {\n this.connectChannel();\n }, this._config.reconnectionTimeout);\n }\n });\n\n this._channel.addEventListener(\"ready\", (event) => {\n if (event.target === this._channel) {\n this.triggerConnected(this._channel.channelId);\n }\n });\n\n this._channel.addEventListener(\"peerAdded\", (event) => {\n if (event.target !== this._channel) {\n return;\n }\n\n if (event.detail.role === \"producer\") {\n this.triggerProducerAdded(event.detail.peer);\n } else {\n this.triggerConsumerAdded(event.detail.peer);\n }\n });\n\n this._channel.addEventListener(\"peerRemoved\", (event) => {\n if (event.target !== this._channel) {\n return;\n }\n\n if (event.detail.role === \"producer\") {\n this.triggerProducerRemoved(event.detail.peerId);\n } else {\n this.triggerConsumerRemoved(event.detail.peerId);\n }\n });\n }\n\n triggerConnected(clientId) {\n for (const listener of this._connectionListeners) {\n try {\n listener.connected(clientId);\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n\n triggerDisconnected() {\n for (const listener of this._connectionListeners) {\n try {\n listener.disconnected();\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n\n triggerProducerAdded(producer) {\n if (producer.id in this._producers) {\n return;\n }\n\n this._producers[producer.id] = producer;\n for (const listener of this._peerListeners) {\n if (!listener.producerAdded) {\n continue;\n }\n\n try {\n listener.producerAdded(producer);\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n\n triggerProducerRemoved(producerId) {\n if (!(producerId in this._producers)) {\n return;\n }\n\n const producer = this._producers[producerId];\n delete this._producers[producerId];\n\n for (const listener of this._peerListeners) {\n if (!listener.producerRemoved) {\n continue;\n }\n\n try {\n listener.producerRemoved(producer);\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n\n triggerConsumerAdded(consumer) {\n if (consumer.id in this._consumers) {\n return;\n }\n\n this._consumers[consumer.id] = consumer;\n for (const listener of this._peerListeners) {\n if (!listener.consumerAdded) {\n continue;\n }\n\n try {\n listener.consumerAdded(consumer);\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n\n triggerConsumerRemoved(consumerId) {\n if (!(consumerId in this._consumers)) {\n return;\n }\n\n const consumer = this._consumers[consumerId];\n delete this._consumers[consumerId];\n\n for (const listener of this._peerListeners) {\n if (!listener.consumerRemoved) {\n continue;\n }\n\n try {\n listener.consumerRemoved(consumer);\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n}\n\nGstWebRTCAPI.SessionState = SessionState;\n\nexport default GstWebRTCAPI;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport \"webrtc-adapter\";\nimport GstWebRTCAPI from \"./gstwebrtc-api.js\";\n\n/**\n * @external MediaStream\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MediaStream\n */\n/**\n * @external RTCPeerConnection\n * @see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection\n */\n/**\n * @external RTCDataChannel\n * @see https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel\n */\n/**\n * @external RTCOfferOptions\n * @see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createOffer#options\n */\n/**\n * @external EventTarget\n * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget\n */\n/**\n * @external Event\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Event\n */\n/**\n * @external ErrorEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent\n */\n/**\n * @external CustomEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent\n */\n/**\n * @external Error\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\n */\n/**\n * @external HTMLVideoElement\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement\n */\n\nif (!window.GstWebRTCAPI) {\n window.GstWebRTCAPI = GstWebRTCAPI;\n}\n\nexport default GstWebRTCAPI;\n"],"names":["SDPUtils","Math","random","toString","substring","localCName","generateIdentifier","splitLines","blob","trim","split","map","line","splitSections","part","index","getDescription","sections","getMediaSections","shift","matchPrefix","prefix","filter","indexOf","parseCandidate","parts","candidate","foundation","component","protocol","toLowerCase","priority","parseInt","ip","address","port","type","i","length","relatedAddress","relatedPort","tcpType","ufrag","usernameFragment","undefined","writeCandidate","sdp","push","toUpperCase","join","parseIceOptions","parseRtpMap","parsed","payloadType","name","clockRate","channels","numChannels","writeRtpMap","codec","pt","preferredPayloadType","parseExtmap","id","direction","uri","attributes","slice","writeExtmap","headerExtension","preferredId","parseFmtp","kv","j","writeFmtp","parameters","Object","keys","params","forEach","param","parseRtcpFb","parameter","writeRtcpFb","lines","rtcpFeedback","fb","parseSsrcMedia","sp","ssrc","colon","attribute","value","parseSsrcGroup","semantics","ssrcs","getMid","mediaSection","mid","parseFingerprint","algorithm","getDtlsParameters","sessionpart","role","fingerprints","writeDtlsParameters","setupType","fp","parseCryptoLine","tag","cryptoSuite","keyParams","sessionParams","writeCryptoLine","writeCryptoKeyParams","parseCryptoKeyParams","keyMethod","keySalt","lifeTime","mkiValue","mkiLength","getCryptoParameters","getIceParameters","pwd","password","writeIceParameters","iceLite","parseRtpParameters","description","codecs","headerExtensions","fecMechanisms","rtcp","mline","profile","rtpmapline","fmtps","wildcardRtcpFb","find","existingFeedback","writeRtpDescription","kind","caps","maxptime","extension","parseRtpEncodingParameters","encodingParameters","hasRed","hasUlpfec","primarySsrc","secondarySsrc","flows","apt","encParam","codecPayloadType","rtx","JSON","parse","stringify","fec","mechanism","bandwidth","maxBitrate","parseRtcpParameters","rtcpParameters","remoteSsrc","obj","cname","rsize","reducedSize","compound","mux","writeRtcpParameters","parseMsid","spec","stream","track","planB","msidParts","parseSctpDescription","parseMLine","maxSizeLine","maxMessageSize","isNaN","sctpPort","fmt","sctpMapLines","writeSctpDescription","media","sctp","output","generateSessionId","substr","writeSessionBoilerplate","sessId","sessVer","sessUser","sessionId","version","getDirection","getKind","isRejected","parseOLine","username","sessionVersion","netType","addressType","isValidSDP","charAt","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","logDisabled_","deprecationWarnings_","extractVersion","uastring","expr","pos","match","wrapPeerConnectionEvent","window","eventNameToWrap","wrapper","RTCPeerConnection","proto","nativeAddEventListener","addEventListener","nativeEventName","cb","apply","this","arguments","wrappedCallback","e","modifiedEvent","handleEvent","_eventMap","Map","set","nativeRemoveEventListener","removeEventListener","has","unwrappedCb","delete","size","configurable","disableLog","bool","Error","disableWarnings","log","console","deprecated","oldMethod","newMethod","warn","isObject","val","compactObject","data","reduce","accumulator","isObj","isEmptyObject","assign","walkStats","stats","base","resultSet","endsWith","filterStats","result","outbound","streamStatsType","filteredResult","trackStats","trackIdentifier","trackStat","trackId","logging","shimGetUserMedia","browserDetails","navigator","mediaDevices","constraintsToChrome_","c","mandatory","optional","cc","ideal","exact","min","max","oldname_","oc","mix","advanced","concat","shimConstraints_","constraints","func","audio","remap","b","video","face","facingMode","getSupportedFacingModeLies","getSupportedConstraints","matches","enumerateDevices","then","devices","dev","some","label","includes","deviceId","shimError_","PermissionDeniedError","PermissionDismissedError","InvalidStateError","DevicesNotFoundError","ConstraintNotSatisfiedError","TrackStartError","MediaDeviceFailedDueToShutdown","MediaDeviceKillSwitchOn","TabCaptureError","ScreenCaptureError","DeviceCaptureError","message","constraint","constraintName","getUserMedia","onSuccess","onError","webkitGetUserMedia","bind","origGetUserMedia","cs","getAudioTracks","getVideoTracks","getTracks","stop","DOMException","Promise","reject","shimGetDisplayMedia","getSourceId","getDisplayMedia","sourceId","widthSpecified","width","heightSpecified","height","frameRateSpecified","frameRate","chromeMediaSource","chromeMediaSourceId","maxFrameRate","maxWidth","maxHeight","error","shimMediaStream","MediaStream","webkitMediaStream","shimOnTrack","_ontrack","f","origSetRemoteDescription","setRemoteDescription","_ontrackpoly","te","receiver","getReceivers","event","Event","transceiver","streams","dispatchEvent","shimGetSendersWithDtmf","shimSenderWithDtmf","pc","dtmf","_dtmf","createDTMFSender","_pc","getSenders","_senders","origAddTrack","addTrack","sender","origRemoveTrack","removeTrack","idx","splice","origAddStream","addStream","origRemoveStream","removeStream","s","RTCRtpSender","origGetSenders","senders","shimGetStats","origGetStats","getStats","selector","onSucc","onErr","fixChromeStats_","response","standardReport","report","standardStats","timestamp","localcandidate","remotecandidate","names","stat","makeMapStats","successCallbackWrapper_","resolve","shimSenderReceiverGetStats","RTCRtpReceiver","origGetReceivers","receivers","srcElement","MediaStreamTrack","err","shimAddTrackRemoveTrackWithNative","getLocalStreams","_shimmedLocalStreams","streamId","existingSenders","newSenders","newSender","shimAddTrackRemoveTrack","origGetLocalStreams","nativeStreams","_reverseStreams","_streams","newStream","replaceInternalStreamId","internalId","externalStream","internalStream","replace","RegExp","RTCSessionDescription","signalingState","t","oldStream","method","nativeMethod","methodObj","args","desc","origSetLocalDescription","setLocalDescription","replaceExternalStreamId","origLocalDescription","getOwnPropertyDescriptor","streamid","shimPeerConnection","webkitRTCPeerConnection","RTCIceCandidate","fixNegotiationNeeded","target","getConfiguration","sdpSemantics","nativeGetUserMedia","getSettings","nativeGetSettings","applyConstraints","nativeApplyConstraints","preferredMediaSource","code","mediaSource","RTCTrackEvent","mozRTCPeerConnection","modernStatsTypes","inboundrtp","outboundrtp","candidatepair","nativeGetStats","shimSenderGetStats","shimReceiverGetStats","shimRemoveStream","shimRTCDataChannel","DataChannel","RTCDataChannel","shimAddTransceiver","origAddTransceiver","addTransceiver","setParametersPromises","sendEncodings","shouldPerformCheck","encodingParam","test","rid","TypeError","parseFloat","scaleResolutionDownBy","RangeError","maxFramerate","getParameters","encodings","setParameters","catch","shimGetParameters","origGetParameters","shimCreateOffer","origCreateOffer","createOffer","all","finally","shimCreateAnswer","origCreateAnswer","createAnswer","shimLocalStreamsAPI","_localStreams","_addTrack","tracks","shimRemoteStreamsAPI","getRemoteStreams","_remoteStreams","_onaddstream","_onaddstreampoly","shimCallbacksAPI","addIceCandidate","successCallback","failureCallback","options","promise","withCallback","_getUserMedia","shimConstraints","errcb","shimRTCIceServerUrls","OrigPeerConnection","pcConfig","pcConstraints","iceServers","newIceServers","server","urls","url","generateCertificate","shimTrackEventTransceiver","shimCreateOfferLegacy","offerOptions","offerToReceiveAudio","audioTransceiver","getTransceivers","setDirection","offerToReceiveVideo","videoTransceiver","shimAudioContext","AudioContext","webkitAudioContext","shimRTCIceCandidate","NativeRTCIceCandidate","nativeCandidate","parsedCandidate","toJSON","sdpMid","sdpMLineIndex","writable","shimRTCIceCandidateRelayProtocol","relayProtocol","shimMaxMessageSize","_sctp","browser","mLine","sctpInDescription","isFirefox","getRemoteFirefoxVersion","canSendMMS","remoteIsFirefox","canSendMaxMessageSize","getCanSendMaxMessageSize","remoteMMS","getMaxMessageSize","Number","POSITIVE_INFINITY","shimSendThrowTypeError","wrapDcSend","dc","origDataChannelSend","send","byteLength","readyState","origCreateDataChannel","createDataChannel","dataChannel","channel","shimConnectionState","completed","checking","iceConnectionState","_onconnectionstatechange","origMethod","_connectionstatechangepoly","_lastConnectionState","connectionState","newEvent","removeExtmapAllowMixed","nativeSRD","shimAddIceCandidateNullOrEmpty","nativeAddIceCandidate","shimParameterlessSetLocalDescription","nativeSetLocalDescription","shimChrome","shimFirefox","shimSafari","userAgent","mozGetUserMedia","isSecureContext","supportsUnifiedPlan","RTCRtpTransceiver","adapter","commonShim","browserShim","adapterFactory","freeze","meta","signalingServerUrl","reconnectionTimeout","webrtcConfig","bundlePolicy","SessionState","idle","connecting","streaming","closed","WebRTCSession","EventTarget","constructor","peerId","comChannel","super","_peerId","_sessionId","_comChannel","_state","_rtcPeerConnection","state","rtcPeerConnection","close","uniToKeySyms","kbEventCodesToKeySyms","knownKbEventCodes","Set","getKeysymString","keySym","keyCodeUni","charCodeAt","eventsNames","mouseEventsNames","mousemove","mousedown","mouseup","touchEventsNames","touchstart","touchend","touchmove","touchcancel","keyboardEventsNames","keydown","keyup","getModifiers","modifiers","altKey","ctrlKey","metaKey","shiftKey","RemoteController","rtcDataChannel","consumerSession","_rtcDataChannel","_consumerSession","_videoElement","_videoElementComputedStyle","_videoElementKeyboard","_lastTouchEventTimestamp","_requestCounter","ErrorEvent","msg","CustomEvent","detail","ex","videoElement","attachVideoElement","element","HTMLVideoElement","getComputedStyle","eventName","setAttribute","previousElement","removeAttribute","sendControlRequest","request","_sendGstNavigationEvent","_computeVideoMousePosition","mousePos","x","y","videoWidth","videoHeight","padding","paddingLeft","paddingRight","paddingTop","paddingBottom","offsetX","offsetY","clientRect","getBoundingClientRect","border","left","borderLeftWidth","top","borderTopWidth","clientX","clientY","videoOffset","clientWidth","clientHeight","ratio","invRatio","preventDefault","delta_x","deltaX","delta_y","deltaY","modifier_state","button","focus","touch","changedTouches","identifier","pressure","force","timeStamp","_remoteController","_pendingCandidates","_mungeStereoHack","_offerOptions","mungeStereoHack","enable","remoteController","connect","ensurePeerConnection","offer","localDescription","onSessionStarted","ice","connection","ontrack","streamsChanged","ondatachannel","previousController","onicecandidate","mungeStereo","offerSdp","answerSdp","stereoRegexp","stereoPayloads","m","matchAll","payloadMatch","add","payload","isStereoRegexp","replaceAll","onSessionPeerMessage","ClientSession","ProducerSession","consumerId","_stream","_clientSessions","_consumerId","start","roles","clientSession","values","onProducerRegistered","onStartSessionMessage","session","onEndSessionMessage","SignallingServerMessageType","welcome","peerStatusChanged","list","listConsumers","sessionStarted","peer","startSession","endSession","normalizePeer","excludedId","normalizedPeer","ComChannel","_meta","_webrtcConfig","_ws","WebSocket","_ready","_channelId","_producerSession","_consumerSessions","_peers","onerror","onclose","closeAllConsumerSessions","onmessage","oldRoles","clearPeers","addPeers","producers","consumers","getConsumerSession","details","ready","channelId","producerSession","createProducerSession","createConsumerSession","producerId","items","item","userConfig","_channel","_producers","_consumers","_connectionListeners","_peerListeners","config","_config","connectChannel","registerConnectionListener","listener","unregisterConnectionListener","unregisterAllConnectionListeners","createProducerSessionForConsumer","getAvailableProducers","getAvailableConsumers","registerPeerListener","unregisterPeerListener","unregisterAllPeerListeners","createConsumerSessionWithOfferOptions","oldChannel","triggerProducerRemoved","triggerConsumerRemoved","triggerDisconnected","setTimeout","triggerConnected","triggerProducerAdded","triggerConsumerAdded","clientId","connected","disconnected","producer","producerAdded","producerRemoved","consumer","consumerAdded","consumerRemoved","GstWebRTCAPI"],"sourceRoot":""}
\ No newline at end of file
diff --git a/web/javascript/webrtc/index.html b/web/javascript/webrtc/index.html
new file mode 100644
index 0000000..a6d23f9
--- /dev/null
+++ b/web/javascript/webrtc/index.html
@@ -0,0 +1,556 @@
+
+
+
+
+
+ GstWebRTC API
+
+
+
+
+
+