Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed js-logger dependency #7

Merged
merged 3 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

Expand All @@ -25,7 +25,7 @@ jobs:
npm run build
npm pack
- name: Upload artifact 🗄️
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: npm-package
path: ./*.tgz
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

Expand Down
66 changes: 33 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,28 +87,31 @@ collection.on('error', (error) => {

### Examples

#### Dolby.io Communications APIs
#### Dolby.io Real-time Streaming APIs

Example on how to start a statistics collection from the [Dolby.io Communications APIs](https://docs.dolby.io/communications-apis/docs).
Example on how to start a statistics collection from the [Dolby.io Real-time Streaming APIs](https://docs.dolby.io/streaming-apis/docs).

```js
import WebRTCStats from '@dolbyio/webrtc-stats';
import VoxeetSdk from '@voxeet/voxeet-web-sdk';
import { Director, Publish } from '@millicast/sdk';

const PUBLISHER_TOKEN = '';
const STREAM_NAME = '';

const tokenGenerator = () =>
Director.getPublisher({
token: PUBLISHER_TOKEN,
streamName: STREAM_NAME,
});

const publisher = new Publish(STREAM_NAME, tokenGenerator);

// Publish the stream

const collection = new WebRTCStats({
getStatsInterval: 1000,
getStats: async () => {
// See: https://docs.dolby.io/communications-apis/docs/js-client-sdk-conferenceservice#localstats
const webRTCStats = await VoxeetSDK.conference.localStats();

// Convert the WebRTCStats object to RTCStatsReport
const values = Array.from(webRTCStats.values())[0];
const map = new Map();
for (let i = 0; i < values.length; i++) {
const element = values[i];
map.set(element.id, element);
}
return map;
getStats: () => {
return publisher.webRTCPeer.getRTCPeer().getStats();
},
});

Expand All @@ -122,31 +125,28 @@ collection.on('stats', (event) => {
collection.start();
```

#### Dolby.io Real-time Streaming APIs
#### Dolby.io Communications APIs

Example on how to start a statistics collection from the [Dolby.io Real-time Streaming APIs](https://docs.dolby.io/streaming-apis/docs).
Example on how to start a statistics collection from the [Dolby.io Communications APIs](https://docs.dolby.io/communications-apis/docs).

```js
import WebRTCStats from '@dolbyio/webrtc-stats';
import { Director, Publish } from '@millicast/sdk';

const PUBLISHER_TOKEN = '';
const STREAM_NAME = '';

const tokenGenerator = () =>
Director.getPublisher({
token: PUBLISHER_TOKEN,
streamName: STREAM_NAME,
});

const publisher = new Publish(STREAM_NAME, tokenGenerator);

// Publish the stream
import VoxeetSdk from '@voxeet/voxeet-web-sdk';

const collection = new WebRTCStats({
getStatsInterval: 1000,
getStats: () => {
return publisher.webRTCPeer.getRTCPeer().getStats();
getStats: async () => {
// See: https://docs.dolby.io/communications-apis/docs/js-client-sdk-conferenceservice#localstats
const webRTCStats = await VoxeetSDK.conference.localStats();

// Convert the WebRTCStats object to RTCStatsReport
const values = Array.from(webRTCStats.values())[0];
const map = new Map();
for (let i = 0; i < values.length; i++) {
const element = values[i];
map.set(element.id, element);
}
return map;
},
});

Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
collectCoverage: true,
Expand Down
Loading
Loading