livekit-client
Advanced tools
Comparing version 0.7.1 to 0.7.3
import 'webrtc-adapter'; | ||
import { ParticipantInfo, TrackType } from '../proto/livekit_models'; | ||
import { JoinResponse, SignalRequest, SignalTarget, SpeakerInfo, TrackPublishedResponse, UpdateSubscription, UpdateTrackSettings } from '../proto/livekit_rtc'; | ||
interface SignalOptions { | ||
interface connectOpts { | ||
autoSubscribe?: boolean; | ||
usePlanB?: boolean; | ||
/** internal */ | ||
reconnect?: boolean; | ||
} | ||
export interface SignalOptions { | ||
autoSubscribe?: boolean; | ||
} | ||
/** | ||
@@ -13,3 +18,3 @@ * RTCClient is the signaling layer of WebRTC, it's LiveKit's signaling protocol | ||
export interface SignalClient { | ||
join(url: string, token: string, usePlanB?: boolean): Promise<JoinResponse>; | ||
join(url: string, token: string, usePlanB?: boolean, opts?: SignalOptions): Promise<JoinResponse>; | ||
reconnect(url: string, token: string): Promise<void>; | ||
@@ -49,5 +54,5 @@ sendOffer(offer: RTCSessionDescriptionInit): void; | ||
constructor(useJSON?: boolean); | ||
join(url: string, token: string, planB?: boolean): Promise<JoinResponse>; | ||
join(url: string, token: string, planB?: boolean, opts?: SignalOptions): Promise<JoinResponse>; | ||
reconnect(url: string, token: string): Promise<void>; | ||
connect(url: string, token: string, opts: SignalOptions): Promise<JoinResponse | void>; | ||
connect(url: string, token: string, opts: connectOpts): Promise<JoinResponse | void>; | ||
close(): void; | ||
@@ -54,0 +59,0 @@ sendOffer(offer: RTCSessionDescriptionInit): void; |
@@ -25,6 +25,7 @@ "use strict"; | ||
} | ||
join(url, token, planB = false) { | ||
join(url, token, planB = false, opts) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.connect(url, token, { | ||
usePlanB: planB, | ||
autoSubscribe: opts === null || opts === void 0 ? void 0 : opts.autoSubscribe, | ||
}); | ||
@@ -49,2 +50,5 @@ return res; | ||
} | ||
if (opts.autoSubscribe !== undefined) { | ||
url += '&auto_subscribe=' + (opts.autoSubscribe ? '1' : '0'); | ||
} | ||
return new Promise((resolve, reject) => { | ||
@@ -51,0 +55,0 @@ loglevel_1.default.debug('connecting to', url); |
@@ -62,3 +62,5 @@ "use strict"; | ||
// connect to room | ||
yield room.connect(url, token); | ||
yield room.connect(url, token, { | ||
autoSubscribe: options === null || options === void 0 ? void 0 : options.autoSubscribe, | ||
}); | ||
// add tracks if available | ||
@@ -65,0 +67,0 @@ let tracks = options.tracks; |
@@ -15,2 +15,4 @@ import { LocalTrack } from './room/track/types'; | ||
simulcast?: boolean; | ||
/** autosubscribe to room tracks upon connect, defaults to true */ | ||
autoSubscribe?: boolean; | ||
/** | ||
@@ -17,0 +19,0 @@ * configures LiveKit internal log level |
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
import { Participant } from '..'; | ||
import { SignalClient } from '../api/SignalClient'; | ||
import { SignalClient, SignalOptions } from '../api/SignalClient'; | ||
import { LocalParticipant } from './participant/LocalParticipant'; | ||
@@ -41,3 +41,3 @@ import { RemoteParticipant } from './participant/RemoteParticipant'; | ||
/** @internal */ | ||
connect: (url: string, token: string) => Promise<Room>; | ||
connect: (url: string, token: string, opts?: SignalOptions | undefined) => Promise<Room>; | ||
/** | ||
@@ -44,0 +44,0 @@ * disconnects the room, emits [[RoomEvent.Disconnected]] |
@@ -50,3 +50,3 @@ "use strict"; | ||
/** @internal */ | ||
this.connect = (url, token) => __awaiter(this, void 0, void 0, function* () { | ||
this.connect = (url, token, opts) => __awaiter(this, void 0, void 0, function* () { | ||
// guard against calling connect | ||
@@ -58,3 +58,3 @@ if (this.localParticipant) { | ||
try { | ||
const joinResponse = yield this.engine.join(url, token); | ||
const joinResponse = yield this.engine.join(url, token, opts); | ||
loglevel_1.default.debug('connected to Livekit Server', joinResponse.serverVersion); | ||
@@ -61,0 +61,0 @@ if (!joinResponse.serverVersion) { |
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
import { SignalClient } from '../api/SignalClient'; | ||
import { SignalClient, SignalOptions } from '../api/SignalClient'; | ||
import { TrackInfo } from '../proto/livekit_models'; | ||
@@ -26,3 +26,3 @@ import { JoinResponse } from '../proto/livekit_rtc'; | ||
constructor(client: SignalClient, config?: RTCConfiguration); | ||
join(url: string, token: string): Promise<JoinResponse>; | ||
join(url: string, token: string, opts?: SignalOptions): Promise<JoinResponse>; | ||
close(): void; | ||
@@ -29,0 +29,0 @@ addTrack(cid: string, name: string, kind: Track.Kind): Promise<TrackInfo>; |
@@ -80,7 +80,7 @@ "use strict"; | ||
} | ||
join(url, token) { | ||
join(url, token, opts) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.url = url; | ||
this.token = token; | ||
const joinResponse = yield this.client.join(url, token, this.useLegacy); | ||
const joinResponse = yield this.client.join(url, token, this.useLegacy, opts); | ||
if (joinResponse.iceServers && !this.rtcConfig.iceServers) { | ||
@@ -87,0 +87,0 @@ this.rtcConfig.iceServers = []; |
@@ -25,3 +25,3 @@ "use strict"; | ||
setSubscribed(subscribed) { | ||
this.subscribe = !subscribed; | ||
this.subscribe = subscribed; | ||
const sub = { | ||
@@ -28,0 +28,0 @@ trackSids: [this.trackSid], |
@@ -1,2 +0,2 @@ | ||
export declare const version = "0.7.1"; | ||
export declare const version = "0.7.3"; | ||
export declare const protocolVersion = 2; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.protocolVersion = exports.version = void 0; | ||
exports.version = '0.7.1'; | ||
exports.version = '0.7.3'; | ||
exports.protocolVersion = 2; | ||
//# sourceMappingURL=version.js.map |
@@ -65,6 +65,2 @@ import { | ||
if (track instanceof AudioTrack || track instanceof VideoTrack) { | ||
// const element: HTMLMediaElement = <HTMLMediaElement>( | ||
// document.createElement(track.kind.toString()) | ||
// ); | ||
// track.attach(element); | ||
const element = track.attach(); | ||
@@ -352,10 +348,1 @@ div.appendChild(element); | ||
} | ||
// uncomment to autoconnect after page load | ||
// setTimeout(() => { | ||
// window.connectToRoom( | ||
// // 'ws://localhost:7880', | ||
// 'ws://livekit-demo-1036575819.us-east-1.elb.amazonaws.com', | ||
// 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MTU2MTUwOTAsImlzcyI6IkFQSXU5SmpLdFpubXRLQmtjcXNFOUJuZkgiLCJqdGkiOiJtZSIsIm1ldGFkYXRhIjp7Im9yZGVyIjoxfSwibmJmIjoxNjEzMDIzMDkwLCJ2aWRlbyI6eyJyb29tIjoibXlyb29tIiwicm9vbUpvaW4iOnRydWV9fQ.MGEzYSO-Vh8gT1iwE_C8x63Km6f5EuqXVP8HKp4qXJA' | ||
// ); | ||
// }, 100); |
{ | ||
"name": "livekit-client", | ||
"version": "0.7.1", | ||
"version": "0.7.3", | ||
"description": "JavaScript/TypeScript client SDK for LiveKit", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1985891
0