From 4466b20e7bf3d4a11571008ddd439df0bf4ab47d Mon Sep 17 00:00:00 2001 From: Fabien Lavocat <4154532+FabienLavocat@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:46:39 -0700 Subject: [PATCH] Set simulcast only when video track is available. Add audio example. --- example/README.md | 2 +- example/audio.html | 185 ++++++++++++++++++ package-lock.json | 6 +- package.json | 2 +- packages/sdk-interactivity/package.json | 2 +- .../sdk-interactivity/src/publishedSource.ts | 8 +- 6 files changed, 197 insertions(+), 8 deletions(-) create mode 100644 example/audio.html diff --git a/example/README.md b/example/README.md index c68bf0e..0f0d350 100644 --- a/example/README.md +++ b/example/README.md @@ -1,6 +1,6 @@ # Dolby.io - Millicast Interactivity SDK - Example -This [index.html](index.html) file in this folder contains a very basic example of application using the _Dolby Millicast Interactivity SDK_, to run a bi-directional conversation in between participants. +This [index.html](index.html) file in this folder contains a very basic example of application using the _Dolby Millicast Interactivity SDK_, to run a bi-directional conversation in between participants. Use the [audio.html](audio.html) for an audio only experience. To run the application, either upload it on a web server with SSL enabled (Only HTTPS is allowed for a Web RTC application to work) or run a local web server. Here is how to run it using Python: diff --git a/example/audio.html b/example/audio.html new file mode 100644 index 0000000..e691050 --- /dev/null +++ b/example/audio.html @@ -0,0 +1,185 @@ + + + Dolby Millicast - Interactivity + + + + + + + +
+
+

Dolby Millicast - Interactivity

+ + GitHub repository + +
+
+
+
+
+
+
+ + / + +
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+ Me + Leave +
+
+
+
+
+
+
+ + + + diff --git a/package-lock.json b/package-lock.json index 3788f5c..ef60e15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "sdk-interactivity", - "version": "0.1.1", + "version": "0.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "sdk-interactivity", - "version": "0.1.1", + "version": "0.1.2", "license": "Millicast", "workspaces": [ "packages/*" @@ -5531,7 +5531,7 @@ }, "packages/sdk-interactivity": { "name": "@millicast/sdk-interactivity", - "version": "0.1.1", + "version": "0.1.2", "license": "Millicast", "dependencies": { "@millicast/sdk": "^0.1.46", diff --git a/package.json b/package.json index 5595f25..06d2985 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sdk-interactivity", - "version": "0.1.1", + "version": "0.1.2", "private": true, "workspaces": [ "packages/*" diff --git a/packages/sdk-interactivity/package.json b/packages/sdk-interactivity/package.json index d5a6d2a..7aa3b83 100644 --- a/packages/sdk-interactivity/package.json +++ b/packages/sdk-interactivity/package.json @@ -1,6 +1,6 @@ { "name": "@millicast/sdk-interactivity", - "version": "0.1.1", + "version": "0.1.2", "description": "Dolby Millicast Interactivity SDK", "main": "dist/millicast-sdk-interactivity.js", "scripts": { diff --git a/packages/sdk-interactivity/src/publishedSource.ts b/packages/sdk-interactivity/src/publishedSource.ts index 83cea42..6de7af4 100644 --- a/packages/sdk-interactivity/src/publishedSource.ts +++ b/packages/sdk-interactivity/src/publishedSource.ts @@ -80,14 +80,18 @@ export class PublishedSource { this.#audioTrack = firstOrUndefined(mediaStream.getAudioTracks()); } + let simulcast: boolean = false; const tracks: MediaStreamTrack[] = []; - if (this.#videoTrack) tracks.push(this.#videoTrack); + if (this.#videoTrack) { + simulcast = true; + tracks.push(this.#videoTrack) + }; if (this.#audioTrack) tracks.push(this.#audioTrack); await this.#publisher.connect({ mediaStream: tracks, sourceId: this.#sourceId.sourceId, - simulcast: true, + simulcast: simulcast, }); };