@vindral/web-sdk 3.0.5 → 3.0.6

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
@@ -70,8 +70,8 @@ const player = new Player({
70
70
  channelId: "vindral_demo1_ci_099ee1fa-80f3-455e-aa23-3d184e93e04f",
71
71
  })
72
72
 
73
- // Starts connecting to the channel
74
- player.core.connect()
73
+ // Starts playback
74
+ player.core.play()
75
75
 
76
76
  // Attaches the player view to the DOM
77
77
  player.attach(root)
package/index.d.ts CHANGED
@@ -29,8 +29,17 @@ declare class Emitter<TEvents, TEmits = TEvents, ArgLessEvents extends VoidKeys<
29
29
  private add;
30
30
  }
31
31
  interface MinMaxAverage {
32
+ /**
33
+ * Average value over a given interval.
34
+ */
32
35
  average: number;
36
+ /**
37
+ * Maximum value over a given interval.
38
+ */
33
39
  max: number;
40
+ /**
41
+ * Minimum value over a given interval.
42
+ */
34
43
  min: number;
35
44
  }
36
45
  interface RenditionProps {
@@ -339,14 +348,24 @@ interface NeedsUserInputContext {
339
348
  declare type PlaybackState = "buffering" | "playing" | "paused";
340
349
  declare type BufferStateEvent = "filled" | "drained";
341
350
  interface PlaybackModuleStatistics {
351
+ /**
352
+ * Current target buffer time if using dynamic buffer. Otherwise, this is the statically set buffer time from instantiation.
353
+ */
342
354
  bufferTime: number;
343
355
  needsInputForAudioCount: number;
344
356
  needsInputForVideoCount: number;
345
357
  }
346
358
  interface AdaptivityStatistics {
359
+ /**
360
+ * True if adaptive bitrate (ABR) is enabled.
361
+ */
347
362
  isAbrEnabled: boolean;
348
363
  }
349
364
  interface BufferTimeStatistics {
365
+ /**
366
+ * Number of time buffer time has been adjusted. This will only happen when using dynamic buffer time
367
+ * (different min/max values of bufferTime).
368
+ */
350
369
  bufferTimeAdjustmentCount: number;
351
370
  }
352
371
  interface VindralErrorProps {
@@ -395,17 +414,35 @@ export declare class VindralError extends Error {
395
414
  declare type State = "connected" | "disconnected" | "connecting";
396
415
  declare type ContextSwitchState = "completed" | "started";
397
416
  interface ConnectionStatistics {
417
+ /**
418
+ * RTT (round trip time) between client and server(s).
419
+ */
398
420
  rtt: MinMaxAverage;
421
+ /**
422
+ * A very rough initial estimation of minimum available bandwidth.
423
+ */
399
424
  estimatedBandwidth: number;
400
425
  edgeUrl?: string;
426
+ /**
427
+ * Total number of connections that have been established since instantiation.
428
+ */
401
429
  connectCount: number;
430
+ /**
431
+ * Total number of connection attempts since instantiation.
432
+ */
402
433
  connectionAttemptCount: number;
403
434
  }
435
+ /**
436
+ * Represents a rendition (quality level).
437
+ */
404
438
  export interface RenditionLevel {
405
439
  audio?: AudioRendition;
406
440
  video?: VideoRendition;
407
441
  }
408
442
  declare type RenditionLevelChangedReason = "abr" | "manual";
443
+ /**
444
+ * Contextual information about the rendition level change.
445
+ */
409
446
  export interface RenditionLevelChanged {
410
447
  from?: RenditionLevel;
411
448
  to?: RenditionLevel;
@@ -416,19 +453,52 @@ interface RenditionLevel {
416
453
  video?: VideoRendition;
417
454
  }
418
455
  interface RenditionsModuleStatistics {
456
+ /**
457
+ * Id of current video rendition subscribed to.
458
+ */
419
459
  videoRenditionId?: number;
460
+ /**
461
+ * Id of current audio rendition subscribed to.
462
+ */
420
463
  audioRenditionId?: number;
464
+ /**
465
+ * Current video codec being used.
466
+ */
421
467
  videoCodec?: string;
468
+ /**
469
+ * Current audio codec being used.
470
+ */
422
471
  audioCodec?: string;
472
+ /**
473
+ * Width of current video rendition (if any).
474
+ */
423
475
  videoWidth?: number;
476
+ /**
477
+ * Height of current video rendition (if any).
478
+ */
424
479
  videoHeight?: number;
480
+ /**
481
+ * Currently expected video bit rate according to metadata in bits/s.
482
+ */
425
483
  expectedVideoBitRate?: number;
484
+ /**
485
+ * Currently expected audio bit rate according to metadata in bits/s.
486
+ */
426
487
  expectedAudioBitRate?: number;
488
+ /**
489
+ * Current language. For non-multi language streams, this will often be unset.
490
+ */
427
491
  language?: string;
492
+ /**
493
+ * Frame rate. Example: `"frameRate": [24000, 1001]`.
494
+ */
428
495
  frameRate?: [
429
496
  number,
430
497
  number
431
498
  ];
499
+ /**
500
+ * Total count of rendition level changes (quality downgrades/upgrades).
501
+ */
432
502
  renditionLevelChangeCount: number;
433
503
  }
434
504
  interface VideoConstraintCap {
@@ -472,8 +542,17 @@ interface DocumentStateModulesStatistics {
472
542
  navigatorDownlink?: number;
473
543
  }
474
544
  interface IncomingDataModuleStatistics {
475
- videoBitRate: number;
476
- audioBitRate: number;
545
+ /**
546
+ * Current video bitrate in bits/second.
547
+ */
548
+ videoBitRate?: number;
549
+ /**
550
+ * Current audio bitrate in bits/second.
551
+ */
552
+ audioBitRate?: number;
553
+ /**
554
+ * Counter of number of bytes received.
555
+ */
477
556
  bytesReceived: number;
478
557
  }
479
558
  interface VideoPlayerStatistics {
@@ -491,9 +570,23 @@ interface MseModuleStatistics {
491
570
  successfulAudioAppendsCalls?: number;
492
571
  }
493
572
  interface QualityOfServiceModuleStatistics {
573
+ /**
574
+ * Time in milliseconds spent in buffering state. Note that this value will increase while in background if
575
+ * buffering when leaving foreground.
576
+ */
494
577
  timeSpentBuffering: number;
578
+ /**
579
+ * Total number of buffering events since instantiation.
580
+ */
495
581
  bufferingEventsCount: number;
582
+ /**
583
+ * Number of fatal quality of service events.
584
+ */
496
585
  fatalQosCount: number;
586
+ /**
587
+ * Ratio of time being spent on different bitrates.
588
+ * Example: `"timeSpentRatio": { "1160000": 0.2, "2260000": 0.8 }` shows 20% spent on 1.16 Mbps, 80% spent on 2.26 Mbps.
589
+ */
497
590
  timeSpentRatio: {
498
591
  [bitRate: string]: number;
499
592
  };
@@ -511,18 +604,53 @@ interface UserAgentInformation {
511
604
  ancestorOrigins?: string[];
512
605
  }
513
606
  declare type ModuleStatistics = AdaptivityStatistics & BufferTimeStatistics & ConnectionStatistics & ConstraintCapStatistics & DecoderStatistics & DocumentStateModulesStatistics & IncomingDataModuleStatistics & MseModuleStatistics & PlaybackModuleStatistics & QualityOfServiceModuleStatistics & RenditionsModuleStatistics & SyncModuleStatistics & TelemetryModuleStatistics & VideoPlayerStatistics;
514
- declare type Statistics = ModuleStatistics & UserAgentInformation & {
607
+ /**
608
+ * Contains internal statistics.
609
+ *
610
+ * Note that this object will have some undocumented properties, used internally or temporarily,
611
+ * for monitoring and improving the performance of the service.
612
+ *
613
+ * @interface
614
+ */
615
+ export declare type Statistics = ModuleStatistics & UserAgentInformation & {
616
+ /**
617
+ * Version of the @vindral/web-sdk being used.
618
+ */
515
619
  version: string;
620
+ /**
621
+ * IP of the client.
622
+ */
516
623
  ip?: string;
624
+ /**
625
+ * URL being used for connecting to the stream.
626
+ */
517
627
  url: string;
628
+ /**
629
+ * A session is bound to a connection. If the client reconnects for any reason (e.g. coming back from inactivity
630
+ * or a problem with network on client side), a new sessionId will be used.
631
+ *
632
+ */
518
633
  sessionId?: string;
634
+ /**
635
+ * Unlike `sessionId`, `clientId` will remain the same even after reconnections and represents this unique Vindral instance.
636
+ */
519
637
  clientId: string;
638
+ /**
639
+ * How long in milliseconds since the instance was created.
640
+ */
520
641
  uptime: number;
521
- videoBitRate?: number;
522
- audioBitRate?: number;
523
- bytesReceived: number;
642
+ /**
643
+ * Current channel ID being subscribed to.
644
+ */
524
645
  channelId: string;
646
+ /**
647
+ * Channel group being subscribed to.
648
+ */
525
649
  channelGroupId?: string;
650
+ /**
651
+ * Time in milliseconds from instantiation to playback of video and audio being started.
652
+ * Note that an actual frame render often happens much quicker, but that is not counted as TTFF.
653
+ */
526
654
  timeToFirstFrame?: number;
527
655
  iosMediaElementEnabled?: boolean;
528
656
  };
@@ -892,6 +1020,12 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
892
1020
  * How long in milliseconds since the instance was created
893
1021
  */
894
1022
  get uptime(): number;
1023
+ /**
1024
+ * This method collects a statistics report from internal modules. While many of the report's properties are documented, the report may also contain undocumented
1025
+ * properties used internally or temporarily for monitoring and improving the performance of the service.
1026
+ *
1027
+ * Use undocumented properties at your own risk.
1028
+ */
895
1029
  getStatistics: () => Statistics;
896
1030
  private resetModules;
897
1031
  private suspend;
@@ -909,6 +1043,12 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
909
1043
  private willUseMediaSource;
910
1044
  }
911
1045
  interface TelemetryModuleStatistics {
1046
+ /**
1047
+ * The total amount of errors being spawned. Note that some media errors can trigger
1048
+ * thousands of errors for a single client in a few seconds before recovering. Therefore,
1049
+ * consider the number of viewers with errors, not just the total amount. Also, consider the median
1050
+ * instead of the mean for average calculation.
1051
+ */
912
1052
  errorCount: number;
913
1053
  }
914
1054
  /**