Socket
Socket
Sign inDemoInstall

@cubicleai/wrtc

Package Overview
Dependencies
176
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.1 to 0.7.0

177

CHANGELOG.md

@@ -0,1 +1,8 @@

# 0.7.0
- Updated to WebRTC M96.
- Added `target` property to event objects
- Support for multiple sinks per audio source
- Fixed RTCRtpSender::GetParameters
# 0.6.1

@@ -24,3 +31,3 @@

The previous changelog entries correspond to releases of the [`wrtc`](https://github.com/node-webrtc/node-webrtc)
The previous changelog entries correspond to releases of the [`wrtc`](https://github.com/node-webrtc/node-webrtc)
package from which `@astronautlabs/webrtc` was forked.

@@ -80,4 +87,4 @@

```js
const stream = new MediaStream({ id: 'foo' });
stream.id === 'foo'; // true
const stream = new MediaStream({ id: "foo" });
stream.id === "foo"; // true
```

@@ -238,6 +245,6 @@

* Pass audio samples to RTCAudioSource via the `onData` method. Then use the
- Pass audio samples to RTCAudioSource via the `onData` method. Then use the
RTCAudioSource's `createTrack` method to create a local audio
MediaStreamTrack.
* Construct an RTCAudioSink from a local or remote audio MediaStreamTrack. The
- Construct an RTCAudioSink from a local or remote audio MediaStreamTrack. The
RTCAudioSink will emit a "data" event every time audio samples are received.

@@ -250,3 +257,3 @@ When you're finished, stop the RTCAudioSink by calling `stop`.

```js
const { RTCAudioSource, RTCAudioSink } = require('wrtc').nonstandard;
const { RTCAudioSource, RTCAudioSink } = require("wrtc").nonstandard;

@@ -258,7 +265,7 @@ const source = new RTCAudioSource();

const sampleRate = 8000;
const samples = new Int16Array(sampleRate / 100); // 10 ms of 16-bit mono audio
const samples = new Int16Array(sampleRate / 100); // 10 ms of 16-bit mono audio
const data = {
samples,
sampleRate
sampleRate,
};

@@ -271,3 +278,3 @@

sink.ondata = data => {
sink.ondata = (data) => {
// Do something with the received audio samples.

@@ -301,7 +308,7 @@ };

* Calling `createTrack` will return a local audio MediaStreamTrack whose source
- Calling `createTrack` will return a local audio MediaStreamTrack whose source
is the RTCAudioSource.
* Calling `onData` with RTCAudioData pushes a new audio samples to every
- Calling `onData` with RTCAudioData pushes a new audio samples to every
non-stopped local audio MediaStreamTrack created with `createTrack`.
* RTCAudioData should represent 10 ms worth of 16-bit audio samples.
- RTCAudioData should represent 10 ms worth of 16-bit audio samples.

@@ -319,8 +326,8 @@ #### RTCAudioSink

* RTCAudioSink's constructor accepts a local or remote audio MediaStreamTrack.
* As long as neither the RTCAudioSink nor the RTCAudioSink's MediaStreamTrack
- RTCAudioSink's constructor accepts a local or remote audio MediaStreamTrack.
- As long as neither the RTCAudioSink nor the RTCAudioSink's MediaStreamTrack
are stopped, the RTCAudioSink will raise a "data" event any time RTCAudioData
is received.
* The "data" event has all the properties of RTCAudioData.
* RTCAudioSink must be stopped by calling `stop`.
- The "data" event has all the properties of RTCAudioData.
- RTCAudioSink must be stopped by calling `stop`.

@@ -346,6 +353,6 @@ ### RTCVideoFrame `rotation`

* Pass [I420](https://wiki.videolan.org/YUV/#I420) frames to RTCVideoSource via
- Pass [I420](https://wiki.videolan.org/YUV/#I420) frames to RTCVideoSource via
the `onFrame` method. Then use RTCVideoSource's `createTrack` method to create
a local video MediaStreamTrack.
* Construct an RTCVideoSink from a local or remote video MediaStreamTrack. The
- Construct an RTCVideoSink from a local or remote video MediaStreamTrack. The
RTCVideoSink will emit a "frame" event every time an I420 frame is received.

@@ -358,3 +365,3 @@ When you're finished, stop the RTCVideoSink by calling `stop`.

```js
const { RTCVideoSource, RTCVideoSink } = require('wrtc').nonstandard;
const { RTCVideoSource, RTCVideoSink } = require("wrtc").nonstandard;

@@ -413,7 +420,7 @@ const source = new RTCVideoSource();

* Calling `createTrack` will return a local video MediaStreamTrack whose source
- Calling `createTrack` will return a local video MediaStreamTrack whose source
is the RTCVideoSource.
* Calling `onFrame` with an RTCVideoFrame pushes a new video frame to every
- Calling `onFrame` with an RTCVideoFrame pushes a new video frame to every
non-stopped local video MediaStreamTrack created with `createTrack`.
* An RTCVideoFrame represents an I420 frame.
- An RTCVideoFrame represents an I420 frame.

@@ -431,8 +438,8 @@ #### RTCVideoSink

* RTCVideoSink's constructor accepts a local or remote video MediaStreamTrack.
* As long as neither the RTCVideoSink nor the RTCVideoSink's MediaStreamTrack
- RTCVideoSink's constructor accepts a local or remote video MediaStreamTrack.
- As long as neither the RTCVideoSink nor the RTCVideoSink's MediaStreamTrack
are stopped, the RTCVideoSink will raise a "frame" event any time an
RTCVideoFrame is received.
* The "frame" event has a property, `frame`, of type RTCVideoFrame.
* RTCVideoSink must be stopped by calling `stop`.
- The "frame" event has a property, `frame`, of type RTCVideoFrame.
- RTCVideoSink must be stopped by calling `stop`.

@@ -447,3 +454,3 @@ #### `i420ToRgba` and `rgbaToI420`

```js
const { i420ToRgba, rgbaToI420 } = require('wrtc').nonstandard;
const { i420ToRgba, rgbaToI420 } = require("wrtc").nonstandard;

@@ -526,9 +533,9 @@ const width = 640;

```js
const { getUserMedia } = require('wrtc');
const { getUserMedia } = require("wrtc");
getUserMedia({
audio: true,
video: true
}).then(stream => {
stream.getTracks().forEach(track => stop());
video: true,
}).then((stream) => {
stream.getTracks().forEach((track) => stop());
});

@@ -550,12 +557,10 @@ ```

// Legacy API
pc.getStats(
response => { /* ... */ },
console.error
);
pc.getStats((response) => {
/* ... */
}, console.error);
// Standards-compliant API
pc.getStats().then(
report => { /* ... */ },
console.error
);
pc.getStats().then((report) => {
/* ... */
}, console.error);
```

@@ -567,4 +572,4 @@

* A non-standard RTCConfiguration option, `sdpSemantics`, and
* An environment variable, `SDP_SEMANTICS`.
- A non-standard RTCConfiguration option, `sdpSemantics`, and
- An environment variable, `SDP_SEMANTICS`.

@@ -576,6 +581,6 @@ Construct an RTCPeerConnection with `sdpSemantics` set to "unified-plan" or

```js
const { RTCPeerConnection } = require('wrtc');
const { RTCPeerConnection } = require("wrtc");
const pc = new RTCPeerConnection({
sdpSemantics: 'unified-plan' // default is "plan-b"
sdpSemantics: "unified-plan", // default is "plan-b"
});

@@ -620,16 +625,16 @@ ```

```js
const assert = require('assert');
const { MediaStream, RTCPeerConnection, RTCRtpTransceiver } = require('wrtc');
const assert = require("assert");
const { MediaStream, RTCPeerConnection, RTCRtpTransceiver } = require("wrtc");
const pc = new RTCPeerConnection({
sdpSemantics: 'unified-plan'
sdpSemantics: "unified-plan",
});
const t1 = pc.addTransceiver('audio', {
direction: 'recvonly'
const t1 = pc.addTransceiver("audio", {
direction: "recvonly",
});
const t2 = pc.addTransceiver(t1.receiver.track, {
direction: 'sendonly',
streams: [new MediaStream()]
direction: "sendonly",
streams: [new MediaStream()],
});

@@ -727,3 +732,3 @@ ```

```js
const { MediaStream } = require('wrtc');
const { MediaStream } = require("wrtc");

@@ -878,7 +883,7 @@ const stream1 = new MediaStream();

* `bundlePolicy`
* `iceCandidatePoolSize`
* `iceServers` (no support for OAuth yet)
* `iceTransportPolicy`
* `rtcpMuxPolicy`
- `bundlePolicy`
- `iceCandidatePoolSize`
- `iceServers` (no support for OAuth yet)
- `iceTransportPolicy`
- `rtcpMuxPolicy`

@@ -890,3 +895,3 @@ RTCConfiguration also accepts a non-standard property, `portRange`. This

```js
const { RTCPeerConnection } = require('wrtc');
const { RTCPeerConnection } = require("wrtc");

@@ -896,4 +901,4 @@ const pc = new RTCPeerConnection({

min: 10000, // defaults to 0
max: 20000 // defaults to 65535
}
max: 20000, // defaults to 65535
},
});

