
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@millicast/sdk-interactivity
Advanced tools
This project is an SDK built on top of the @millicast/sdk library to provide an easier way to manage bi-directional communications on the Dolby Millicast platform.
To get started, install this SDK into your web application. The @millicast/sdk library will be installed as a dependency.
npm install @millicast/sdk-interactivity
To import this SDK via script, you will need to load the SDK as UMD as well as the Millicast SDK. An example is provided in the example
folder of this repository.
<script src="https://cdn.jsdelivr.net/npm/@millicast/sdk/dist/millicast.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@millicast/sdk-interactivity/dist/millicast-sdk-interactivity.min.js"></script>
Then you can use the SDK using the variable MillicastInteractivity
.
The SDK can trigger the following events:
publisherJoined
- Event triggered when a new publisher starts publishing to the stream.publisherLeft
- Event triggered when a publisher stops publishing to the stream.sourceAdded
- Event triggered when a new source is being published to the stream.sourceRemoved
- Event triggered when a source stopped being published.viewercount
- Event triggered from time to time to indicate the number of viewers connected to the stream.import { Publisher, Room, Source } from '@millicast/sdk-interactivity';
const room = new Room({
streamName,
streamAccountId,
});
room.on('viewercount', (count: number) => console.log('Viewer count is', count));
room.on('sourceAdded', async (publisher: Publisher, source: Source) => {
const { sourceId } = source;
console.log(`New ${sourceId.sourceType} source: ${sourceId.sourceName}`);
console.log(`is available from ${publisher.name}.`);
// Request to receive the source
await source.receive();
// Display the source on the UI
const videoElement = document.getElementById('video');
videoElement.srcObject = new MediaStream([source.videoTrack]);
videoElement.play();
});
To publish your camera into a stream and listen to the available sources, call the connect
function. Once connected, the SDK will trigger a series of publisherJoined
and sourceAdded
events that you must subscribe to in order to get the audio / video streams coming from the platform, and display them on your web page.
import { Publisher, Room, Source } from '@millicast/sdk-interactivity';
const room = new Room({
streamName,
streamAccountId,
});
room.on('publisherJoined', (publisher: Publisher) => {
console.log(`${publisher.name} joined.`);
});
room.on('sourceAdded', (publisher: Publisher, source: Source) => {
const { sourceId } = source;
console.log(`New ${sourceId.sourceType} source: ${sourceId.sourceName}`);
console.log(`is available from ${publisher.name}.`);
});
// Let the SDK handle the getUserMedia
const publishedSource = await room.connect({
publishToken,
publisherName,
constraints: {
// Set WebRTC Media Stream constraints
audio: true,
video: true,
},
});
// If you want to provide your own media stream, use the following code
const customPublishedSource = await room.connect({
publishToken,
publisherName,
mediaStream,
});
// Stop publishing sources
room.unpublish(publishedSource);
room.unpublish(customPublishedSource);
To watch a stream, call the watch
function. Once connected, the SDK will trigger a series of publisherJoined
and sourceAdded
events that you must subscribe to in order to get the audio / video streams coming from the platform, and display them on your web page.
import { Publisher, Room, Source } from '@millicast/sdk-interactivity';
const room = new Room({
streamName,
streamAccountId,
});
room.on('publisherJoined', (publisher: Publisher) => {
console.log(`${publisher.name} joined.`);
});
room.on('sourceAdded', (publisher: Publisher, source: Source) => {
const { sourceId } = source;
console.log(`New ${sourceId.sourceType} source: ${sourceId.sourceName}`);
console.log(`is available from ${publisher.name}.`);
});
await room.watch();
To publish another source into a stream, call the publish
function.
// Will publish another source
await room.publish({
publishToken,
constraints: {
// Set WebRTC Media Stream constraints
audio: true,
video: true,
},
});
To publish a screenshare into the stream, call the getDisplayMedia
function to get the screenshare stream. and the publish
function.
import { SourceType } from '@millicast/sdk-interactivity';
// Prompts the user to select and grant permission to capture the contents
// of a display or portion thereof (such as a window).
const mediaStream = await navigator.mediaDevices.getDisplayMedia({});
const source = await room.publish({
mediaStream,
releaseOnLeave: true,
publishToken,
sourceType: SourceType.Screenshare,
sourceName: 'My Screenshare',
});
// Display the screenshare on the page
const videoElement = document.getElementById('screenshare');
videoElement.srcObject = new MediaStream([source.videoTrack]);
videoElement.play();
The unit tests are built on Jest, to execute the tests, run the following command.
npm run test
Create distribution package:
npm run build
The documentation is built on TypeDoc, to generate the doc, run the following command. You will find the HTML files in the docs
folder.
npm run docs
You can also print the logs in the console and select the log level by using the following code.
import { Logger } from '@millicast/sdk-interactivity';
Logger.useDefaults({
defaultLevel: Logger.TRACE,
});
FAQs
Dolby Millicast Interactivity SDK
The npm package @millicast/sdk-interactivity receives a total of 3 weekly downloads. As such, @millicast/sdk-interactivity popularity was classified as not popular.
We found that @millicast/sdk-interactivity demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.