Skip to content

Commit

Permalink
Merge pull request #191 from millicast/develop
Browse files Browse the repository at this point in the history
Release v0.1.34
  • Loading branch information
fcancela authored Oct 17, 2022
2 parents 18f118c + bf90bb8 commit 0d64f7b
Show file tree
Hide file tree
Showing 20 changed files with 5,391 additions and 5,083 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
This Software Development Kit (SDK) for JavaScript allows developers to simplify Millicast services integration into their own web apps.

## Table of Contents
* [Installation](#installation)
* [Basic Usage](#basic-usage)
* [API Reference](#api-reference)
* [Samples](#samples)
* [SDK developer information](#sdk-developer-information)
* [License](#license)
- [Millicast SDK for JavaScript](#millicast-sdk-for-javascript)
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Publisher app](#publisher-app)
- [Viewer app](#viewer-app)
- [API Reference](#api-reference)
- [Samples](#samples)
- [SDK developer information](#sdk-developer-information)
- [License](#license)


## Installation
Expand All @@ -25,7 +29,7 @@ Or if you are building an application with Node.js, you can install the SDK pack


```sh
$ npm i --save @millicast/sdk
npm i --save @millicast/sdk
```

## Basic Usage
Expand Down
12 changes: 6 additions & 6 deletions developer-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ This project is built with [Lerna](https://lerna.js.org/) and contains the follo
## Development
Asumming that you have Node 12.10.x or newer and `npm` installed, install the required dependencies running:
```sh
$ npm ci
npm ci
```
### Building packages
As the project is built using [Lerna](https://lerna.js.org/), we can rely on it to manage our packages dependencies, so you just need to run at project's root directory
```sh
$ npm run prepare
npm run prepare
```

Next, to build all packages add a `.env` file in both demo packages (`millicast-publisher-demo`, `millicast-viewer-demo` & `millicast-chromecast-receiver`). You can find the following example in `.env.sample`:
Expand All @@ -28,26 +28,26 @@ MILLICAST_PUBLISH_TOKEN=test

Then, build all packages:
```sh
$ npm run build
npm run build
```

Optionally you can run other Lerna command using `npx lerna [command]`.

### Running demo
If you want to add, fix or edit features in SDK, or just try our demo pages, run:
```sh
$ npm run start
npm run start
```
It opens in your browser both demos and keep watching changes in all packages, so you only need to refresh both pages if you add changes in code.

### Building docs
The SDK documentation is written with [JSDcos](https://jsdoc.app/), so to build documentation to get HTMLs files run:
```sh
$ npx lerna run build-docs
npx lerna run build-docs
```

Or if you want to navigate docs in your localhost run:
```sh
$ npx lerna run start-docs --stream
npx lerna run start-docs --stream
```
In the logs you find the link where you can access to docs. By default is running at http://localhost:5000.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"packages": [
"packages/*"
],
"version": "0.0.0"
"version": "0.1.34"
}
2 changes: 1 addition & 1 deletion packages/millicast-chromecast-receiver/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (process.env.ROLLUP_WATCH) {
serve({
open: true,
contentBase: 'dist',
port: 10002
port: 10004
})
]
}
Expand Down
6 changes: 6 additions & 0 deletions packages/millicast-publisher-demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ MILLICAST_STREAM_NAME=yourStreamName
MILLICAST_ACCOUNT_ID=yourAccountId
MILLICAST_PUBLISH_TOKEN=yourPublishToken
```

Install all dependencies using:
```sh
npm ci
```

## Run
To start running this demo, the following command will publish the app at `http://localhost:10001` and enter in watching mode.
```sh
Expand Down
4 changes: 2 additions & 2 deletions packages/millicast-sdk/docs-translations/en/Director.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
"<p><em>Deprecated, use options parameter instead</em> Token to subscribe to secure streams. If you are subscribing to an unsecure stream, you can omit this param.</p>": "<p><em>Deprecated, use options parameter instead</em> Token to subscribe to secure streams. If you are subscribing to an unsecure stream, you can omit this param.</p>",
"<p>Promise object which represents the result of getting the subscribe connection data.</p>": "<p>Promise object which represents the result of getting the subscribe connection data.</p>",
"<p>Object which represents a list of Ice servers.</p>": "<p>Object which represents a list of Ice servers.</p>",
"<p>Simplify API calls to find the best server and region to publish and subscribe to.\nFor security reasosn all calls will return a <a href=\"https://jwt.io\">JWT</a> token forn authentication including the required\nsocket path to connect with.</p>\n<p>You will need your own Publishing token and Stream name, please refer to <a href=\"https://docs.millicast.com/docs/managing-your-tokens\">Managing Your Tokens</a>.</p>": "<p>Simplify API calls to find the best server and region to publish and subscribe to.\nFor security reasosn all calls will return a <a href=\"https://jwt.io\">JWT</a> token forn authentication including the required\nsocket path to connect with.</p>\n<p>You will need your own Publishing token and Stream name, please refer to <a href=\"https://docs.millicast.com/docs/managing-your-tokens\">Managing Your Tokens</a>.</p>"
}
"<p>Simplify API calls to find the best server and region to publish and subscribe to.\nFor security reasosn all calls will return a <a href=\"https://jwt.io\">JWT</a> token forn authentication including the required\nsocket path to connect with.</p>\n<p>You will need your own Publishing token and Stream name, please refer to <a href=\"https://docs.dolby.io/streaming-apis/docs/managing-your-tokens\">Managing Your Tokens</a>.</p>": "<p>Simplify API calls to find the best server and region to publish and subscribe to.\nFor security reasosn all calls will return a <a href=\"https://jwt.io\">JWT</a> token forn authentication including the required\nsocket path to connect with.</p>\n<p>You will need your own Publishing token and Stream name, please refer to <a href=\"https://docs.millicast.com/docs/managing-your-tokens\">Managing Your Tokens</a>.</p>"
}
4 changes: 3 additions & 1 deletion packages/millicast-sdk/docs-translations/en/Publish.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@
"<p>Initialize recording in an active stream.</p>": "<p>Initialize recording in an active stream.</p>",
"<p>Finalize recording in an active stream.</p>": "<p>Finalize recording in an active stream.</p>",
"<p>Manages connection with a secure WebSocket path to signal the Millicast server\nand establishes a WebRTC connection to broadcast a MediaStream.</p>\n<p>Before you can broadcast, you will need:</p>\n<ul>\n<li>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Media_Streams_API\">MediaStream</a> which has at most one audio track and at most one video track. This will be used for stream the contained tracks.</p>\n</li>\n<li>\n<p>A connection path that you can get from {@link Director} module or from your own implementation.</p>\n</li>\n</ul>": "<p>Manages connection with a secure WebSocket path to signal the Millicast server\nand establishes a WebRTC connection to broadcast a MediaStream.</p>\n<p>Before you can broadcast, you will need:</p>\n<ul>\n<li>\n<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Media_Streams_API\">MediaStream</a> which has at most one audio track and at most one video track. This will be used for stream the contained tracks.</p>\n</li>\n<li>\n<p>A connection path that you can get from {@link Director} module or from your own implementation.</p>\n</li>\n</ul>",
"<p>Specify which events will be delivered by the server (any of &quot;active&quot; | &quot;inactive&quot; | &quot;viewercount&quot;).*</p>": "<p>Specify which events will be delivered by the server (any of &quot;active&quot; | &quot;inactive&quot; | &quot;viewercount&quot;).*</p>"
"<p>Specify which events will be delivered by the server (any of &quot;active&quot; | &quot;inactive&quot; | &quot;viewercount&quot;).*</p>": "<p>Specify which events will be delivered by the server (any of &quot;active&quot; | &quot;inactive&quot; | &quot;viewercount&quot;).*</p>",
"<p>Initialize recording in an active stream and change the current record option.</p>": "<p>Initialize recording in an active stream and change the current record option.</p>",
"<p>Finalize recording in an active stream and change the current record option.</p>": "<p>Finalize recording in an active stream and change the current record option.</p>"
}
4 changes: 2 additions & 2 deletions packages/millicast-sdk/docs-translations/en/Signaling.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@
"<p>Override which events will be delivered by the server (&quot;active&quot; | &quot;inactive&quot; | &quot;vad&quot; | &quot;layers&quot;).</p>": "<p>Override which events will be delivered by the server (&quot;active&quot; | &quot;inactive&quot; | &quot;vad&quot; | &quot;layers&quot;).</p>",
"<p>Select the simulcast encoding layer and svc layers for the main video track, leave empty for automatic layer selection based on bandwidth estimation.</p>": "<p>Select the simulcast encoding layer and svc layers for the main video track, leave empty for automatic layer selection based on bandwidth estimation.</p>",
"<p>Override which events will be delivered by the server (&quot;active&quot; | &quot;inactive&quot;).</p>": "<p>Override which events will be delivered by the server (&quot;active&quot; | &quot;inactive&quot;).</p>",
"<p>Passthrough of available Millicast broadcast events.</p>\n<p>Active - Fires when the live stream is, or has started broadcasting.</p>\n<p>Inactive - Fires when the stream has stopped broadcasting, but is still available.</p>\n<p>Stopped - Fires when the live stream has been disconnected and is no longer available.</p>\n<p>Viewercount - Fires when the viewer count changes.</p>\n<p>More information here: {@link https://docs.millicast.com/docs/web-draft#broadcast-events}</p>": "<p>Passthrough of available Millicast broadcast events.</p>\n<p>Active - Fires when the live stream is, or has started broadcasting.</p>\n<p>Inactive - Fires when the stream has stopped broadcasting, but is still available.</p>\n<p>Stopped - Fires when the live stream has been disconnected and is no longer available.</p>\n<p>Viewercount - Fires when the viewer count changes.</p>\n<p>More information here: {@link https://docs.millicast.com/docs/web-draft#broadcast-events}</p>"
}
"<p>Passthrough of available Millicast broadcast events.</p>\n<p>Active - Fires when the live stream is, or has started broadcasting.</p>\n<p>Inactive - Fires when the stream has stopped broadcasting, but is still available.</p>\n<p>Stopped - Fires when the live stream has been disconnected and is no longer available.</p>\n<p>Viewercount - Fires when the viewer count changes.</p>\n<p>More information here: {@link https://docs.dolby.io/streaming-apis/docs/web#broadcast-events}</p>": "<p>Passthrough of available Millicast broadcast events.</p>\n<p>Active - Fires when the live stream is, or has started broadcasting.</p>\n<p>Inactive - Fires when the stream has stopped broadcasting, but is still available.</p>\n<p>Stopped - Fires when the live stream has been disconnected and is no longer available.</p>\n<p>Viewercount - Fires when the viewer count changes.</p>\n<p>More information here: {@link https://docs.dolby.io/streaming-apis/docs/web#broadcast-events}</p>"
}
2 changes: 1 addition & 1 deletion packages/millicast-sdk/package-lock.json

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

2 changes: 1 addition & 1 deletion packages/millicast-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@millicast/sdk",
"version": "0.1.33",
"version": "0.1.34",
"description": "SDK for building a realtime broadcaster using the Millicast platform.",
"keywords": [
"sdk",
Expand Down
14 changes: 11 additions & 3 deletions packages/millicast-sdk/src/Director.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ let apiEndpoint = defaultApiEndpoint
* For security reasosn all calls will return a [JWT](https://jwt.io) token forn authentication including the required
* socket path to connect with.
*
* You will need your own Publishing token and Stream name, please refer to [Managing Your Tokens](https://docs.millicast.com/docs/managing-your-tokens).
* You will need your own Publishing token and Stream name, please refer to [Managing Your Tokens](https://docs.dolby.io/streaming-apis/docs/managing-your-tokens).
* @namespace
*/

Expand Down Expand Up @@ -120,11 +120,15 @@ export default class Director {
try {
let data = await fetch(url, { method: 'POST', headers, body: JSON.stringify(payload) })
data = await data.json()
if (data.status === 'fail') {
const error = new Error(data.data.message)
throw error
}
data = parseIncomingDirectorResponse(data)
logger.debug('Getting publisher response: ', data)
return data.data
} catch (e) {
logger.error('Error while getting publisher connection path: ', e.response?.data)
logger.error('Error while getting publisher connection path. ', e)
throw e
}
}
Expand Down Expand Up @@ -175,11 +179,15 @@ export default class Director {
try {
let data = await fetch(url, { method: 'POST', headers, body: JSON.stringify(payload) })
data = await data.json()
if (data.status === 'fail') {
const error = new Error(data.data.message)
throw error
}
data = parseIncomingDirectorResponse(data)
logger.debug('Getting subscriber response: ', data)
return data.data
} catch (e) {
logger.error('Error while getting subscriber connection path: ', e.response?.data)
logger.error('Error while getting subscriber connection path. ', e)
throw e
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/millicast-sdk/src/Signaling.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default class Signaling extends EventEmitter {
*
* Viewercount - Fires when the viewer count changes.
*
* More information here: {@link https://docs.millicast.com/docs/web-draft#broadcast-events}
* More information here: {@link https://docs.dolby.io/streaming-apis/docs/web#broadcast-events}
*
* @event Signaling#broadcastEvent
* @type {Object}
Expand Down
2 changes: 1 addition & 1 deletion packages/millicast-sdk/src/utils/BaseWebRTC.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default class BaseWebRTC extends EventEmitter {
}
} catch (error) {
this.reconnectionInterval = nextReconnectInterval(this.reconnectionInterval)
logger.error(`Reconnection failed, retrying in ${this.reconnectionInterval}ms. Error was: `, error)
logger.error(`Reconnection failed, retrying in ${this.reconnectionInterval}ms. `, error)
/**
* Emits with every reconnection attempt made when an active stream
* stopped unexpectedly.
Expand Down
2 changes: 1 addition & 1 deletion packages/millicast-sdk/src/utils/SdpParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export default class SdpParser {
*/
static setMultiopus (sdp, mediaStream) {
const browserData = new UserAgent()
if (browserData.isChrome() && (!mediaStream || hasAudioMultichannel(mediaStream))) {
if (!browserData.isFirefox() && (!mediaStream || hasAudioMultichannel(mediaStream))) {
if (!sdp.includes('multiopus/48000/6')) {
logger.info('Setting multiopus')
// Find the audio m-line
Expand Down
2 changes: 1 addition & 1 deletion packages/millicast-sdk/tests/features/SdpMultiopus.feature
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Feature: As a user I want to set multiopus in my SDP so I can offer surround to
Scenario: Set multiopus in iOS Chrome
Given I have a sdp and I am using iOS Chrome
When I want to set multiopus
Then returns the sdp without multiopus
Then returns the sdp with multiopus updated

Scenario: Set multiopus in Firefox
Given I have a sdp and I am using Firefox
Expand Down

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

6 changes: 6 additions & 0 deletions packages/millicast-viewer-demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ Add a `.env` file in current path. You can find the following example in `.env.s
MILLICAST_STREAM_NAME=yourStreamName
MILLICAST_ACCOUNT_ID=yourAccountId
```

Install all dependencies using:
```sh
npm ci
```

## Run
To start running this demo, the following command will publish the app at `http://localhost:10002` and enter in watching mode.
```sh
Expand Down
8 changes: 7 additions & 1 deletion packages/millicast-webaudio-delay-demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ Add a `.env` file in current path. You can find the following example in `.env.s
MILLICAST_STREAM_NAME=yourStreamName
MILLICAST_ACCOUNT_ID=yourAccountId
```

Install all dependencies using:
```sh
npm ci
```

## Run
To start running this demo, the following command will publish the app at `http://localhost:10002` and enter in watching mode.
To start running this demo, the following command will publish the app at `http://localhost:10003` and enter in watching mode.
```sh
npm start
```
Loading

0 comments on commit 0d64f7b

Please sign in to comment.