avbridge 2.3.0 → 2.5.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/dist/{chunk-6UUT4BEA.cjs → chunk-2IJ66NTD.cjs} +13 -20
  3. package/dist/chunk-2IJ66NTD.cjs.map +1 -0
  4. package/dist/{chunk-XKPSTC34.cjs → chunk-2XW2O3YI.cjs} +5 -20
  5. package/dist/chunk-2XW2O3YI.cjs.map +1 -0
  6. package/dist/chunk-5KVLE6YI.js +167 -0
  7. package/dist/chunk-5KVLE6YI.js.map +1 -0
  8. package/dist/{chunk-2PGRFCWB.js → chunk-CPJLFFCC.js} +8 -18
  9. package/dist/chunk-CPJLFFCC.js.map +1 -0
  10. package/dist/chunk-CPZ7PXAM.cjs +240 -0
  11. package/dist/chunk-CPZ7PXAM.cjs.map +1 -0
  12. package/dist/{chunk-QQXBPW72.js → chunk-E76AMWI4.js} +4 -18
  13. package/dist/chunk-E76AMWI4.js.map +1 -0
  14. package/dist/{chunk-NV7ILLWH.js → chunk-KY2GPCT7.js} +347 -665
  15. package/dist/chunk-KY2GPCT7.js.map +1 -0
  16. package/dist/chunk-LUFA47FP.js +19 -0
  17. package/dist/chunk-LUFA47FP.js.map +1 -0
  18. package/dist/chunk-Q2VUO52Z.cjs +374 -0
  19. package/dist/chunk-Q2VUO52Z.cjs.map +1 -0
  20. package/dist/chunk-QDJLQR53.cjs +22 -0
  21. package/dist/chunk-QDJLQR53.cjs.map +1 -0
  22. package/dist/chunk-S4WAZC2T.cjs +173 -0
  23. package/dist/chunk-S4WAZC2T.cjs.map +1 -0
  24. package/dist/chunk-SMH6IOP2.js +368 -0
  25. package/dist/chunk-SMH6IOP2.js.map +1 -0
  26. package/dist/chunk-SR3MPV4D.js +237 -0
  27. package/dist/chunk-SR3MPV4D.js.map +1 -0
  28. package/dist/{chunk-7RGG6ME7.cjs → chunk-TBW26OPP.cjs} +365 -688
  29. package/dist/chunk-TBW26OPP.cjs.map +1 -0
  30. package/dist/chunk-X2K3GIWE.js +235 -0
  31. package/dist/chunk-X2K3GIWE.js.map +1 -0
  32. package/dist/chunk-ZCUXHW55.cjs +242 -0
  33. package/dist/chunk-ZCUXHW55.cjs.map +1 -0
  34. package/dist/element-browser.js +799 -493
  35. package/dist/element-browser.js.map +1 -1
  36. package/dist/element.cjs +58 -4
  37. package/dist/element.cjs.map +1 -1
  38. package/dist/element.d.cts +38 -0
  39. package/dist/element.d.ts +38 -0
  40. package/dist/element.js +57 -3
  41. package/dist/element.js.map +1 -1
  42. package/dist/index.cjs +523 -393
  43. package/dist/index.cjs.map +1 -1
  44. package/dist/index.js +494 -366
  45. package/dist/index.js.map +1 -1
  46. package/dist/libav-demux-H2GS46GH.cjs +27 -0
  47. package/dist/libav-demux-H2GS46GH.cjs.map +1 -0
  48. package/dist/libav-demux-OWZ4T2YW.js +6 -0
  49. package/dist/libav-demux-OWZ4T2YW.js.map +1 -0
  50. package/dist/{libav-import-GST2AMPL.cjs → libav-import-2ZVKV2E7.cjs} +2 -2
  51. package/dist/{libav-import-GST2AMPL.cjs.map → libav-import-2ZVKV2E7.cjs.map} +1 -1
  52. package/dist/{libav-import-2JURFHEW.js → libav-import-6MGLCXVQ.js} +2 -2
  53. package/dist/{libav-import-2JURFHEW.js.map → libav-import-6MGLCXVQ.js.map} +1 -1
  54. package/dist/player.cjs +601 -470
  55. package/dist/player.cjs.map +1 -1
  56. package/dist/player.d.cts +50 -0
  57. package/dist/player.d.ts +50 -0
  58. package/dist/player.js +580 -449
  59. package/dist/player.js.map +1 -1
  60. package/dist/remux-OBSMIENG.cjs +35 -0
  61. package/dist/remux-OBSMIENG.cjs.map +1 -0
  62. package/dist/remux-WBYIZBBX.js +10 -0
  63. package/dist/remux-WBYIZBBX.js.map +1 -0
  64. package/dist/source-4TZ6KMNV.js +4 -0
  65. package/dist/{source-F656KYYV.js.map → source-4TZ6KMNV.js.map} +1 -1
  66. package/dist/source-7YLO6E7X.cjs +29 -0
  67. package/dist/{source-73CAH6HW.cjs.map → source-7YLO6E7X.cjs.map} +1 -1
  68. package/dist/source-MTX5ELUZ.js +4 -0
  69. package/dist/{source-QJR3OHTW.js.map → source-MTX5ELUZ.js.map} +1 -1
  70. package/dist/source-VFLXLOCN.cjs +29 -0
  71. package/dist/{source-VB74JQ7Z.cjs.map → source-VFLXLOCN.cjs.map} +1 -1
  72. package/dist/subtitles-4T74JRGT.js +4 -0
  73. package/dist/subtitles-4T74JRGT.js.map +1 -0
  74. package/dist/subtitles-QUH4LPI4.cjs +29 -0
  75. package/dist/subtitles-QUH4LPI4.cjs.map +1 -0
  76. package/package.json +1 -1
  77. package/src/convert/remux.ts +1 -35
  78. package/src/convert/transcode-libav.ts +691 -0
  79. package/src/convert/transcode.ts +12 -4
  80. package/src/element/avbridge-player.ts +16 -0
  81. package/src/element/avbridge-video.ts +54 -0
  82. package/src/errors.ts +6 -0
  83. package/src/player.ts +15 -16
  84. package/src/strategies/fallback/decoder.ts +96 -173
  85. package/src/strategies/fallback/index.ts +19 -2
  86. package/src/strategies/fallback/libav-import.ts +9 -1
  87. package/src/strategies/fallback/video-renderer.ts +107 -0
  88. package/src/strategies/hybrid/decoder.ts +88 -180
  89. package/src/strategies/hybrid/index.ts +17 -2
  90. package/src/strategies/native.ts +6 -3
  91. package/src/strategies/remux/index.ts +14 -2
  92. package/src/strategies/remux/pipeline.ts +72 -12
  93. package/src/subtitles/render.ts +8 -0
  94. package/src/util/libav-demux.ts +405 -0
  95. package/dist/chunk-2PGRFCWB.js.map +0 -1
  96. package/dist/chunk-6UUT4BEA.cjs.map +0 -1
  97. package/dist/chunk-7RGG6ME7.cjs.map +0 -1
  98. package/dist/chunk-NV7ILLWH.js.map +0 -1
  99. package/dist/chunk-QQXBPW72.js.map +0 -1
  100. package/dist/chunk-XKPSTC34.cjs.map +0 -1
  101. package/dist/source-73CAH6HW.cjs +0 -28
  102. package/dist/source-F656KYYV.js +0 -3
  103. package/dist/source-QJR3OHTW.js +0 -3
  104. package/dist/source-VB74JQ7Z.cjs +0 -28
