@livedigital/client 1.1.5 → 1.4.1

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/README.md CHANGED
@@ -17,6 +17,32 @@ import Client from '@livedigital/client';
17
17
  const client = new Client();
18
18
  ```
19
19
 
20
+ ## Debugging
21
+ ### Log Levels
22
+ LiveDigital client uses the [debug](https://www.npmjs.com/package/debug) module to log to the browser console.
23
+
24
+ There are three log severities:
25
+
26
+ - **debug**: verbose information logged to console.info
27
+ - **warn**: warning messages logged to console.warn
28
+ - **error**: error messages logged to console.error
29
+
30
+ All the logs generated by LiveDigital client have a namespace starting with “LiveDigital” plus colon, followed by the log severity in upper case plus colon (just if “warn” or “error”), and followed by the internal component name (if any) and the log message.
31
+
32
+ ### Enable Logging
33
+ By default logging is turned off. In order to enable it, the debug key in the browser's localStorage must be set.
34
+ >Check the [debug](https://www.npmjs.com/package/debug) module documentation for further information regarding how to filter specific log messages based on namespace matching rules.
35
+
36
+ ### Example
37
+ Within the <head> section of your HTML app:
38
+ ```
39
+ <script>
40
+ window.localStorage.setItem('debug', 'LiveDigital:*');
41
+ </script>
42
+
43
+ <script src='/js/your-bundled-app.js'></script>
44
+ ```
45
+
20
46
  ## Contributing
21
47
  Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
22
48
 
@@ -6,8 +6,10 @@ export declare const CHANNEL_EVENTS: {
6
6
  };
7
7
  export declare const CLIENT_EVENTS: {
8
8
  channelEvent: string;
9
- channelJoin: string;
9
+ peerJoined: string;
10
+ peerLeft: string;
10
11
  channelLeave: string;
12
+ channelRejoinRequired: string;
11
13
  };
12
14
  export declare const PEER_EVENTS: {
13
15
  mediaPublished: string;
@@ -28,7 +28,7 @@ declare class Peer {
28
28
  originPeerId?: string;
29
29
  loginDate: Date;
30
30
  uid?: string;
31
- appData: {};
31
+ appData: Record<string, unknown>;
32
32
  private videoProducer?;
33
33
  private audioProducer?;
34
34
  private videoConsumer?;
@@ -36,7 +36,7 @@ declare class Peer {
36
36
  private readonly engine;
37
37
  private readonly _observer;
38
38
  private readonly logger;
39
- constructor({ id, channelId, appId, loginDate, isVirtual, originChannelId, originPeerId, producers, videoConsumer, audioConsumer, engine, appData, }: PeerConstructor);
39
+ constructor({ id, channelId, appId, loginDate, isVirtual, originChannelId, originPeerId, producers, videoConsumer, audioConsumer, engine, appData, uid, }: PeerConstructor);
40
40
  get observer(): EnhancedEventEmitter;
41
41
  get isPublishedVideo(): boolean;
42
42
  get isPublishedAudio(): boolean;
@@ -1,9 +1,8 @@
1
1
  import Engine from '../index';
2
2
  declare class ChannelEventHandler {
3
3
  private readonly engine;
4
+ private readonly logger;
4
5
  constructor(engine: Engine);
5
6
  subscribeToEvents(): void;
6
- unsubscribeEvents(): void;
7
- private removeEventListeners;
8
7
  }
9
8
  export default ChannelEventHandler;
@@ -1,9 +1,8 @@
1
1
  import Engine from '../index';
2
2
  declare class MediaSoupEventHandler {
3
3
  private readonly engine;
4
+ private readonly logger;
4
5
  constructor(engine: Engine);
5
6
  subscribeToEvents(): void;
6
- unsubscribeEvents(): void;
7
- private removeEventListeners;
8
7
  }
9
8
  export default MediaSoupEventHandler;
@@ -10,7 +10,7 @@ declare class Engine {
10
10
  network: Network;
11
11
  media: Media;
12
12
  clientEventEmitter: EnhancedEventEmitter;
13
- private peersRepository;
13
+ private readonly peersRepository;
14
14
  private channelEventsHandler;
15
15
  private mediaSoupEventsHandler;
16
16
  private initialized;
@@ -27,8 +27,8 @@ declare class Engine {
27
27
  join(params: JoinChannelParams): Promise<void>;
28
28
  setPeer(peerData: PeerResponse): void;
29
29
  removePeer(peerId: string): void;
30
- publishVideo(encodings?: RtpEncodingParameters[]): Promise<void>;
31
- publishAudio(): Promise<void>;
30
+ publishVideo(encodings?: RtpEncodingParameters[], track?: MediaStreamTrack): Promise<void>;
31
+ publishAudio(track?: MediaStreamTrack): Promise<void>;
32
32
  unpublishVideo(): Promise<void>;
33
33
  unpublishAudio(): Promise<void>;
34
34
  pauseVideo(): Promise<void>;
@@ -1,21 +1,19 @@
1
- /// <reference types="socket.io-client" />
1
+ import { Socket } from 'socket.io-client';
2
2
  import EnhancedEventEmitter from '../../EnhancedEventEmitter';
3
3
  import { SocketResponse } from '../../types/common';
4
4
  declare class SocketIO {
5
- connection?: SocketIOClient.Socket;
5
+ connection?: Socket;
6
6
  connectionError?: string;
7
7
  disconnectReason?: string;
8
8
  reconnectingAttempt: number;
9
9
  private serverUrl?;
10
10
  private isConnected;
11
- private isReconnected;
12
- private isReconnecting;
13
11
  private readonly _observer;
14
12
  private readonly logger;
15
13
  constructor();
16
14
  get observer(): EnhancedEventEmitter;
17
15
  get id(): string | undefined;
18
- connect(serverUrl: string): SocketIOClient.Socket;
16
+ connect(serverUrl: string): void;
19
17
  disconnect(): void;
20
18
  request(type: string, data?: {}): Promise<SocketResponse>;
21
19
  }
@@ -9,8 +9,6 @@ declare class System {
9
9
  availableAudioDevices: MediaDeviceInfo[];
10
10
  currentAudioDeviceId?: string;
11
11
  currentVideoDeviceId?: string;
12
- getUserMediaError?: string;
13
- deviceIsBusy?: boolean;
14
12
  private readonly logger;
15
13
  constructor();
16
14
  setIsEnableVideoDevicesLock(value: boolean): void;
@@ -21,9 +19,12 @@ declare class System {
21
19
  setAvailableAudioDevices(availableAudioDevices: MediaDeviceInfo[]): void;
22
20
  getVideoConstraints(params?: VideoConstraintParams): MediaTrackConstraints;
23
21
  getAudioConstraints(params?: AudioConstraintParams): MediaTrackConstraints;
24
- startVideoStream(params?: VideoConstraintParams): Promise<MediaStream | undefined>;
25
- startAudioStream(params?: AudioConstraintParams): Promise<MediaStream | undefined>;
22
+ getVideoTrack(): Promise<MediaStreamTrack>;
23
+ getAudioTrack(): Promise<MediaStreamTrack>;
24
+ startVideoStream(params?: VideoConstraintParams): Promise<MediaStream>;
25
+ startAudioStream(params?: AudioConstraintParams): Promise<MediaStream>;
26
26
  detectDevices(): Promise<void>;
27
+ listenDevices(): void;
27
28
  stopVideoStream(): void;
28
29
  stopAudioStream(): void;
29
30
  restartVideoStream(): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -12,7 +12,15 @@ declare class Client {
12
12
  get isVideoPaused(): boolean;
13
13
  get isAudioEnabled(): boolean;
14
14
  get isAudioPaused(): boolean;
15
- getDevices(): Promise<AvailableMediaDevices>;
15
+ get availableVideoDevices(): MediaDeviceInfo[];
16
+ get availableAudioDevices(): MediaDeviceInfo[];
17
+ get currentAudioDeviceId(): string | undefined;
18
+ get currentVideoDeviceId(): string | undefined;
19
+ detectDevices(): Promise<AvailableMediaDevices>;
20
+ getVideoStream(): Promise<MediaStream>;
21
+ getAudioStream(): Promise<MediaStream>;
22
+ getVideoTrack(): Promise<MediaStreamTrack>;
23
+ getAudioTrack(): Promise<MediaStreamTrack>;
16
24
  setVideoDevice(deviceId: string): void;
17
25
  setAudioDevice(deviceId: string): void;
18
26
  join(params: JoinChannelParams): Promise<void>;