@gjsify/webrtc 0.4.30 → 0.4.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{Gst as e}from"../gst-init.js";import{RTCDataChannel as t}from"../rtc-data-channel.js";import{DOMException as n}from"@gjsify/dom-exception";function coerceUnsignedShort(e,t){let n=Number(t);if(!Number.isFinite(n))throw TypeError(`createDataChannel: ${e} must be a finite number, got ${String(t)}`);let r=Math.trunc(n);if(r<0||r>65535)throw TypeError(`createDataChannel: ${e}=${r} is outside the [0, 65535] range`);return r}const r={createDataChannel(r,i={}){if(this._closed)throw new n(`Cannot create a data channel on a closed RTCPeerConnection`,`InvalidStateError`);if(typeof r!=`string`)throw TypeError(`createDataChannel: label must be a string`);if(new TextEncoder().encode(r).byteLength>65535)throw TypeError(`createDataChannel: label too long (> 65535 bytes)`);let a=i.maxPacketLifeTime==null?void 0:coerceUnsignedShort(`maxPacketLifeTime`,i.maxPacketLifeTime),o=i.maxRetransmits==null?void 0:coerceUnsignedShort(`maxRetransmits`,i.maxRetransmits),s=i.id==null?void 0:coerceUnsignedShort(`id`,i.id);if(a!==void 0&&o!==void 0)throw TypeError(`createDataChannel: maxPacketLifeTime and maxRetransmits are mutually exclusive`);if(i.negotiated===!0&&s===void 0)throw TypeError(`createDataChannel: negotiated=true requires an id`);if(s===65535)throw TypeError(`createDataChannel: id 65535 is reserved`);let c=e.Structure.new_empty(`data-channel-opts`);this._setStructureField(c,`ordered`,`boolean`,i.ordered),this._setStructureField(c,`max-packet-lifetime`,`int`,a),this._setStructureField(c,`max-retransmits`,`int`,o),this._setStructureField(c,`protocol`,`string`,i.protocol),this._setStructureField(c,`negotiated`,`boolean`,i.negotiated),this._setStructureField(c,`id`,`int`,s);let l=null;try{l=this._webrtcbin.emit(`create-data-channel`,r,c)}catch(e){throw Error(`create-data-channel failed: ${e?.message??e}`)}if(!l)throw Error(`webrtcbin returned null data channel (check id/label/options)`);this._ensureSctpTransport();let u=new t(l);return this._dataChannels.set(l,u),u.addEventListener(`close`,()=>{this._dataChannels.delete(l)}),u}};function installDataChannelMethods(e){Object.assign(e,r)}export{installDataChannelMethods};
1
+ import"../_virtual/_rolldown/runtime.js";import{Gst as e}from"../gst-init.js";import{RTCDataChannel as t}from"../rtc-data-channel.js";import{DOMException as n}from"@gjsify/dom-exception";function coerceUnsignedShort(e,t){let n=Number(t);if(!Number.isFinite(n))throw TypeError(`createDataChannel: ${e} must be a finite number, got ${String(t)}`);let r=Math.trunc(n);if(r<0||r>65535)throw TypeError(`createDataChannel: ${e}=${r} is outside the [0, 65535] range`);return r}const r={createDataChannel(r,i={}){if(this._closed)throw new n(`Cannot create a data channel on a closed RTCPeerConnection`,`InvalidStateError`);if(typeof r!=`string`)throw TypeError(`createDataChannel: label must be a string`);if(new TextEncoder().encode(r).byteLength>65535)throw TypeError(`createDataChannel: label too long (> 65535 bytes)`);let a=i.maxPacketLifeTime==null?void 0:coerceUnsignedShort(`maxPacketLifeTime`,i.maxPacketLifeTime),o=i.maxRetransmits==null?void 0:coerceUnsignedShort(`maxRetransmits`,i.maxRetransmits),s=i.id==null?void 0:coerceUnsignedShort(`id`,i.id);if(a!==void 0&&o!==void 0)throw TypeError(`createDataChannel: maxPacketLifeTime and maxRetransmits are mutually exclusive`);if(i.negotiated===!0&&s===void 0)throw TypeError(`createDataChannel: negotiated=true requires an id`);if(s===65535)throw TypeError(`createDataChannel: id 65535 is reserved`);let c=e.Structure.new_empty(`data-channel-opts`);this._setStructureField(c,`ordered`,`boolean`,i.ordered),this._setStructureField(c,`max-packet-lifetime`,`int`,a),this._setStructureField(c,`max-retransmits`,`int`,o),this._setStructureField(c,`protocol`,`string`,i.protocol),this._setStructureField(c,`negotiated`,`boolean`,i.negotiated),this._setStructureField(c,`id`,`int`,s);let l=null;try{l=this._webrtcbin.emit(`create-data-channel`,r,c)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`create-data-channel failed: ${t}`)}if(!l)throw Error(`webrtcbin returned null data channel (check id/label/options)`);this._ensureSctpTransport();let u=new t(l);return this._dataChannels.set(l,u),u.addEventListener(`close`,()=>{this._dataChannels.delete(l)}),u}};function installDataChannelMethods(e){Object.assign(e,r)}export{installDataChannelMethods};
@@ -1,8 +1,10 @@
1
1
  import '@gjsify/dom-events/register/event-target';
2
+ import type GstNs from 'gi://Gst?version=1.0';
3
+ import type { TeeMultiplexer } from './tee-multiplexer.js';
2
4
  /** @internal GStreamer backing for tracks created by getUserMedia */
3
5
  export interface MediaStreamTrackGstInit {
4
- source: any;
5
- pipeline: any;
6
+ source: GstNs.Element;
7
+ pipeline: GstNs.Pipeline;
6
8
  }
7
9
  export interface MediaStreamTrackInit {
8
10
  kind: 'audio' | 'video';
@@ -24,13 +26,13 @@ export declare class MediaStreamTrack extends EventTarget {
24
26
  private _onmute;
25
27
  private _onunmute;
26
28
  /** @internal GStreamer source element (e.g. pulsesrc, audiotestsrc) */
27
- _gstSource: any;
29
+ _gstSource: GstNs.Element | null;
28
30
  /** @internal Pipeline the source currently lives in (updated by VideoBridge) */
29
- _gstPipeline: any;
31
+ _gstPipeline: GstNs.Pipeline | null;
30
32
  /** @internal Tee element inserted by VideoBridge for preview fan-out */
31
- _gstTee: any;
33
+ _gstTee: GstNs.Element | null;
32
34
  /** @internal TeeMultiplexer for multi-PC fan-out (created on second addTrack) */
33
- _teeMultiplexer: any;
35
+ _teeMultiplexer: TeeMultiplexer | null;
34
36
  /** @internal Callback set by RTCRtpSender to control valve drop property */
35
37
  private _enableCallback;
36
38
  constructor(init: MediaStreamTrackInit);
@@ -26,7 +26,7 @@ export declare class RTCRtpReceiver {
26
26
  private _receiverBridge;
27
27
  /** @internal — stats callback set by RTCPeerConnection */
28
28
  _getStatsForTrack: ((track: MediaStreamTrack) => Promise<RTCStatsReport>) | null;
29
- constructor(kind: 'audio' | 'video', gstReceiver: GstWebRTC.WebRTCRTPReceiver | null, pipeline?: any);
29
+ constructor(kind: 'audio' | 'video', gstReceiver: GstWebRTC.WebRTCRTPReceiver | null, pipeline?: Gst.Pipeline);
30
30
  /** @internal — called from RTCPeerConnection._handlePadAdded */
31
31
  _connectToPad(pad: Gst.Pad): void;
32
32
  /** @internal — called from RTCPeerConnection.close() */
@@ -1,3 +1,4 @@
1
+ import type GstNs from 'gi://Gst?version=1.0';
1
2
  /**
2
3
  * Manages a GStreamer `tee` element that fans out one source to multiple
3
4
  * consumer branches. Each branch gets its own src pad from the tee.
@@ -10,16 +11,16 @@ export declare class TeeMultiplexer {
10
11
  * Create a tee in the given pipeline and link it to the source's output.
11
12
  * The source must already be in the pipeline.
12
13
  */
13
- constructor(pipeline: any, source: any);
14
+ constructor(pipeline: GstNs.Pipeline, source: GstNs.Element);
14
15
  /** Request a new src pad from the tee for a consumer branch. */
15
- requestSrcPad(): any;
16
+ requestSrcPad(): GstNs.Pad | null;
16
17
  /**
17
18
  * Release a branch's src pad from the tee.
18
19
  * Adds a DROP probe before unlinking to prevent errors.
19
20
  */
20
- releaseSrcPad(srcPad: any): void;
21
+ releaseSrcPad(srcPad: GstNs.Pad | null): void;
21
22
  /** Number of active branches. */
22
23
  get branchCount(): number;
23
24
  /** The tee element (for pipeline queries). */
24
- get element(): any;
25
+ get element(): GstNs.Element;
25
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/webrtc",
3
- "version": "0.4.30",
3
+ "version": "0.4.31",
4
4
  "description": "W3C WebRTC API for GJS using GStreamer webrtcbin as the peer-connection backend",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -58,10 +58,10 @@
58
58
  "peer-connection"
59
59
  ],
60
60
  "dependencies": {
61
- "@gjsify/buffer": "^0.4.30",
62
- "@gjsify/dom-events": "^0.4.30",
63
- "@gjsify/dom-exception": "^0.4.30",
64
- "@gjsify/webrtc-native": "^0.4.30"
61
+ "@gjsify/buffer": "^0.4.31",
62
+ "@gjsify/dom-events": "^0.4.31",
63
+ "@gjsify/dom-exception": "^0.4.31",
64
+ "@gjsify/webrtc-native": "^0.4.31"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@girs/gjs": "4.0.1",
@@ -70,8 +70,8 @@
70
70
  "@girs/gst-1.0": "1.28.1-4.0.1",
71
71
  "@girs/gstsdp-1.0": "1.0.0-4.0.1",
72
72
  "@girs/gstwebrtc-1.0": "1.0.0-4.0.1",
73
- "@gjsify/cli": "^0.4.30",
74
- "@gjsify/unit": "^0.4.30",
73
+ "@gjsify/cli": "^0.4.31",
74
+ "@gjsify/unit": "^0.4.31",
75
75
  "@types/node": "^25.9.1",
76
76
  "typescript": "^6.0.3"
77
77
  }