@poolse/sdk 2.24.0 → 2.26.0
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.
- package/CHANGELOG.md +17 -0
- package/dist/index.cjs +6 -691
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -432
- package/dist/index.d.ts +22 -432
- package/dist/index.js +7 -687
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Channel
|
|
1
|
+
import { Channel } from 'phoenix';
|
|
2
2
|
|
|
3
3
|
type Uuid = string;
|
|
4
4
|
type IsoDateTime = string;
|
|
@@ -452,371 +452,6 @@ interface ResolvedConfig {
|
|
|
452
452
|
userResolver: PoolseConfig['userResolver'];
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
-
/**
|
|
456
|
-
* Voice types shared by the room (Discord-style "join voice") and call
|
|
457
|
-
* (WhatsApp-style ringing) surfaces.
|
|
458
|
-
*
|
|
459
|
-
* The WebRTC pieces are declared structurally rather than as the DOM's
|
|
460
|
-
* concrete `RTCPeerConnection`, so React Native can hand us
|
|
461
|
-
* `react-native-webrtc` — API-compatible, different classes — through
|
|
462
|
-
* {@link WebRtcAdapter} without the SDK importing anything native.
|
|
463
|
-
*/
|
|
464
|
-
/** Connection lifecycle for a voice room. */
|
|
465
|
-
type VoiceStatus = 'idle' | 'connecting' | 'connected' | 'error';
|
|
466
|
-
/** Someone currently in a voice room, including yourself. */
|
|
467
|
-
interface VoiceParticipant {
|
|
468
|
-
userId: string;
|
|
469
|
-
muted: boolean;
|
|
470
|
-
speaking: boolean;
|
|
471
|
-
/** ms epoch from presence metadata; stable ordering key for rosters. */
|
|
472
|
-
joinedAt: number;
|
|
473
|
-
/** True for the local participant. */
|
|
474
|
-
isSelf: boolean;
|
|
475
|
-
}
|
|
476
|
-
/** The subset of `MediaStreamTrack` the SDK touches. */
|
|
477
|
-
interface VoiceTrack {
|
|
478
|
-
kind: string;
|
|
479
|
-
enabled: boolean;
|
|
480
|
-
stop(): void;
|
|
481
|
-
}
|
|
482
|
-
/** The subset of `MediaStream` the SDK touches. */
|
|
483
|
-
interface VoiceStream {
|
|
484
|
-
id: string;
|
|
485
|
-
getTracks(): VoiceTrack[];
|
|
486
|
-
getAudioTracks(): VoiceTrack[];
|
|
487
|
-
}
|
|
488
|
-
/** Session description exchanged during negotiation. */
|
|
489
|
-
interface VoiceDescription {
|
|
490
|
-
type: string;
|
|
491
|
-
sdp?: string | undefined;
|
|
492
|
-
}
|
|
493
|
-
/** ICE candidate in its wire (JSON) form. */
|
|
494
|
-
interface VoiceCandidate {
|
|
495
|
-
candidate?: string | undefined;
|
|
496
|
-
sdpMid?: string | null | undefined;
|
|
497
|
-
sdpMLineIndex?: number | null | undefined;
|
|
498
|
-
usernameFragment?: string | null | undefined;
|
|
499
|
-
}
|
|
500
|
-
/** The subset of `RTCPeerConnection` the SDK drives. */
|
|
501
|
-
interface VoicePeerConnection {
|
|
502
|
-
addTrack(track: VoiceTrack, stream: VoiceStream): unknown;
|
|
503
|
-
createOffer(): Promise<VoiceDescription>;
|
|
504
|
-
createAnswer(): Promise<VoiceDescription>;
|
|
505
|
-
setLocalDescription(description: VoiceDescription): Promise<void>;
|
|
506
|
-
setRemoteDescription(description: VoiceDescription): Promise<void>;
|
|
507
|
-
addIceCandidate(candidate: VoiceCandidate): Promise<void>;
|
|
508
|
-
close(): void;
|
|
509
|
-
readonly remoteDescription: VoiceDescription | null;
|
|
510
|
-
onicecandidate: ((event: {
|
|
511
|
-
candidate: VoiceCandidate | null;
|
|
512
|
-
}) => void) | null;
|
|
513
|
-
ontrack: ((event: {
|
|
514
|
-
streams: readonly VoiceStream[];
|
|
515
|
-
}) => void) | null;
|
|
516
|
-
onconnectionstatechange: (() => void) | null;
|
|
517
|
-
readonly connectionState: string;
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* Platform binding for WebRTC. The browser default is built in; React
|
|
521
|
-
* Native supplies one backed by `react-native-webrtc`.
|
|
522
|
-
*/
|
|
523
|
-
interface WebRtcAdapter {
|
|
524
|
-
createPeerConnection(iceServers: VoiceIceServer[]): VoicePeerConnection;
|
|
525
|
-
getUserMedia(): Promise<VoiceStream>;
|
|
526
|
-
/**
|
|
527
|
-
* Attach a remote stream to a playback sink. The browser adapter
|
|
528
|
-
* creates a hidden `<audio>` element; React Native returns the stream
|
|
529
|
-
* URL for an `<RTCView>`. Returning a disposer keeps the room from
|
|
530
|
-
* leaking sinks when a peer leaves.
|
|
531
|
-
*/
|
|
532
|
-
playRemoteStream(peerId: string, stream: VoiceStream): () => void;
|
|
533
|
-
}
|
|
534
|
-
interface VoiceIceServer {
|
|
535
|
-
urls: string | string[];
|
|
536
|
-
username?: string;
|
|
537
|
-
credential?: string;
|
|
538
|
-
}
|
|
539
|
-
interface VoiceRoomOptions {
|
|
540
|
-
/**
|
|
541
|
-
* ICE servers for peer connections. Defaults to a public STUN server,
|
|
542
|
-
* which is enough when peers can reach each other directly — add a
|
|
543
|
-
* TURN server for participants behind symmetric NAT.
|
|
544
|
-
*/
|
|
545
|
-
iceServers?: VoiceIceServer[];
|
|
546
|
-
/**
|
|
547
|
-
* Resolve ICE servers just before connecting, overriding `iceServers`.
|
|
548
|
-
*
|
|
549
|
-
* TURN credentials expire, so they cannot be handed over once at
|
|
550
|
-
* construction and reused for the life of the app — by the second call
|
|
551
|
-
* they would be rejected. `PoolseRealtime` supplies a provider backed
|
|
552
|
-
* by `GET /v1/ice-servers`, which is what makes TURN work without any
|
|
553
|
-
* app wiring.
|
|
554
|
-
*
|
|
555
|
-
* Failures are non-fatal: the room falls back to `iceServers` (or the
|
|
556
|
-
* default STUN) rather than refusing to connect. Degraded beats dead —
|
|
557
|
-
* without TURN a call still works on most networks.
|
|
558
|
-
*/
|
|
559
|
-
iceServersProvider?: () => Promise<VoiceIceServer[]>;
|
|
560
|
-
/** Platform WebRTC binding. Defaults to the browser implementation. */
|
|
561
|
-
webrtc?: WebRtcAdapter;
|
|
562
|
-
/**
|
|
563
|
-
* Disable local speaking detection. On by default; turn it off if the
|
|
564
|
-
* host app drives the indicator itself.
|
|
565
|
-
*/
|
|
566
|
-
detectSpeaking?: boolean;
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* What a call carries.
|
|
570
|
-
*
|
|
571
|
-
* Fixed when the call is placed, and travelling with the ring rather
|
|
572
|
-
* than the connection: CallKit shows a different answer button for a
|
|
573
|
-
* video call and cannot be changed once the call is reported. Either
|
|
574
|
-
* side can still turn their camera on or off mid-call — this is what
|
|
575
|
-
* the call *opens* as.
|
|
576
|
-
*/
|
|
577
|
-
type CallMedia = 'audio' | 'video';
|
|
578
|
-
/** An inbound ring, delivered on the user's own channel. */
|
|
579
|
-
interface IncomingCall {
|
|
580
|
-
callId: string;
|
|
581
|
-
conversationId: string;
|
|
582
|
-
callerUserId: string;
|
|
583
|
-
/** Defaults to `'audio'` against a server that predates the field. */
|
|
584
|
-
media: CallMedia;
|
|
585
|
-
}
|
|
586
|
-
/** The far side answered; both parties should now join the room. */
|
|
587
|
-
interface CallAccepted {
|
|
588
|
-
callId: string;
|
|
589
|
-
conversationId: string;
|
|
590
|
-
/** Who accepted. */
|
|
591
|
-
userId: string;
|
|
592
|
-
}
|
|
593
|
-
/** The far side declined. */
|
|
594
|
-
interface CallDeclined {
|
|
595
|
-
callId: string;
|
|
596
|
-
conversationId: string;
|
|
597
|
-
userId: string;
|
|
598
|
-
}
|
|
599
|
-
/** The callee is already on another call. */
|
|
600
|
-
interface CallBusy {
|
|
601
|
-
callId: string;
|
|
602
|
-
conversationId: string;
|
|
603
|
-
/** Who is busy. */
|
|
604
|
-
userId: string;
|
|
605
|
-
}
|
|
606
|
-
/** The other side ended a call that was already connected. */
|
|
607
|
-
interface CallEnded {
|
|
608
|
-
callId: string;
|
|
609
|
-
conversationId: string;
|
|
610
|
-
/** Who hung up. */
|
|
611
|
-
userId: string;
|
|
612
|
-
}
|
|
613
|
-
/** The caller hung up before anyone answered. */
|
|
614
|
-
interface CallCancelled {
|
|
615
|
-
callId: string;
|
|
616
|
-
conversationId: string;
|
|
617
|
-
callerUserId: string;
|
|
618
|
-
}
|
|
619
|
-
/** Result of placing a call. */
|
|
620
|
-
interface OutgoingCall {
|
|
621
|
-
callId: string;
|
|
622
|
-
conversationId: string;
|
|
623
|
-
/** Everyone who was rung — the conversation's members, minus you. */
|
|
624
|
-
calleeUserIds: string[];
|
|
625
|
-
media: CallMedia;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
* WhatsApp-style call invitations.
|
|
630
|
-
*
|
|
631
|
-
* {@link VoiceRoom} is room-shaped: you're only reachable once you've
|
|
632
|
-
* already joined. Ringing somebody who is sitting idle needs a channel
|
|
633
|
-
* they're always on, which is their own `user:<id>` topic — so that's
|
|
634
|
-
* where the invite half of a call lives.
|
|
635
|
-
*
|
|
636
|
-
* const call = await poolse.calls.invite(conversationId);
|
|
637
|
-
* // …callee's client fires onIncoming, shows a ring screen…
|
|
638
|
-
* poolse.calls.onAccepted(({ callId }) => {
|
|
639
|
-
* if (callId === call.callId) void room.join();
|
|
640
|
-
* });
|
|
641
|
-
*
|
|
642
|
-
* Media never touches this class. Once both sides have accepted they
|
|
643
|
-
* join the voice room and negotiate exactly as the Discord-style flow
|
|
644
|
-
* does.
|
|
645
|
-
*
|
|
646
|
-
* There is no ring timeout here on purpose: only the UI knows when it
|
|
647
|
-
* gave up, and it can call {@link cancel} at that point.
|
|
648
|
-
*/
|
|
649
|
-
|
|
650
|
-
type Unsubscribe$3 = () => void;
|
|
651
|
-
declare class CallsResource {
|
|
652
|
-
/** Resolves the user channel lazily — it may not be joined yet. */
|
|
653
|
-
private readonly getChannel;
|
|
654
|
-
private readonly incoming;
|
|
655
|
-
private readonly accepted;
|
|
656
|
-
private readonly declined;
|
|
657
|
-
private readonly busy;
|
|
658
|
-
private readonly cancelled;
|
|
659
|
-
private readonly ended;
|
|
660
|
-
private bound;
|
|
661
|
-
constructor(getChannel: () => Channel);
|
|
662
|
-
/**
|
|
663
|
-
* Ring every other member of a conversation. Resolves once the server
|
|
664
|
-
* has fanned the invite out, with the minted call id and who was rung
|
|
665
|
-
* — not when anyone answers; that arrives via {@link onAccepted}.
|
|
666
|
-
*/
|
|
667
|
-
invite(conversationId: string, media?: CallMedia): Promise<OutgoingCall>;
|
|
668
|
-
/**
|
|
669
|
-
* Answer a ringing call. This only tells the caller you picked up —
|
|
670
|
-
* join the voice room yourself to actually connect audio.
|
|
671
|
-
*/
|
|
672
|
-
accept(call: IncomingCall): Promise<void>;
|
|
673
|
-
/** Reject a ringing call without joining the room. */
|
|
674
|
-
decline(call: IncomingCall): Promise<void>;
|
|
675
|
-
/**
|
|
676
|
-
* Tell the caller you are already on another call.
|
|
677
|
-
*
|
|
678
|
-
* Distinct from {@link decline}: nobody chose anything, so clients
|
|
679
|
-
* send this automatically when a ring arrives mid-call. `useCalls`
|
|
680
|
-
* does it for you.
|
|
681
|
-
*/
|
|
682
|
-
markBusy(call: IncomingCall): Promise<void>;
|
|
683
|
-
/**
|
|
684
|
-
* End a call that is already connected.
|
|
685
|
-
*
|
|
686
|
-
* Distinct from {@link cancel}, which withdraws an unanswered invite.
|
|
687
|
-
* Without this a connected call has no end signal, so hanging up
|
|
688
|
-
* leaves the other side sitting in the room with a call screen it has
|
|
689
|
-
* no reason to close.
|
|
690
|
-
*/
|
|
691
|
-
hangUp(call: {
|
|
692
|
-
callId: string;
|
|
693
|
-
conversationId: string;
|
|
694
|
-
}): Promise<void>;
|
|
695
|
-
/** Withdraw an invite you placed — hung up before anyone answered. */
|
|
696
|
-
cancel(call: OutgoingCall): Promise<void>;
|
|
697
|
-
/** Somebody is ringing you. */
|
|
698
|
-
onIncoming(fn: (call: IncomingCall) => void): Unsubscribe$3;
|
|
699
|
-
/** Your outbound call was answered — join the room now. */
|
|
700
|
-
onAccepted(fn: (call: CallAccepted) => void): Unsubscribe$3;
|
|
701
|
-
/** Your outbound call was rejected. */
|
|
702
|
-
onDeclined(fn: (call: CallDeclined) => void): Unsubscribe$3;
|
|
703
|
-
/** The person you called is already on another call. */
|
|
704
|
-
onBusy(fn: (call: CallBusy) => void): Unsubscribe$3;
|
|
705
|
-
/** The other side ended a connected call. */
|
|
706
|
-
onEnded(fn: (call: CallEnded) => void): Unsubscribe$3;
|
|
707
|
-
/** An inbound ring was withdrawn before you answered. */
|
|
708
|
-
onCancelled(fn: (call: CallCancelled) => void): Unsubscribe$3;
|
|
709
|
-
/**
|
|
710
|
-
* One Phoenix binding per event regardless of listener count; we fan
|
|
711
|
-
* out ourselves, matching how the conversation channels do it.
|
|
712
|
-
*/
|
|
713
|
-
private bind;
|
|
714
|
-
private request;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
/**
|
|
718
|
-
* A voice room bound to one conversation.
|
|
719
|
-
*
|
|
720
|
-
* Wraps poolse's `voice:conversation:<id>` channel and drives a WebRTC
|
|
721
|
-
* mesh over it: one peer connection per participant, negotiated with
|
|
722
|
-
* offer / answer / ICE relayed by the server.
|
|
723
|
-
*
|
|
724
|
-
* Two shapes are built on this:
|
|
725
|
-
*
|
|
726
|
-
* * Discord-style — call `join()` directly and everyone in the room
|
|
727
|
-
* hears each other.
|
|
728
|
-
* * WhatsApp-style — ring first via `poolse.calls`, then both sides
|
|
729
|
-
* `join()` once the callee accepts.
|
|
730
|
-
*
|
|
731
|
-
* A mesh costs each participant N-1 upstreams, which is fine for small
|
|
732
|
-
* rooms and wrong past roughly six concurrent speakers; that's where an
|
|
733
|
-
* SFU belongs.
|
|
734
|
-
*/
|
|
735
|
-
|
|
736
|
-
type Unsubscribe$2 = () => void;
|
|
737
|
-
declare class VoiceRoom {
|
|
738
|
-
readonly conversationId: string;
|
|
739
|
-
private readonly socket;
|
|
740
|
-
private readonly webrtc;
|
|
741
|
-
private iceServers;
|
|
742
|
-
private readonly iceServersProvider;
|
|
743
|
-
private readonly detectSpeaking;
|
|
744
|
-
private channel;
|
|
745
|
-
private localStream;
|
|
746
|
-
private selfId;
|
|
747
|
-
private status;
|
|
748
|
-
private muted;
|
|
749
|
-
private readonly peers;
|
|
750
|
-
private readonly sinks;
|
|
751
|
-
/** Candidates that landed before their offer/answer did. */
|
|
752
|
-
private readonly pendingIce;
|
|
753
|
-
private readonly roster;
|
|
754
|
-
/**
|
|
755
|
-
* How many callers currently hold this room open.
|
|
756
|
-
*
|
|
757
|
-
* `PoolseRealtime` hands out ONE room per conversation, so a call
|
|
758
|
-
* screen and an always-on voice bar for the same conversation share
|
|
759
|
-
* this instance — which is correct, since a user is in one audio
|
|
760
|
-
* session, not two. Without counting, whichever of them tore down
|
|
761
|
-
* first would cut the audio out from under the other.
|
|
762
|
-
*/
|
|
763
|
-
private holders;
|
|
764
|
-
private speakingTimer;
|
|
765
|
-
private stopSpeakingDetection;
|
|
766
|
-
private readonly statusListeners;
|
|
767
|
-
private readonly rosterListeners;
|
|
768
|
-
private readonly errorListeners;
|
|
769
|
-
constructor(conversationId: string, socket: Socket, opts?: VoiceRoomOptions);
|
|
770
|
-
getStatus(): VoiceStatus;
|
|
771
|
-
isMuted(): boolean;
|
|
772
|
-
/** Everyone in the room, oldest join first. */
|
|
773
|
-
getParticipants(): VoiceParticipant[];
|
|
774
|
-
onStatus(fn: (status: VoiceStatus) => void): Unsubscribe$2;
|
|
775
|
-
onParticipants(fn: (participants: VoiceParticipant[]) => void): Unsubscribe$2;
|
|
776
|
-
onError(fn: (err: Error) => void): Unsubscribe$2;
|
|
777
|
-
/** Acquire the mic, join the channel, and start negotiating. */
|
|
778
|
-
join(): Promise<void>;
|
|
779
|
-
/** Announce departure, then drop every peer connection and the mic. */
|
|
780
|
-
leave(): void;
|
|
781
|
-
/** Mute or unmute the local mic. Returns the new muted state. */
|
|
782
|
-
setMuted(muted: boolean): boolean;
|
|
783
|
-
toggleMute(): boolean;
|
|
784
|
-
private bindChannel;
|
|
785
|
-
/**
|
|
786
|
-
* Refresh ICE servers from the provider, if there is one.
|
|
787
|
-
*
|
|
788
|
-
* Never throws. A room that refused to connect because the ICE
|
|
789
|
-
* endpoint was briefly unreachable would be a worse outcome than one
|
|
790
|
-
* that connects without TURN — which is exactly how calls behaved
|
|
791
|
-
* before TURN existed, and works on most networks.
|
|
792
|
-
*/
|
|
793
|
-
private resolveIceServers;
|
|
794
|
-
/**
|
|
795
|
-
* Glare control: both sides learn about each other simultaneously, so
|
|
796
|
-
* without a rule both would offer at once. The lexicographically lower
|
|
797
|
-
* user id offers and the higher answers — deterministic, no extra
|
|
798
|
-
* round trip.
|
|
799
|
-
*/
|
|
800
|
-
private shouldOffer;
|
|
801
|
-
private startNegotiation;
|
|
802
|
-
private ensurePeer;
|
|
803
|
-
private handleSignal;
|
|
804
|
-
private flushIce;
|
|
805
|
-
/**
|
|
806
|
-
* Every signal body travels under `data` — the server's
|
|
807
|
-
* `validate_signal_data/1` rejects the push outright when that key is
|
|
808
|
-
* missing or empty, and a rejected signal is never relayed.
|
|
809
|
-
*/
|
|
810
|
-
private sendSignal;
|
|
811
|
-
private startSpeakingDetection;
|
|
812
|
-
private closePeer;
|
|
813
|
-
private teardown;
|
|
814
|
-
private patchParticipant;
|
|
815
|
-
private setStatus;
|
|
816
|
-
private emitRoster;
|
|
817
|
-
private emitError;
|
|
818
|
-
}
|
|
819
|
-
|
|
820
455
|
type Fetcher = PoolseConfig['getToken'];
|
|
821
456
|
interface GetTokenOptions {
|
|
822
457
|
/** Bypass the cache and force a fresh call to the consumer's `getToken`. */
|
|
@@ -907,8 +542,11 @@ interface LiveCall {
|
|
|
907
542
|
started_at: string | null;
|
|
908
543
|
ended_at: string | null;
|
|
909
544
|
participants: LiveCallMember[];
|
|
910
|
-
/**
|
|
911
|
-
|
|
545
|
+
/**
|
|
546
|
+
* Callee user id → `ringing` (their ring is out right now) | `answered`
|
|
547
|
+
* | `declined` | `missed` (rang out unanswered).
|
|
548
|
+
*/
|
|
549
|
+
ring_states: Record<string, 'ringing' | 'answered' | 'declined' | 'missed'>;
|
|
912
550
|
}
|
|
913
551
|
/**
|
|
914
552
|
* `/v1/conversations/:id/call` — whether a call is running on a
|
|
@@ -1037,24 +675,15 @@ interface RealtimeOptions {
|
|
|
1037
675
|
* swapping http(s) → ws(s).
|
|
1038
676
|
*/
|
|
1039
677
|
wsUrl?: string;
|
|
1040
|
-
/**
|
|
1041
|
-
* Resolves ICE servers for voice rooms. Wired by `Poolse` to
|
|
1042
|
-
* `GET /v1/ice-servers` so TURN reaches every room without the app
|
|
1043
|
-
* plumbing anything.
|
|
1044
|
-
*/
|
|
1045
|
-
iceServersProvider?: () => Promise<VoiceIceServer[]>;
|
|
1046
678
|
}
|
|
1047
679
|
declare class PoolseRealtime {
|
|
1048
680
|
private readonly config;
|
|
1049
681
|
private readonly tokenCache;
|
|
1050
682
|
private readonly socketPath;
|
|
1051
|
-
private readonly iceServersProvider;
|
|
1052
683
|
private readonly wsUrl;
|
|
1053
684
|
private socket;
|
|
1054
685
|
private readonly conversations;
|
|
1055
|
-
private readonly voiceRooms;
|
|
1056
686
|
private userChannel;
|
|
1057
|
-
private callsResource;
|
|
1058
687
|
private status;
|
|
1059
688
|
private readonly statusListeners;
|
|
1060
689
|
constructor(config: ResolvedConfig, tokenCache: TokenCache, opts?: RealtimeOptions);
|
|
@@ -1101,25 +730,6 @@ declare class PoolseRealtime {
|
|
|
1101
730
|
* matching the JWT can join — poolse's UserChannel enforces this.
|
|
1102
731
|
*/
|
|
1103
732
|
user(userId: string): UserChannel;
|
|
1104
|
-
/**
|
|
1105
|
-
* Voice room for a conversation — the Discord-style surface. Call
|
|
1106
|
-
* `join()` on the returned handle to acquire the mic and connect;
|
|
1107
|
-
* reusing the same id returns the same room rather than opening a
|
|
1108
|
-
* second one.
|
|
1109
|
-
*
|
|
1110
|
-
* Ringing somebody who hasn't joined is a separate concern; see
|
|
1111
|
-
* `poolse.calls`.
|
|
1112
|
-
*/
|
|
1113
|
-
voice(conversationId: string, opts?: VoiceRoomOptions): VoiceRoom;
|
|
1114
|
-
/**
|
|
1115
|
-
* Call invitations for a user — the WhatsApp-style surface. Rides the
|
|
1116
|
-
* `user:<id>` topic, the one channel a client is always joined to, so
|
|
1117
|
-
* a ring reaches somebody who hasn't opened a voice room yet.
|
|
1118
|
-
*
|
|
1119
|
-
* Takes the user id explicitly, mirroring `user(userId)`; the SDK
|
|
1120
|
-
* never assumes whose token it is holding.
|
|
1121
|
-
*/
|
|
1122
|
-
calls(userId: string): CallsResource;
|
|
1123
733
|
/** Drop a conversation handle and leave the channel. */
|
|
1124
734
|
leave(conversationId: string): void;
|
|
1125
735
|
private setStatus;
|
|
@@ -1175,8 +785,9 @@ declare class UserChannel {
|
|
|
1175
785
|
private conversationUpdatedBound;
|
|
1176
786
|
constructor(userId: string, channel: Channel);
|
|
1177
787
|
/**
|
|
1178
|
-
* The underlying Phoenix channel, for
|
|
1179
|
-
*
|
|
788
|
+
* The underlying Phoenix channel, for hosts that listen to events the
|
|
789
|
+
* handle has no method for (a native call host forwards
|
|
790
|
+
* `call:ring_ended` / `call:finished` to its call core).
|
|
1180
791
|
*
|
|
1181
792
|
* @internal
|
|
1182
793
|
*/
|
|
@@ -1561,8 +1172,8 @@ declare class UsersResource {
|
|
|
1561
1172
|
/**
|
|
1562
1173
|
* Structural types for `livekit-client`.
|
|
1563
1174
|
*
|
|
1564
|
-
* Declared here rather than imported
|
|
1565
|
-
*
|
|
1175
|
+
* Declared here rather than imported because the module is passed IN by
|
|
1176
|
+
* the app. tsup rewrites a literal
|
|
1566
1177
|
* `require()` into `__require()`, which Metro cannot follow, so a
|
|
1567
1178
|
* dependency this package imports for itself is absent from every React
|
|
1568
1179
|
* Native bundle — development builds included. That failure already cost
|
|
@@ -1922,8 +1533,7 @@ declare class CallRoom {
|
|
|
1922
1533
|
* livekit-client does NOT play remote audio for you on the web — that
|
|
1923
1534
|
* is what `@livekit/components-react`'s `<RoomAudioRenderer />` exists
|
|
1924
1535
|
* to do. Without this a call connects, the roster is right, video
|
|
1925
|
-
* flows, and nobody hears anything.
|
|
1926
|
-
* this (see `webrtc-browser.ts`); the SFU path has to as well.
|
|
1536
|
+
* flows, and nobody hears anything.
|
|
1927
1537
|
*
|
|
1928
1538
|
* Empty on React Native, where there is no DOM and LiveKit routes
|
|
1929
1539
|
* audio through the native audio session instead.
|
|
@@ -2051,25 +1661,6 @@ declare class CallRoom {
|
|
|
2051
1661
|
getSelfId(): string | null;
|
|
2052
1662
|
}
|
|
2053
1663
|
|
|
2054
|
-
interface IceServerResponse {
|
|
2055
|
-
ice_servers: VoiceIceServer[];
|
|
2056
|
-
ttl_seconds: number;
|
|
2057
|
-
}
|
|
2058
|
-
/**
|
|
2059
|
-
* `/v1/ice-servers` — STUN, and TURN when the deployment has it.
|
|
2060
|
-
*
|
|
2061
|
-
* Fetched rather than configured because TURN credentials are
|
|
2062
|
-
* deliberately short-lived. A client that held a static one could not
|
|
2063
|
-
* refresh it, and a TURN password compiled into a mobile binary is
|
|
2064
|
-
* extractable by anyone who wants it.
|
|
2065
|
-
*/
|
|
2066
|
-
declare class IceServersResource {
|
|
2067
|
-
private readonly client;
|
|
2068
|
-
constructor(client: RestClient);
|
|
2069
|
-
/** GET /v1/ice-servers */
|
|
2070
|
-
list(signal?: AbortSignal): Promise<IceServerResponse>;
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
1664
|
declare class Poolse {
|
|
2074
1665
|
/** `/v1/me` — current End User. */
|
|
2075
1666
|
readonly me: MeResource;
|
|
@@ -2108,8 +1699,6 @@ declare class Poolse {
|
|
|
2108
1699
|
* `config.wsUrl`.
|
|
2109
1700
|
*/
|
|
2110
1701
|
readonly realtime: PoolseRealtime;
|
|
2111
|
-
/** STUN/TURN servers for WebRTC — see `IceServersResource`. */
|
|
2112
|
-
readonly iceServers: IceServersResource;
|
|
2113
1702
|
/** SFU credentials for a call's media — see `CallTokensResource`. */
|
|
2114
1703
|
readonly callTokens: CallTokensResource;
|
|
2115
1704
|
/** Whether a call is running on a conversation — for a Join banner. */
|
|
@@ -2188,16 +1777,17 @@ declare class AuthError extends ApiError {
|
|
|
2188
1777
|
}
|
|
2189
1778
|
|
|
2190
1779
|
/**
|
|
2191
|
-
*
|
|
2192
|
-
*
|
|
2193
|
-
*
|
|
1780
|
+
* What a call carries.
|
|
1781
|
+
*
|
|
1782
|
+
* Fixed when the call is placed, and travelling with the ring rather
|
|
1783
|
+
* than the connection: CallKit shows a different answer button for a
|
|
1784
|
+
* video call and cannot be changed once the call is reported. Either
|
|
1785
|
+
* side can still turn their camera on or off mid-call — this is what
|
|
1786
|
+
* the call *opens* as.
|
|
2194
1787
|
*/
|
|
1788
|
+
type CallMedia = 'audio' | 'video';
|
|
2195
1789
|
|
|
2196
|
-
|
|
2197
|
-
declare function isWebRtcAvailable(): boolean;
|
|
2198
|
-
declare function createBrowserWebRtcAdapter(): WebRtcAdapter;
|
|
2199
|
-
|
|
2200
|
-
declare const version = "2.24.0";
|
|
1790
|
+
declare const version = "2.26.0";
|
|
2201
1791
|
|
|
2202
1792
|
type CallLogMedia = 'audio' | 'video';
|
|
2203
1793
|
/** What became of one person a call involved (the caller excluded). */
|
|
@@ -2309,4 +1899,4 @@ declare function formatCallLogPreview(preview: string | null | undefined, curren
|
|
|
2309
1899
|
|
|
2310
1900
|
declare function safeUuid(): string;
|
|
2311
1901
|
|
|
2312
|
-
export { type AddMemberOptions, ApiError, type Attachment, type AttachmentDownloadResponse, AttachmentHandle, type AttachmentOptions, type AttachmentProgressEvent, type AttachmentStatus, type AttachmentUploadInput, type AttachmentUploadRequest, type AttachmentUploadResponse, AttachmentsResource, AuthError, type
|
|
1902
|
+
export { type AddMemberOptions, ApiError, type Attachment, type AttachmentDownloadResponse, AttachmentHandle, type AttachmentOptions, type AttachmentProgressEvent, type AttachmentStatus, type AttachmentUploadInput, type AttachmentUploadRequest, type AttachmentUploadResponse, AttachmentsResource, AuthError, type CallConnection, type CallDevice, type CallDeviceKind, type CallEndReason, type CallFinishedEvent, type CallLog, type CallLogDisplay, type CallLogEntry, type CallLogMedia, type CallMedia, type CallMissedEntry, type CallParticipant, type CallParticipantStatus, type CallParticipantsEvent, CallRoom, type CallRoomOptions, type CallRoomStatus, type CallStartedEvent, CallTokensResource, type CameraFacing, type CheckedLiveKitModule, type Conversation, ConversationChannel, type ConversationCreateRequest, type ConversationCreatedEvent, ConversationHandle, type ConversationList, ConversationMessages, type ConversationType, type ConversationUpdateRequest, type ConversationUpdatedEvent, ConversationsResource, type Device, type DeviceEnvironment, type DeviceKind, type DevicePlatform, DevicesResource, type ErrorEnvelope, type IsoDateTime, type LiveCall, type LiveCallMember, LiveCallsResource, type LiveKitLocalVideoTrack, type LiveKitModule, type LiveKitParticipant, type LiveKitPublication, type LiveKitRoomHandle, type LiveKitTrack, type LiveKitTrackReference, type Me, MeResource, type MemberReadEvent, type MemberRole, type Membership, type MembershipCreateRequest, type MembershipList, type MentionEvent, type Message, type MessageCreateRequest, type MessageDeletedEvent, MessageHandle, type MessageList, type MessageNewEvent, type MessageType, type MessageUpdateRequest, type MessageUpdatedEvent, MessagesResource, NetworkError, POOLSE_API_URL, Poolse, type PoolseConfig, PoolseError, PoolseRealtime, type PoolseUserProfile, type PresenceSnapshot, type QuotedMessagePreview, RateLimitedError, type ReactionEvent, type ReactionRequest, type ReadReceiptsState, type ReadRequest, type RealtimeStatus, type RegisterDeviceRequest, type RoomSession, RoomsResource, type TypingEvent, type Unsubscribe$1 as Unsubscribe, type UpdateMeRequest, UserChannel, UsersResource, type Uuid, callLogDisplayFor, describeCallLog, formatCallDuration, formatCallLogPreview, isCallLogMessage, isMessageVisibleTo, parseCallLog, parseCallLogBody, safeUuid, version };
|