package/dist/player.d.cts CHANGED
@@ -106,6 +106,18 @@ declare class AvbridgePlayerElement extends HTMLElement {
106
106
  get strategyClass(): string | undefined;
107
107
  get audioTracks(): unknown[];
108
108
  get subtitleTracks(): unknown[];
109
+ /**
110
+ * External subtitle files to attach when the source loads. Forwarded
111
+ * to the inner <avbridge-video>. Takes effect on next bootstrap.
112
+ */
113
+ get subtitles(): unknown;
114
+ set subtitles(value: unknown);
115
+ /** Attach a subtitle track to the current playback without a reload. */
116
+ addSubtitle(subtitle: {
117
+ url: string;
118
+ language?: string;
119
+ format?: "vtt" | "srt";
120
+ }): Promise<void>;
109
121
  get player(): unknown;
110
122
  get videoElement(): HTMLVideoElement;
111
123
  play(): Promise<void>;
@@ -505,6 +517,13 @@ declare class AvbridgeVideoElement extends HTMLElementCtor {
505
517
  private _strategyClass;
506
518
  private _audioTracks;
507
519
  private _subtitleTracks;
520
+ /**
521
+ * External subtitle list forwarded to `createPlayer()` on the next
522
+ * bootstrap. Setting this after bootstrap queues it for the next
523
+ * source change; consumers that need to swap subtitles mid-playback
524
+ * should set `source` to reload.
525
+ */
526
+ private _subtitles;
508
527
  /**
509
528
  * Initial strategy preference. `"auto"` means "let the classifier decide";
510
529
  * any other value is passed to `createPlayer({ initialStrategy })` and
@@ -621,6 +640,37 @@ declare class AvbridgeVideoElement extends HTMLElementCtor {
621
640
  get player(): UnifiedPlayer | null;
622
641
  get audioTracks(): AudioTrackInfo[];
623
642
  get subtitleTracks(): SubtitleTrackInfo[];
643
+ /**
644
+ * External subtitle files to attach when the source loads. Takes effect
645
+ * on the next bootstrap — set before assigning `source`, or reload via
646
+ * `load()` after changing. For dynamic post-bootstrap addition, use
647
+ * `addSubtitle()` instead.
648
+ *
649
+ * @example
650
+ * el.subtitles = [{ url: "/en.srt", format: "srt", language: "en" }];
651
+ * el.src = "/movie.mp4";
652
+ */
653
+ get subtitles(): Array<{
654
+ url: string;
655
+ language?: string;
656
+ format?: "vtt" | "srt";
657
+ }> | null;
658
+ set subtitles(value: Array<{
659
+ url: string;
660
+ language?: string;
661
+ format?: "vtt" | "srt";
662
+ }> | null);
663
+ /**
664
+ * Attach a subtitle track to the current playback without rebuilding
665
+ * the player. Works while the element is playing — converts SRT to
666
+ * VTT if needed, adds a `<track>` to the inner `<video>`. Canvas
667
+ * strategies pick up the new track via their textTracks watcher.
668
+ */
669
+ addSubtitle(subtitle: {
670
+ url: string;
671
+ language?: string;
672
+ format?: "vtt" | "srt";
673
+ }): Promise<void>;
624
674
  /** Force a (re-)bootstrap if a source is currently set. */
625
675
  load(): Promise<void>;
626
676
  /**
package/dist/player.d.ts CHANGED
@@ -106,6 +106,18 @@ declare class AvbridgePlayerElement extends HTMLElement {
106
106
  get strategyClass(): string | undefined;
107
107
  get audioTracks(): unknown[];
108
108
  get subtitleTracks(): unknown[];
109
+ /**
110
+ * External subtitle files to attach when the source loads. Forwarded
111
+ * to the inner <avbridge-video>. Takes effect on next bootstrap.
112
+ */
113
+ get subtitles(): unknown;
114
+ set subtitles(value: unknown);
115
+ /** Attach a subtitle track to the current playback without a reload. */
116
+ addSubtitle(subtitle: {
117
+ url: string;
118
+ language?: string;
119
+ format?: "vtt" | "srt";
120
+ }): Promise<void>;
109
121
  get player(): unknown;
110
122
  get videoElement(): HTMLVideoElement;
111
123
  play(): Promise<void>;
@@ -505,6 +517,13 @@ declare class AvbridgeVideoElement extends HTMLElementCtor {
505
517
  private _strategyClass;
506
518
  private _audioTracks;
507
519
  private _subtitleTracks;
520
+ /**
521
+ * External subtitle list forwarded to `createPlayer()` on the next
522
+ * bootstrap. Setting this after bootstrap queues it for the next
523
+ * source change; consumers that need to swap subtitles mid-playback
524
+ * should set `source` to reload.
525
+ */
526
+ private _subtitles;
508
527
  /**
509
528
  * Initial strategy preference. `"auto"` means "let the classifier decide";
510
529
  * any other value is passed to `createPlayer({ initialStrategy })` and
@@ -621,6 +640,37 @@ declare class AvbridgeVideoElement extends HTMLElementCtor {
621
640
  get player(): UnifiedPlayer | null;
622
641
  get audioTracks(): AudioTrackInfo[];
623
642
  get subtitleTracks(): SubtitleTrackInfo[];
643
+ /**
644
+ * External subtitle files to attach when the source loads. Takes effect
645
+ * on the next bootstrap — set before assigning `source`, or reload via
646
+ * `load()` after changing. For dynamic post-bootstrap addition, use
647
+ * `addSubtitle()` instead.
648
+ *
649
+ * @example
650
+ * el.subtitles = [{ url: "/en.srt", format: "srt", language: "en" }];
651
+ * el.src = "/movie.mp4";
652
+ */
653
+ get subtitles(): Array<{
654
+ url: string;
655
+ language?: string;
656
+ format?: "vtt" | "srt";
657
+ }> | null;
658
+ set subtitles(value: Array<{
659
+ url: string;
660
+ language?: string;
661
+ format?: "vtt" | "srt";
662
+ }> | null);
663
+ /**
664
+ * Attach a subtitle track to the current playback without rebuilding
665
+ * the player. Works while the element is playing — converts SRT to
666
+ * VTT if needed, adds a `<track>` to the inner `<video>`. Canvas
667
+ * strategies pick up the new track via their textTracks watcher.
668
+ */
669
+ addSubtitle(subtitle: {
670
+ url: string;
671
+ language?: string;
672
+ format?: "vtt" | "srt";
673
+ }): Promise<void>;
624
674
  /** Force a (re-)bootstrap if a source is currently set. */
625
675
  load(): Promise<void>;
626
676
  /**