@@ -906,18 +911,18 @@ ```

* `getConfiguration`
* `setConfiguration`
- `getConfiguration`
- `setConfiguration`
RTCPeerConnection now supports the following properties:
* `canTrickleIceCandidates` (always returns `null` for now)
* `connectionState` (derived from `iceConnectionState`)
* `currentLocalDescription`
* `currentRemoteDescription`
* `pendingLocalDescription`
* `pendingRemoteDescription`
- `canTrickleIceCandidates` (always returns `null` for now)
- `connectionState` (derived from `iceConnectionState`)
- `currentLocalDescription`
- `currentRemoteDescription`
- `pendingLocalDescription`
- `pendingRemoteDescription`
RTCPeerConnection now supports the following events:
* "connectionstatechange"
* "negotiationneeded"
- "connectionstatechange"
- "negotiationneeded"

@@ -930,5 +935,5 @@ ### RTCOfferOptions and RTCAnswerOptions

* `iceRestart`
* `offerToReceiveAudio`
* `offerToReceiveVideo`
- `iceRestart`
- `offerToReceiveAudio`
- `offerToReceiveVideo`

@@ -941,8 +946,8 @@ Both RTCOfferOptions and RTCAnswerOptions support `voiceActivityDetection`.

* `id`
* `maxPacketLifeTime`
* `maxRetransmits`
* `negotiated`
* `ordered`
* `protocol`
- `id`
- `maxPacketLifeTime`
- `maxRetransmits`
- `negotiated`
- `ordered`
- `protocol`

@@ -953,7 +958,7 @@ ### RTCDataChannel

* `id`
* `maxRetransmits`
* `ordered`
* `priority` (always returns "high")
* `protocol`
- `id`
- `maxRetransmits`
- `ordered`
- `priority` (always returns "high")
- `protocol`

@@ -968,5 +973,5 @@ RTCDataChannel's `send` method now supports sending Blobs provided by

* RTCDataChannel
* RTCDataChannelEvent
* RTCPeerConnectionIceEvent
- RTCDataChannel
- RTCDataChannelEvent
- RTCPeerConnectionIceEvent

@@ -973,0 +978,0 @@ ## Bug Fixes

@@ -133,3 +133,3 @@ cmake_minimum_required(VERSION 3.12)

set(WEBRTC_REVISION branch-heads/4638) # M95 https://groups.google.com/g/discuss-webrtc/c/SfzpFc-dH-E/m/JHlMpLO1AAAJ
set(WEBRTC_REVISION branch-heads/4664) # M96 https://groups.google.com/g/discuss-webrtc/c/Bp8OzBzipSc/m/0AC4OGhdAgAJ

@@ -136,0 +136,0 @@ list(APPEND GN_GEN_ARGS

@@ -7,3 +7,3 @@ export declare const MediaStream: {

};
export declare type MediaStream = typeof window.MediaStream;
export type MediaStream = typeof window.MediaStream;
export declare const MediaStreamTrack: {

@@ -13,3 +13,3 @@ new (): globalThis.MediaStreamTrack;

};
export declare type MediaStreamTrack = typeof window.MediaStreamTrack;
export type MediaStreamTrack = typeof window.MediaStreamTrack;
export declare const RTCDataChannel: {

@@ -19,3 +19,3 @@ new (): globalThis.RTCDataChannel;

};
export declare type RTCDataChannel = typeof window.RTCDataChannel;
export type RTCDataChannel = typeof window.RTCDataChannel;
export declare const RTCDataChannelEvent: {

@@ -25,3 +25,3 @@ new (type: string, eventInitDict: RTCDataChannelEventInit): globalThis.RTCDataChannelEvent;

};
export declare type RTCDataChannelEvent = typeof window.RTCDataChannelEvent;
export type RTCDataChannelEvent = typeof window.RTCDataChannelEvent;
export declare const RTCDtlsTransport: {

@@ -31,3 +31,3 @@ new (): globalThis.RTCDtlsTransport;

};
export declare type RTCDtlsTransport = typeof window.RTCDtlsTransport;
export type RTCDtlsTransport = typeof window.RTCDtlsTransport;
export declare const RTCIceCandidate: {

@@ -37,3 +37,3 @@ new (candidateInitDict?: RTCIceCandidateInit): globalThis.RTCIceCandidate;

};
export declare type RTCIceCandidate = typeof window.RTCIceCandidate;
export type RTCIceCandidate = typeof window.RTCIceCandidate;
export declare const RTCIceTransport: {

@@ -43,3 +43,3 @@ new (): globalThis.RTCIceTransport;

};
export declare type RTCIceTransport = typeof window.RTCIceTransport;
export type RTCIceTransport = typeof window.RTCIceTransport;
export declare const RTCPeerConnection: {

@@ -50,3 +50,3 @@ new (configuration?: RTCConfiguration): globalThis.RTCPeerConnection;

};
export declare type RTCPeerConnection = typeof window.RTCPeerConnection;
export type RTCPeerConnection = typeof window.RTCPeerConnection;
export declare const RTCPeerConnectionIceEvent: {

@@ -56,3 +56,3 @@ new (type: string, eventInitDict?: RTCPeerConnectionIceEventInit): globalThis.RTCPeerConnectionIceEvent;

};
export declare type RTCPeerConnectionIceEvent = typeof window.RTCPeerConnectionIceEvent;
export type RTCPeerConnectionIceEvent = typeof window.RTCPeerConnectionIceEvent;
export declare const RTCRtpReceiver: {

@@ -63,3 +63,3 @@ new (): globalThis.RTCRtpReceiver;

};
export declare type RTCRtpReceiver = typeof window.RTCRtpReceiver;
export type RTCRtpReceiver = typeof window.RTCRtpReceiver;
export declare const RTCRtpSender: {

@@ -70,3 +70,3 @@ new (): globalThis.RTCRtpSender;

};
export declare type RTCRtpSender = typeof window.RTCRtpSender;
export type RTCRtpSender = typeof window.RTCRtpSender;
export declare const RTCRtpTransceiver: {

@@ -76,3 +76,3 @@ new (): globalThis.RTCRtpTransceiver;

};
export declare type RTCRtpTransceiver = typeof window.RTCRtpTransceiver;
export type RTCRtpTransceiver = typeof window.RTCRtpTransceiver;
export declare const RTCSctpTransport: {

@@ -82,3 +82,3 @@ new (): globalThis.RTCSctpTransport;

};
export declare type RTCSctpTransport = typeof window.RTCSctpTransport;
export type RTCSctpTransport = typeof window.RTCSctpTransport;
export declare const RTCSessionDescription: {

@@ -88,6 +88,6 @@ new (descriptionInitDict: RTCSessionDescriptionInit): globalThis.RTCSessionDescription;

};
export declare type RTCSessionDescription = typeof window.RTCSessionDescription;
export type RTCSessionDescription = typeof window.RTCSessionDescription;
export declare const getUserMedia: any;
export declare type getUserMedia = typeof globalThis.getUserMedia;
export type getUserMedia = typeof globalThis.getUserMedia;
export declare const mediaDevices: MediaDevices;
export declare type mediaDevices = typeof globalThis.mediaDevices;
export type mediaDevices = typeof globalThis.mediaDevices;
export declare const RTCAudioSink: any;
export declare type RTCAudioSink = typeof RTCAudioSinkT;
export type RTCAudioSink = typeof RTCAudioSinkT;
declare class RTCAudioSinkT {
}
export {};
export declare const RTCAudioSource: typeof RTCAudioSourceT;
export declare type RTCAudioSource = RTCAudioSourceT;
export type RTCAudioSource = RTCAudioSourceT;
export interface RTCAudioData {

@@ -4,0 +4,0 @@ samples: Int16Array;

export declare const RTCDataChannel: typeof globalThis.RTCDataChannel;
export declare type RTCDataChannel = globalThis.RTCDataChannel;
export type RTCDataChannel = globalThis.RTCDataChannel;
import type { RTCIceTransport } from './icetransport';
export declare const RTCDtlsTransport: (typeof globalThis.RTCDtlsTransport);
export declare type RTCDtlsTransport = RTCDtlsTransportExtensions;
export type RTCDtlsTransport = RTCDtlsTransportExtensions;
declare class RTCDtlsTransportExtensions extends globalThis.RTCDtlsTransport {

@@ -5,0 +5,0 @@ iceTransport: RTCIceTransport;

@@ -25,2 +25,3 @@ "use strict";

let listeners = this._listeners = this._listeners || {};
event.target = this;
process.nextTick(() => {

@@ -27,0 +28,0 @@ listeners = new Set(listeners[event.type] || []);

@@ -22,2 +22,3 @@ "use strict";

let listeners = this._listeners = this._listeners || {};
event.target = this;
process.nextTick(() => {

@@ -24,0 +25,0 @@ listeners = new Set(listeners[event.type] || []);

export declare const getUserMedia: typeof globalThis.getUserMedia;
export declare type getUserMedia = typeof globalThis.getUserMedia;
export type getUserMedia = typeof globalThis.getUserMedia;

@@ -1,2 +0,2 @@

declare type NRTCIceCandidate = globalThis.RTCIceCandidate;
type NRTCIceCandidate = globalThis.RTCIceCandidate;
export declare class RTCIceCandidate implements NRTCIceCandidate {

@@ -3,0 +3,0 @@ /**

export declare const RTCIceTransport: (typeof globalThis.RTCIceTransport & typeof RTCIceTransportExtensions);
export declare type RTCIceTransport = RTCIceTransportExtensions;
export type RTCIceTransport = RTCIceTransportExtensions;
declare class RTCIceTransportExtensions extends globalThis.RTCIceTransport {

@@ -4,0 +4,0 @@ component: string;

@@ -1,5 +0,5 @@

export * from './audiosink';
export * from './audiosource';
export * from './videosink';
export * from './videosource';
export * from "./audiosink";
export * from "./audiosource";
export * from "./videosink";
export * from "./videosource";
export * from "./datachannel";

@@ -9,4 +9,4 @@ export * from "./datachannelevent";

export * from "./peerconnection";
export * from './rtcpeerconnectioniceevent';
export * from './sessiondescription';
export * from "./rtcpeerconnectioniceevent";
export * from "./sessiondescription";
export * from "./mediastream";

@@ -21,3 +21,3 @@ export * from "./mediastreamtrack";

export * from "./getusermedia";
import { MediaDevices } from './mediadevices';
import { MediaDevices } from "./mediadevices";
export declare const mediaDevices: MediaDevices;

@@ -32,3 +32,3 @@ "use strict";

try {
native.setDOMException(require('domexception'));
native.setDOMException(require("domexception"));
}

@@ -62,3 +62,3 @@ catch (error) {

datachannel_1.RTCDataChannel.prototype.send = function send(data) {
const implSymbol = Object.getOwnPropertySymbols(data).find(symbol => symbol.toString() === 'Symbol(impl)');
const implSymbol = Object.getOwnPropertySymbols(data).find((symbol) => symbol.toString() === "Symbol(impl)");
if (data[implSymbol] && data[implSymbol]._buffer) {

@@ -65,0 +65,0 @@ data = data[implSymbol]._buffer;

export declare const MediaStream: (typeof globalThis.MediaStream & typeof MediaStreamExtensions);
export declare type MediaStream = globalThis.MediaStream;
export type MediaStream = globalThis.MediaStream;
declare class MediaStreamExtensions extends globalThis.MediaStream {

@@ -4,0 +4,0 @@ constructor(options: {

export declare const MediaStreamTrack: typeof globalThis.MediaStreamTrack;
export declare type MediaStreamTrack = globalThis.MediaStreamTrack;
export type MediaStreamTrack = globalThis.MediaStreamTrack;
export declare const RTCRtpReceiver: typeof globalThis.RTCRtpReceiver;
export declare type RTCRtpReceiver = globalThis.RTCRtpReceiver;
export type RTCRtpReceiver = globalThis.RTCRtpReceiver;
export declare const RTCRtpSender: typeof globalThis.RTCRtpSender;
export declare type RTCRtpSender = globalThis.RTCRtpSender;
export type RTCRtpSender = globalThis.RTCRtpSender;
export declare const RTCRtpTransceiver: typeof globalThis.RTCRtpTransceiver;
export declare type RTCRtpTransceiver = globalThis.RTCRtpTransceiver;
export type RTCRtpTransceiver = globalThis.RTCRtpTransceiver;
export declare const RTCSctpTransport: typeof globalThis.RTCSctpTransport;
export declare type RTCSctpTransport = globalThis.RTCSctpTransport;
export type RTCSctpTransport = globalThis.RTCSctpTransport;
import { EventTarget } from './eventtarget';
export declare const RTCVideoSink: typeof RTCVideoSinkT;
export declare type RTCVideoSink = typeof RTCVideoSinkT;
export type RTCVideoSink = typeof RTCVideoSinkT;
export interface RTCVideoSinkEvent extends Event {

@@ -5,0 +5,0 @@ frame: any;

export declare const RTCVideoSource: any;
export declare type RTCVideoSource = typeof RTCVideoSourceT;
export type RTCVideoSource = typeof RTCVideoSourceT;
declare class RTCVideoSourceT {
}
export {};

@@ -12,3 +12,3 @@ {

},
"version": "0.6.1",
"version": "0.7.0",
"author": "Alan K <ack@modeswitch.org> (http://blog.modeswitch.org)",

@@ -15,0 +15,0 @@ "contributors": [

@@ -5,3 +5,3 @@ # @cubicleai/wrtc

Node.js bindings for `libwebrtc`, which implements [WebRTC M95](https://groups.google.com/g/discuss-webrtc/c/SfzpFc-dH-E/m/JHlMpLO1AAAJ). This project aims for spec-compliance and is tested using the W3C's [web-platform-tests](https://github.com/web-platform-tests/wpt) project. A number of [nonstandard APIs](docs/nonstandard-apis.md) for testing are also included.
Node.js bindings for `libwebrtc`, which implements [WebRTC M96](https://groups.google.com/g/discuss-webrtc/c/Bp8OzBzipSc/m/0AC4OGhdAgAJ). This project aims for spec-compliance and is tested using the W3C's [web-platform-tests](https://github.com/web-platform-tests/wpt) project. A number of [nonstandard APIs](docs/nonstandard-apis.md) for testing are also included.

@@ -62,4 +62,4 @@ # Install

<td align="center"></td>
<td align="center">✓</td>
<td align="center"></td>
<td align="center"></td>
<td align="center">✓</td>

@@ -72,4 +72,4 @@ <td align="center">✓</td>

<td align="center"></td>
<td align="center">✓</td>
<td align="center"></td>
<td align="center"></td>
<td align="center">✓</td>

@@ -82,4 +82,4 @@ <td align="center">✓</td>

<td align="center"></td>
<td align="center">✓</td>
<td align="center"></td>
<td align="center"></td>
<td align="center">✓</td>

@@ -86,0 +86,0 @@ <td align="center">✓</td>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc