@vindral/web-sdk 2.1.3 → 2.2.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/index.d.ts CHANGED
@@ -14,6 +14,7 @@ interface CodedAudioSample extends BaseCodedSample {
14
14
  codec: AudioCodec;
15
15
  channels: number;
16
16
  sampleRate: number;
17
+ language?: string;
17
18
  }
18
19
  interface CodedVideoSample extends BaseCodedSample {
19
20
  type: "video";
@@ -443,6 +444,7 @@ declare class BufferTimeModule {
443
444
  }
444
445
  interface VindralErrorProps {
445
446
  isFatal: boolean;
447
+ type?: ErrorType;
446
448
  code: string;
447
449
  source?: Error | MediaError;
448
450
  }
@@ -456,6 +458,8 @@ export declare const INACTIVITY_CODE = "connection_inactivity";
456
458
  export declare const MISSING_INIT_SEGMENT = "missing_init_segment";
457
459
  export declare const NO_TRACK_CONTEXT = "no_track_context";
458
460
  export declare const DISCONNECTED_BY_EDGE = "disconnected_by_edge";
461
+ export declare const DECODER_ERROR = "decoder_error";
462
+ export declare type ErrorType = "internal" | "external";
459
463
  export declare class VindralError extends Error {
460
464
  private props;
461
465
  private extra;
@@ -463,17 +467,19 @@ export declare class VindralError extends Error {
463
467
  code: () => string;
464
468
  isFatal: () => boolean;
465
469
  source: () => Error | MediaError | undefined;
470
+ type: () => ErrorType;
466
471
  toStringifiable: () => Record<string, unknown>;
467
472
  }
468
473
  export declare const mediaElementError: (isFatal: boolean, source: MediaError) => VindralError;
474
+ export declare const decoderError: (isFatal: boolean, source: Error) => VindralError;
469
475
  export declare const missingInitSegmentError: (renditionId: number, channelId: string) => VindralError;
470
476
  export declare const noTrackContextError: (type: "audio" | "video", renditionId: number, channelId: string) => VindralError;
471
477
  export declare const audioContextTimeoutError: () => VindralError;
472
478
  export declare const disconnectedFromEdgeServerError: (source?: VindralError | undefined) => VindralError;
473
479
  export declare const authenticationError: (source?: Error | undefined) => VindralError;
474
480
  export declare const authenticationExpiredError: (source?: Error | undefined) => VindralError;
475
- export declare const inactivityError: (source?: Error | undefined) => VindralError;
476
- export declare const channelNotFoundError: (source?: Error | undefined) => VindralError;
481
+ export declare const inactivityError: (type: ErrorType, source?: Error | undefined) => VindralError;
482
+ export declare const channelNotFoundError: (type: ErrorType, source?: Error | undefined) => VindralError;
477
483
  export declare const noIncomingDataError: (source?: Error | undefined) => VindralError;
478
484
  export declare const unableToConnectError: (source?: Error | undefined) => VindralError;
479
485
  export declare const unableToConnectAfterRetriesError: () => VindralError;
@@ -698,11 +704,13 @@ interface DecoderContext<Type extends "audio" | "video"> {
698
704
  initSegment(initSegment: Readonly<InitSegment>): void;
699
705
  enqueue(sample: Readonly<DecoderParamType<Type>>): void;
700
706
  take(): DecoderReturnType<Type> | undefined;
707
+ error?: () => Error | undefined;
701
708
  }
702
709
  interface DecoderModuleEvents {
703
710
  ["video decode rate"]: number;
704
711
  ["decoded frame"]: Readonly<DecodedSample>;
705
712
  ["buffer state"]: Readonly<BufferState>;
713
+ ["error"]: Readonly<VindralError>;
706
714
  }
707
715
  interface DecoderModuleListeners {
708
716
  ["init segment"]: Readonly<InitSegment>;
@@ -793,6 +801,50 @@ declare class DocumentStateModule implements DocumentState {
793
801
  private onVisibilityChanged;
794
802
  private setIsActive;
795
803
  }
804
+ interface EventModuleEvents {
805
+ ["event"]: Readonly<StoredEvent>;
806
+ }
807
+ interface TimeSource {
808
+ readonly drift: number | undefined;
809
+ readonly serverCurrentTime: number;
810
+ }
811
+ interface BaseEvent {
812
+ timestamp: number;
813
+ }
814
+ declare type TimestampAdded = {
815
+ timestampAdded: number;
816
+ };
817
+ interface Metadata extends BaseEvent {
818
+ type: "metadata";
819
+ content: string;
820
+ }
821
+ interface ChannelSwitch extends BaseEvent {
822
+ type: "channel switch";
823
+ channelId: string;
824
+ }
825
+ interface LanguageSwitch extends BaseEvent {
826
+ type: "language switch";
827
+ language: string;
828
+ }
829
+ declare type Event = Metadata | ChannelSwitch | LanguageSwitch;
830
+ declare type StoredEvent = TimestampAdded & Event;
831
+ declare class EventModule {
832
+ private static EVENT_TIMEOUT;
833
+ private static EVENT_CHECK_INTERVAL;
834
+ private logger;
835
+ private emitter;
836
+ private waitingEvents;
837
+ private isTriggered;
838
+ private timeSource;
839
+ private timers;
840
+ constructor(emitter: Emitter<unknown, EventModuleEvents>, logger: Logger, timeSource: TimeSource);
841
+ load: () => void;
842
+ unload: () => void;
843
+ static create: (emitter: Emitter<unknown, EventModuleEvents>, logger: Logger, timeSource: TimeSource) => EventModule;
844
+ addEvent: (event: Event) => void;
845
+ extractEvent: (previousSample: CodedSample, sample: CodedSample) => void;
846
+ private onBufferedStateChanged;
847
+ }
796
848
  interface IncomingDataModuleListeners {
797
849
  ["connection state"]: Readonly<State>;
798
850
  }
@@ -836,29 +888,6 @@ declare class LoggerModule {
836
888
  unload: () => void;
837
889
  private onLog;
838
890
  }
839
- interface MetadataModuleEvents {
840
- ["metadata"]: Readonly<Metadata>;
841
- }
842
- interface TimeSource {
843
- readonly drift: number | undefined;
844
- readonly serverCurrentTime: number;
845
- }
846
- declare class MetadataModule {
847
- private static METADATA_TIMEOUT;
848
- private static METADATA_CHECK_INTERVAL;
849
- private logger;
850
- private emitter;
851
- private waitingMetadata;
852
- private isTriggered;
853
- private timeSource;
854
- private timers;
855
- constructor(emitter: Emitter<unknown, MetadataModuleEvents>, logger: Logger, timeSource: TimeSource);
856
- load: () => void;
857
- unload: () => void;
858
- static create: (emitter: Emitter<unknown, MetadataModuleEvents>, logger: Logger, timeSource: TimeSource) => MetadataModule;
859
- addMetadata: (metadata: Metadata) => void;
860
- private onBufferedStateChanged;
861
- }
862
891
  interface MseModuleEvents {
863
892
  ["error"]: Readonly<VindralError>;
864
893
  }
@@ -1391,7 +1420,7 @@ export interface Modules {
1391
1420
  subscription: SubscriptionModule;
1392
1421
  renditions: RenditionsModule;
1393
1422
  qualityOfService: QualityOfServiceModule;
1394
- metadata: MetadataModule;
1423
+ event: EventModule;
1395
1424
  sync: SyncModule;
1396
1425
  telemetry?: TelemetryModule;
1397
1426
  documentState: DocumentStateModule;
@@ -1421,6 +1450,7 @@ export interface Options {
1421
1450
  burstEnabled?: boolean;
1422
1451
  mseEnabled?: boolean;
1423
1452
  mseOpusEnabled?: boolean;
1453
+ iosBackgroundPlayEnabled?: boolean;
1424
1454
  abrEnabled?: boolean;
1425
1455
  maxSize?: Size;
1426
1456
  maxAudioBitRate?: number;
@@ -1437,6 +1467,12 @@ export interface Options {
1437
1467
  advanced?: AdvancedOptions;
1438
1468
  media?: Media;
1439
1469
  }
1470
+ export interface LanguageSwitchContext {
1471
+ language: string;
1472
+ }
1473
+ export interface ChannelSwitchContext {
1474
+ channelId: string;
1475
+ }
1440
1476
  export interface PublicVindralEvents {
1441
1477
  ["error"]: Readonly<VindralError>;
1442
1478
  ["needs user input"]: NeedsUserInputContext;
@@ -1450,6 +1486,8 @@ export interface PublicVindralEvents {
1450
1486
  ["context switch"]: Readonly<ContextSwitchState>;
1451
1487
  ["server wallclock time"]: Readonly<number>;
1452
1488
  ["is live"]: boolean;
1489
+ ["channel switch"]: Readonly<ChannelSwitchContext>;
1490
+ ["language switch"]: Readonly<LanguageSwitchContext>;
1453
1491
  ["buffer state event"]: Readonly<BufferStateEvent>;
1454
1492
  ["initialized media"]: void;
1455
1493
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vindral/web-sdk",
3
- "version": "2.1.3",
3
+ "version": "2.2.0",
4
4
  "homepage": "https://vindral.com",
5
5
  "description": "Web SDK for viewing Vindral streams",
6
6
  "license": "SEE LICENSE IN https://www.vindral.com/terms-conditions",