@appium/media-proxy 0.0.1 → 1.1.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 (123) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/LICENSE +201 -0
  3. package/README.md +183 -2
  4. package/THIRD_PARTY_NOTICES.md +29 -0
  5. package/binding.gyp +90 -0
  6. package/lib/src/background.d.ts +5 -0
  7. package/lib/src/background.d.ts.map +1 -0
  8. package/lib/src/background.js +16 -0
  9. package/lib/src/background.js.map +1 -0
  10. package/lib/src/capabilities.d.ts +9 -0
  11. package/lib/src/capabilities.d.ts.map +1 -0
  12. package/lib/src/capabilities.js +11 -0
  13. package/lib/src/capabilities.js.map +1 -0
  14. package/lib/src/errors.d.ts +26 -0
  15. package/lib/src/errors.d.ts.map +1 -0
  16. package/lib/src/errors.js +40 -0
  17. package/lib/src/errors.js.map +1 -0
  18. package/lib/src/framing/apst.d.ts +43 -0
  19. package/lib/src/framing/apst.d.ts.map +1 -0
  20. package/lib/src/framing/apst.js +126 -0
  21. package/lib/src/framing/apst.js.map +1 -0
  22. package/lib/src/framing/mjpeg-http.d.ts +30 -0
  23. package/lib/src/framing/mjpeg-http.d.ts.map +1 -0
  24. package/lib/src/framing/mjpeg-http.js +148 -0
  25. package/lib/src/framing/mjpeg-http.js.map +1 -0
  26. package/lib/src/framing/mjpeg-multipart.d.ts +11 -0
  27. package/lib/src/framing/mjpeg-multipart.d.ts.map +1 -0
  28. package/lib/src/framing/mjpeg-multipart.js +26 -0
  29. package/lib/src/framing/mjpeg-multipart.js.map +1 -0
  30. package/lib/src/index.d.ts +10 -0
  31. package/lib/src/index.d.ts.map +1 -0
  32. package/lib/src/index.js +7 -0
  33. package/lib/src/index.js.map +1 -0
  34. package/lib/src/native.d.ts +12 -0
  35. package/lib/src/native.d.ts.map +1 -0
  36. package/lib/src/native.js +36 -0
  37. package/lib/src/native.js.map +1 -0
  38. package/lib/src/pkg-root.d.ts +6 -0
  39. package/lib/src/pkg-root.d.ts.map +1 -0
  40. package/lib/src/pkg-root.js +12 -0
  41. package/lib/src/pkg-root.js.map +1 -0
  42. package/lib/src/queue.d.ts +34 -0
  43. package/lib/src/queue.d.ts.map +1 -0
  44. package/lib/src/queue.js +123 -0
  45. package/lib/src/queue.js.map +1 -0
  46. package/lib/src/transcoder.d.ts +81 -0
  47. package/lib/src/transcoder.d.ts.map +1 -0
  48. package/lib/src/transcoder.js +422 -0
  49. package/lib/src/transcoder.js.map +1 -0
  50. package/lib/src/types.d.ts +147 -0
  51. package/lib/src/types.d.ts.map +1 -0
  52. package/lib/src/types.js +2 -0
  53. package/lib/src/types.js.map +1 -0
  54. package/package.json +53 -4
  55. package/prebuilds/darwin-arm64/@appium+media-proxy.node +0 -0
  56. package/prebuilds/darwin-arm64/ffmpeg-LICENSE-LGPL-2.1.txt +502 -0
  57. package/prebuilds/darwin-arm64/ffmpeg-build-info.txt +3 -0
  58. package/prebuilds/darwin-arm64/libavcodec-appium.62.dylib +0 -0
  59. package/prebuilds/darwin-arm64/libavutil-appium.60.dylib +0 -0
  60. package/prebuilds/darwin-arm64/libswscale-appium.9.dylib +0 -0
  61. package/prebuilds/darwin-x64/@appium+media-proxy.node +0 -0
  62. package/prebuilds/darwin-x64/ffmpeg-LICENSE-LGPL-2.1.txt +502 -0
  63. package/prebuilds/darwin-x64/ffmpeg-build-info.txt +3 -0
  64. package/prebuilds/darwin-x64/libavcodec-appium.62.dylib +0 -0
  65. package/prebuilds/darwin-x64/libavutil-appium.60.dylib +0 -0
  66. package/prebuilds/darwin-x64/libswscale-appium.9.dylib +0 -0
  67. package/prebuilds/linux-arm64/@appium+media-proxy.node +0 -0
  68. package/prebuilds/linux-arm64/ffmpeg-LICENSE-LGPL-2.1.txt +502 -0
  69. package/prebuilds/linux-arm64/ffmpeg-build-info.txt +3 -0
  70. package/prebuilds/linux-arm64/libavcodec-appium.so.62 +0 -0
  71. package/prebuilds/linux-arm64/libavutil-appium.so.60 +0 -0
  72. package/prebuilds/linux-arm64/libswscale-appium.so.9 +0 -0
  73. package/prebuilds/linux-x64/@appium+media-proxy.node +0 -0
  74. package/prebuilds/linux-x64/ffmpeg-LICENSE-LGPL-2.1.txt +502 -0
  75. package/prebuilds/linux-x64/ffmpeg-build-info.txt +3 -0
  76. package/prebuilds/linux-x64/libavcodec-appium.so.62 +0 -0
  77. package/prebuilds/linux-x64/libavutil-appium.so.60 +0 -0
  78. package/prebuilds/linux-x64/libswscale-appium.so.9 +0 -0
  79. package/prebuilds/win32-arm64/@appium+media-proxy.node +0 -0
  80. package/prebuilds/win32-arm64/avcodec-appium-62.dll +0 -0
  81. package/prebuilds/win32-arm64/avutil-appium-60.dll +0 -0
  82. package/prebuilds/win32-arm64/ffmpeg-LICENSE-LGPL-2.1.txt +502 -0
  83. package/prebuilds/win32-arm64/ffmpeg-build-info.txt +3 -0
  84. package/prebuilds/win32-arm64/swscale-appium-9.dll +0 -0
  85. package/prebuilds/win32-x64/@appium+media-proxy.node +0 -0
  86. package/prebuilds/win32-x64/avcodec-appium-62.dll +0 -0
  87. package/prebuilds/win32-x64/avutil-appium-60.dll +0 -0
  88. package/prebuilds/win32-x64/ffmpeg-LICENSE-LGPL-2.1.txt +502 -0
  89. package/prebuilds/win32-x64/ffmpeg-build-info.txt +3 -0
  90. package/prebuilds/win32-x64/swscale-appium-9.dll +0 -0
  91. package/scripts/install.mjs +29 -0
  92. package/src/background.ts +15 -0
  93. package/src/capabilities.ts +12 -0
  94. package/src/errors.ts +45 -0
  95. package/src/framing/apst.ts +158 -0
  96. package/src/framing/mjpeg-http.ts +186 -0
  97. package/src/framing/mjpeg-multipart.ts +38 -0
  98. package/src/index.ts +43 -0
  99. package/src/native/addon.cc +402 -0
  100. package/src/native/audio_pipeline.cc +426 -0
  101. package/src/native/audio_pipeline.h +63 -0
  102. package/src/native/ffmpeg_util.h +37 -0
  103. package/src/native/h264_encoder.cc +133 -0
  104. package/src/native/h264_encoder.h +48 -0
  105. package/src/native/mediafoundation_encoder.cc +442 -0
  106. package/src/native/mediafoundation_encoder.h +14 -0
  107. package/src/native/napi_util.h +20 -0
  108. package/src/native/openh264_encoder.cc +285 -0
  109. package/src/native/openh264_encoder.h +14 -0
  110. package/src/native/pipeline.cc +555 -0
  111. package/src/native/pipeline.h +108 -0
  112. package/src/native/vendor/openh264/LICENSE +23 -0
  113. package/src/native/vendor/openh264/codec_api.h +592 -0
  114. package/src/native/vendor/openh264/codec_app_def.h +820 -0
  115. package/src/native/vendor/openh264/codec_def.h +216 -0
  116. package/src/native/vendor/openh264/codec_ver.h +15 -0
  117. package/src/native/videotoolbox_encoder.cc +314 -0
  118. package/src/native/videotoolbox_encoder.h +13 -0
  119. package/src/native.ts +51 -0
  120. package/src/pkg-root.ts +14 -0
  121. package/src/queue.ts +133 -0
  122. package/src/transcoder.ts +480 -0
  123. package/src/types.ts +158 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 1.1.0 (2026-11-17)
7
+
8
+ ### Features
9
+
10
+ * **media-proxy:** add listH264Encoders() ([#218](https://github.com/appium/appium-ios/issues/218)) ([e4e0193](https://github.com/appium/appium-ios/commit/e4e01935af2bb8d1092791f2627d8419543ef414))
11
+ * **media-proxy:** crop the padding and rotate the picture upright ([#214](https://github.com/appium/appium-ios/issues/214)) ([c4c9204](https://github.com/appium/appium-ios/commit/c4c92042c2934519ea103bec8ec4fc800421214d))
12
+ * **media-proxy:** H.264 output through Media Foundation on Windows ([#89](https://github.com/appium/appium-ios/issues/89)) ([1b97d0e](https://github.com/appium/appium-ios/commit/1b97d0e8a680558f4e31805b67349d3560035ddd))
13
+ * **media-proxy:** H.264 output through VideoToolbox on macOS ([#79](https://github.com/appium/appium-ios/issues/79)) ([9a98d23](https://github.com/appium/appium-ios/commit/9a98d23649b0f94e5103160ba059200d980e301a))
14
+ * **media-proxy:** HEVC to MJPEG pipeline on a bundled LGPL FFmpeg ([#70](https://github.com/appium/appium-ios/issues/70)) ([7d8c910](https://github.com/appium/appium-ios/commit/7d8c9108d33f2485a7610fabcea9df0831eecf69))
15
+ * **media-proxy:** release the package ([#217](https://github.com/appium/appium-ios/issues/217)) ([b6fbba2](https://github.com/appium/appium-ios/commit/b6fbba2d5048fc6e300f582f5ad438f84b54bdd3))
16
+ * **media-proxy:** scaffold @appium/media-proxy transcoder package ([#62](https://github.com/appium/appium-ios/issues/62)) ([4e9c0b4](https://github.com/appium/appium-ios/commit/4e9c0b4e948ee0b8d3d37a8b91ecdac0cd9436d3))
17
+ * **media-proxy:** software H.264 through runtime-loaded OpenH264 ([#94](https://github.com/appium/appium-ios/issues/94)) ([c45f4f9](https://github.com/appium/appium-ios/commit/c45f4f95c6e0eb96bf9f6839bed9273c3d56fa30))
18
+ * **media-proxy:** transcode the device audio (AAC-ELD to ADTS AAC-LC) ([#101](https://github.com/appium/appium-ios/issues/101)) ([1be81e2](https://github.com/appium/appium-ios/commit/1be81e2dbcd74c7608fcc43e0d9e3871c23aa7bf))
19
+
20
+ ### Bug Fixes
21
+
22
+ * **media-proxy:** use the device's 24 kHz video RTP clock and add Transcoder.requestKeyFrame() ([#212](https://github.com/appium/appium-ios/issues/212)) ([8da4224](https://github.com/appium/appium-ios/commit/8da4224d0712d210ad9b2af71892b8075f5875ea))
23
+
24
+ ### Performance Improvements
25
+
26
+ * **media-proxy:** low-latency rate control for VideoToolbox, RSS growth in the bench ([#96](https://github.com/appium/appium-ios/issues/96)) ([765353a](https://github.com/appium/appium-ios/commit/765353af76ac525797f6573f35d089bffd92cac6))
27
+
28
+ ### Miscellaneous Chores
29
+
30
+ * **deps:** bump @appium/* packages to latest 4.0 betas ([#193](https://github.com/appium/appium-ios/issues/193)) ([de20629](https://github.com/appium/appium-ios/commit/de20629ed0e7b9ec22953f25ba30825541be3ca4))
31
+ * **media-proxy:** bump @appium/* dependencies to their Appium 4 releases ([778510b](https://github.com/appium/appium-ios/commit/778510b836feb0f33f96b295171a388ea7079b90))
32
+ * **media-proxy:** fix lint warnings ([#202](https://github.com/appium/appium-ios/issues/202)) ([b01350f](https://github.com/appium/appium-ios/commit/b01350f65e989be9df52f06d50f0e6813b859543))
33
+ * publish ([9c72898](https://github.com/appium/appium-ios/commit/9c72898744045b9ac9f691af75f50976c59eb208))
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright OpenJS Foundation and other contributors, https://openjsf.org/
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,4 +1,185 @@
1
1
  # @appium/media-proxy
2
2
 
3
- Placeholder. The real package is published from
4
- [appium/appium-ios](https://github.com/appium/appium-ios/tree/main/packages/media-proxy).
3
+ Cross-platform media transcoder that turns a device's native screen stream into the common format
4
+ already produced by `@appium/coresim` (simulators) and the Android settings app:
5
+
6
+ - **H.264**: Annex-B, 4-byte start codes, one picture per unit, no B-frames, SPS/PPS inline on every
7
+ keyframe.
8
+ - **MJPEG**: one standalone JPEG per frame.
9
+ - **Audio** (optional, with H.264): the device's AAC-ELD re-encoded to ADTS-framed AAC-LC units, interleaved into the same
10
+ sequence like coresim's `audio` option.
11
+
12
+ The primary input is the HEVC stream of `appium-ios-remotexpc`'s `ScreenStreamCapture`
13
+ (iOS 27+ real devices). Supported platforms: darwin, linux, win32 on x64 and arm64.
14
+
15
+ > **Status:** HEVC → MJPEG works on every platform (bundled LGPL FFmpeg, software decode). H.264 output works on
16
+ > macOS (VideoToolbox) and Windows (Media Foundation); everywhere else (and when those fail to open) it falls back to
17
+ > Cisco's OpenH264 once [installed by the client](#software-h264-openh264), and throws `MediaProxyEncoderUnavailableError` if it
18
+ > is not installed. Hardware encoders for Linux are still to come.
19
+
20
+ The input is treated as a **live stream**: the native side buffers at most 8 access units and, when
21
+ it falls behind, drops to the next keyframe instead of adding latency. Feeding a file faster than
22
+ real time therefore drops frames; pace it like a device does. After such a drop the pipeline waits for
23
+ the next keyframe (the device offers no way to request one), so a source that sends keyframes rarely
24
+ freezes until the next one.
25
+
26
+ ## Usage
27
+
28
+ ```ts
29
+ import {transcode, serveMjpeg} from '@appium/media-proxy';
30
+
31
+ const capture = await ScreenStreamCapture.start(display, {displayId: 1});
32
+
33
+ // H.264 (same shape as coresim's VideoAccessUnit)
34
+ for await (const unit of transcode(capture.accessUnits(), {codec: 'h264', fps: 60})) {}
35
+
36
+ // MJPEG over HTTP (multipart/x-mixed-replace)
37
+ const frames = transcode(capture.accessUnits(), {codec: 'mjpeg', quality: 80});
38
+ const server = await serveMjpeg(frames, {port: 0});
39
+ console.log(server.url);
40
+ ```
41
+
42
+ Audio: pass `audio: true` and the audio source as the fourth argument (see [Audio](#audio)).
43
+
44
+ Lower level: `createTranscoder(opts)` returns a `Transcoder` with `push()`, `units()`, `end()`
45
+ (flush, then finish) and `close()` (stop consuming and discard output now; the promise resolves once the
46
+ native side has drained its few queued units and freed the codecs). Always call one of them.
47
+
48
+ `setRotation(degrees)` turns the picture while streaming (see `rotation` below). It takes effect with the next frame; a
49
+ quarter turn swaps the output's width and height, so the encoder starts a new stream with a keyframe (a new SPS for
50
+ H.264, a differently sized JPEG for MJPEG) and the consumer sees the new size.
51
+
52
+ `requestKeyFrame()` makes the next H.264 output a keyframe, for a consumer that joins a running stream. It takes
53
+ effect with the next pushed unit, so the source must keep sending, and each call forces another keyframe once
54
+ that unit is in, so coalesce requests when several consumers share one transcoder. It does nothing for MJPEG
55
+ (every frame is standalone) or after `end()`/`close()`.
56
+
57
+ ## Building from source
58
+
59
+ The addon links a minimal LGPL FFmpeg (HEVC and AAC decoders, MJPEG and AAC encoders, swscale) pinned in
60
+ `scripts/ci/build-ffmpeg.sh`; there is no system FFmpeg dependency.
61
+
62
+ ```sh
63
+ npm run build:ffmpeg # once per platform/arch (needs nasm on x64; Windows: MSVC under MSYS2)
64
+ npm run build:addon # links it and copies the libs next to the addon
65
+ npm run test:integration
66
+ node scripts/bench.mjs clip.h265 --seconds 10 # real-time fps / latency report
67
+ ```
68
+
69
+ `npm run build:prebuilds` produces `prebuilds/<platform>-<arch>/` with the addon plus the FFmpeg
70
+ libs it needs (and `ffmpeg-build-info.txt`, the exact `configure` line).
71
+
72
+ | Option | Default | Notes |
73
+ | -------------------- | --------- | ----------------------------------------------------- |
74
+ | `codec` | required | `'h264'` or `'mjpeg'` |
75
+ | `fps` | 60 | Finite, >= 1. Upper bound; the input is variable-rate |
76
+ | `bitrate` (h264) | 4,000,000 | bits/sec, > 0 and <= 2^31-1 |
77
+ | `quality` (mjpeg) | 80 | 0-100 |
78
+ | `scale` (mjpeg) | 100 | Percent of the source resolution, > 0 and <= 100 |
79
+ | `audio` (h264) | false | Also transcode the device audio, see [Audio](#audio) |
80
+ | `audioSpecificConfig` (h264) | 480-sample ELD | `AudioSpecificConfig` of the pushed audio |
81
+ | `videoClockRate` | 24,000 | Hz of the RTP timestamps you push, finite and > 0, see below |
82
+ | `crop` | none | `{width, height}`, positive even integers: the visible top-left part of the picture |
83
+ | `rotation` | 0 | Clockwise degrees (0, 90, 180, 270) that make the picture upright; see `setRotation()` |
84
+
85
+ `videoClockRate` is not a coresim option, since coresim has no RTP input. The device's screen stream advances its
86
+ RTP timestamps by 400 ticks per frame at 60 fps, which is a 24 kHz clock (measured on an iPad, iPadOS 27.0.1;
87
+ other devices are not verified), not the 90 kHz of RFC 7798. A wrong value scales the whole timeline: too high
88
+ makes it run slow, so the `fps` limit drops most frames and every `timestampMicros` is wrong. If you feed HEVC
89
+ from any other source, for example a file you stamped at 90 kHz, set it explicitly.
90
+
91
+ `crop` and `rotation` are not coresim options either. The device pads its stream to a multiple of 16 with black
92
+ (1632x2176 for a 1620x2160 display) and always streams the display's native portrait buffer, so a landscape UI
93
+ arrives turned by 90 degrees. Take the visible size and the orientation from CoreDevice's `getDisplayInfo()`
94
+ (`displays[].currentMode.size` and `displays[].currentOrientation`: `rot0`, `rot90`, `rot180` or `rot270`, which
95
+ are also the clockwise degrees to pass as `rotation`). The crop is applied first, from the top-left corner and
96
+ without a copy, then the picture is scaled and turned, so `scale` and the output size refer to the cropped,
97
+ turned picture. A crop larger than the picture keeps the whole picture.
98
+
99
+ Options, defaults and validation (`RangeError`) match coresim's `VideoStreamOptions` and
100
+ `JpegStreamOptions`. Android-only options (`resolution`, `localPort`, ...) are not supported.
101
+
102
+ ## Audio
103
+
104
+ ```ts
105
+ const audio = await AudioStreamCapture.start(display);
106
+ for await (const unit of transcode(capture.accessUnits(), {codec: 'h264', audio: true}, signal, audio.accessUnits())) {
107
+ // unit.track is 'video' or 'audio'; audio units are ADTS AAC-LC (48 kHz stereo, 128 kbps), isKeyFrame always true
108
+ }
109
+ ```
110
+
111
+ With `createTranscoder` call `pushAudio({data, timestamp, receivedAt})` next to `push()`. `sequence` counts per track;
112
+ `timestampMicros` is on one clock. Each track is rebased with its own RTP clock (24 kHz video as the device sends it, 48 kHz audio) and the tracks
113
+ are offset by when their first unit arrived (`receivedAt`, the `performance.now()` remotexpc stamps; the push time
114
+ otherwise), since remotexpc exposes no RTCP sender report to map the two clocks. The audio source ends with the video and a
115
+ failing audio source fails the stream. Audio is never dropped by a video resync.
116
+
117
+ The native `aac` decoder reads the device's AAC-ELD with its **480-sample** frames, which is why the default
118
+ `AudioSpecificConfig` differs from the one the device advertises (see remotexpc `aac-eld.ts`). A gap of lost packets up to
119
+ 1 s is filled with silence so audio keeps its place on the clock; a longer one restarts the audio timeline. Added latency is
120
+ one AAC frame (1024 samples, ~21 ms) plus the ELD unit being waited for (≤ 10 ms). AAC is patent-encumbered like HEVC/H.264.
121
+
122
+ ### Framing helpers
123
+
124
+ - `encodeApstFrame` / `ApstParser`: the Android settings app's "APST" wire protocol, so one client
125
+ can consume both platforms.
126
+ - `formatMjpegPart` / `serveMjpeg`: MJPEG over HTTP; each client keeps only its newest unsent frame.
127
+ `server.done` rejects if the frame source fails; clients connecting after the source ended get `410`.
128
+
129
+ ## Software H.264 (OpenH264)
130
+
131
+ Without a hardware encoder (Linux, some VMs), H.264 uses Cisco's OpenH264. This package never bundles or
132
+ downloads it: **the client package (e.g. the driver) installs it and points `MEDIA_PROXY_OPENH264_PATH` at it**.
133
+ Without it, `createTranscoder({codec: 'h264'})` throws `MediaProxyEncoderUnavailableError`;
134
+ `listH264Encoders()` tells beforehand (it returns the encoders that can open here, empty if none).
135
+
136
+ Each end user must fetch Cisco's signed binary from Cisco under
137
+ [Cisco's binary license](https://www.openh264.org/BINARY_LICENSE.txt) (that is what the patent grant covers), so do it on the
138
+ user's machine, on request, not at publish time:
139
+
140
+ 1. Download `https://ciscobinary.openh264.org/<file>.bz2` for the platform (exactly **2.6.0**: the addon is built against
141
+ that major.minor and refuses any other).
142
+ 2. Verify the SHA-256 of the `.bz2`, then decompress it (`bunzip2`; Python's `bz2` works on Windows).
143
+ 3. Store the library where it survives reinstalls, by convention
144
+ `<APPIUM_HOME or ~/.appium>/media-proxy/openh264/2.6.0/<library>`.
145
+ 4. Set `MEDIA_PROXY_OPENH264_PATH` to its full path in the process that uses this package, before the first H.264
146
+ transcoder is created (it is read when an encoder opens).
147
+
148
+ | Platform | File (`.bz2`) | Library name | SHA-256 of the `.bz2` |
149
+ | ------------- | ------------------------------------- | ------------------- | ------------------------------------------------------------------ |
150
+ | darwin-arm64 | `libopenh264-2.6.0-mac-arm64.dylib` | `libopenh264.dylib` | `6db362ee5abdab572311aeadb96d3f44b0617d9a4a4b9f4db4cb5ac4d968da71` |
151
+ | darwin-x64 | `libopenh264-2.6.0-mac-x64.dylib` | `libopenh264.dylib` | `38b2ed6d1d45b6a3e408c734173f2d67ab44a10d0e154ff3489b89877cd60e7e` |
152
+ | linux-arm64 | `libopenh264-2.6.0-linux-arm64.8.so` | `libopenh264.so` | `a78aea7970150f46bcd3bb7994c9e6dd90bd7a9ea785920f5a73f6964e3fcda7` |
153
+ | linux-x64 | `libopenh264-2.6.0-linux64.8.so` | `libopenh264.so` | `27ab53323c110b76214c1c72222f459d17febbcd1e252136cadc292b0308d75b` |
154
+ | win32-arm64 | `openh264-2.6.0-win-arm64.dll` | `openh264.dll` | `6b57d3ecd06bd80b5f3ee1abbb31d48798ca6d89ef1bc98cf2e6d1ebddf5cf45` |
155
+ | win32-x64 | `openh264-2.6.0-win64.dll` | `openh264.dll` | `dab5f2a872777f9a58b69bfa9fbcf20d9f82f2d6ec91383fd70bff49bd34ac9f` |
156
+
157
+ On Windows keep the `.dll` extension (the loader appends one otherwise). `scripts/ci/fetch-openh264.py` is the CI's
158
+ version of these steps. Set `MEDIA_PROXY_H264_ENCODER=libopenh264` (or `h264_videotoolbox`, `h264_mf`) to force one
159
+ encoder for diagnostics. OpenH264 output is multi-slice (one slice per core, up to 4; a frame too short for that falls back to one slice), tagged BT.709 limited range like the other encoders, and needs frames of at least 16×16.
160
+
161
+ ## Performance
162
+
163
+ `node scripts/bench.mjs clip.h265 --codec h264 --seconds 60` paces a clip at 60 fps and reports output fps, added latency
164
+ (push to output) and RSS growth. On an M-series Mac with a 1170×2532 scrolling-UI clip (numbers vary ±30% between runs):
165
+
166
+ | Output | p50 | p95 | Notes |
167
+ | ------------------------- | ------- | -------- | -------------------------------------------------------------------------- |
168
+ | MJPEG | ~5 ms | ~6 ms | software JPEG |
169
+ | H.264 VideoToolbox | ~8 ms | ~11 ms | low-latency rate control; the first few frames after start-up may be dropped |
170
+ | H.264 OpenH264 (software) | ~15 ms | ~20 ms | needs ~4 cores; fast-changing content (video, games) can fall behind 60 fps |
171
+
172
+ Audio (ELD → AAC-LC): p50 ~22 ms, p95 ~24 ms from the last input unit of a frame; negligible CPU.
173
+
174
+ RSS stays flat over a 60 s soak. The pipeline itself (decode, colour conversion) costs under 2 ms per frame, so latency is
175
+ the encoder's.
176
+
177
+ ## Licensing
178
+
179
+ The package is Apache-2.0. The native addon links FFmpeg built **LGPL-only** (no `--enable-gpl`, no
180
+ `--enable-nonfree`), shipped as shared libraries next to the addon so it can be relinked. See
181
+ `THIRD_PARTY_NOTICES.md`. x264 is never bundled. H.264 uses the platform's encoder (VideoToolbox on macOS, Media Foundation on Windows: both system components). The software fallback uses Cisco's OpenH264,
182
+ which the client downloads at runtime (not redistributed by this package) to be covered by Cisco's patent grant.
183
+
184
+ Note that HEVC, H.264 and AAC are patent-encumbered formats; hardware codecs rely on the platform's
185
+ licenses, while software decode/encode carries none from this package.
@@ -0,0 +1,29 @@
1
+ # Third-party notices
2
+
3
+ ## FFmpeg
4
+
5
+ Prebuilds ship FFmpeg's libavcodec, libavutil and libswscale as shared libraries, built with
6
+ `--disable-gpl --disable-nonfree --disable-version3` (HEVC and AAC decoders, MJPEG and AAC encoders, and swscale only; the AAC encoder is FFmpeg's own, not FDK)
7
+ and licensed under the GNU LGPL v2.1 or later.
8
+
9
+ - Version: 8.1.3, source https://ffmpeg.org/releases/ffmpeg-8.1.3.tar.xz
10
+ (sha256 `7138d28c96d9d3e3af4ee3d8cad72741f8ffb40da90c1112235dea3ecd3178a3`).
11
+ - The libraries are built with `--build-suffix=-appium` (e.g. `libavcodec-appium.so.62`) so they can't be
12
+ confused with, or replaced by, another FFmpeg loaded in the same process.
13
+ - The licence text ships beside the libraries as `ffmpeg-LICENSE-LGPL-2.1.txt`.
14
+ - The recipe is `scripts/ci/build-ffmpeg.sh` (in the repository, not in the npm package); each prebuild also carries `ffmpeg-build-info.txt` with the
15
+ exact `configure` line. FFmpeg is built unmodified.
16
+ - The libraries are dynamically linked and sit next to the addon, so they can be replaced with a
17
+ modified build of the same version (rebuild with the script above and copy the libraries over).
18
+
19
+ ## Platform frameworks
20
+
21
+ H.264 encoding on macOS calls Apple's VideoToolbox system framework, and on Windows the Media Foundation H.264
22
+ encoder installed with the OS. Nothing from either is bundled or redistributed.
23
+
24
+ ## OpenH264 (optional, installed by the client at runtime)
25
+
26
+ Cisco's OpenH264 is BSD-2-Clause. It is not redistributed in this package: the client package fetches the binary
27
+ from Cisco (see the README) to remain under Cisco's AVC/H.264 patent portfolio license. Only its BSD-2-Clause
28
+ headers (`src/native/vendor/openh264`, v2.6.0) are included here; the library is loaded with `dlopen`/`LoadLibrary`
29
+ from `$MEDIA_PROXY_OPENH264_PATH`.
package/binding.gyp ADDED
@@ -0,0 +1,90 @@
1
+ {
2
+ "variables": {
3
+ "conditions": [
4
+ ["OS=='mac'", {"ffmpeg_dir": "<(module_root_dir)/third_party/ffmpeg/darwin-<(target_arch)"}],
5
+ ["OS=='linux'", {"ffmpeg_dir": "<(module_root_dir)/third_party/ffmpeg/linux-<(target_arch)"}],
6
+ ["OS=='win'", {"ffmpeg_dir": "<(module_root_dir)/third_party/ffmpeg/win32-<(target_arch)"}]
7
+ ]
8
+ },
9
+ "targets": [
10
+ {
11
+ "target_name": "media_proxy",
12
+ "sources": [
13
+ "src/native/addon.cc",
14
+ "src/native/h264_encoder.cc",
15
+ "src/native/openh264_encoder.cc",
16
+ "src/native/audio_pipeline.cc",
17
+ "src/native/pipeline.cc"
18
+ ],
19
+ "include_dirs": [
20
+ "<!@(node -p \"require('node-addon-api').include\")",
21
+ "<(ffmpeg_dir)/include"
22
+ ],
23
+ "cflags!": [ "-fno-exceptions" ],
24
+ "cflags_cc!": [ "-fno-exceptions" ],
25
+ "cflags_cc": [
26
+ "-std=c++17",
27
+ "-O3",
28
+ "-Wall",
29
+ "-Wextra",
30
+ "-Wno-unused-parameter",
31
+ "-fPIC"
32
+ ],
33
+ "xcode_settings": {
34
+ "GCC_ENABLE_CPP_EXCEPTIONS": "YES",
35
+ "CLANG_CXX_LIBRARY": "libc++",
36
+ "CLANG_CXX_LANGUAGE_STANDARD": "c++17",
37
+ "MACOSX_DEPLOYMENT_TARGET": "12.0",
38
+ "GCC_OPTIMIZATION_LEVEL": "3",
39
+ "WARNING_CFLAGS": [
40
+ "-Wall",
41
+ "-Wextra",
42
+ "-Wno-unused-parameter"
43
+ ],
44
+ "OTHER_CPLUSPLUSFLAGS": [
45
+ "-O3",
46
+ "-fPIC"
47
+ ]
48
+ },
49
+ "msvs_settings": {
50
+ "VCCLCompilerTool": {
51
+ "ExceptionHandling": 1,
52
+ "AdditionalOptions": [
53
+ "/std:c++20",
54
+ "/O2"
55
+ ]
56
+ }
57
+ },
58
+ "defines": [
59
+ "NAPI_CPP_EXCEPTIONS",
60
+ "NAPI_VERSION=8"
61
+ ],
62
+ "conditions": [
63
+ ["OS=='mac'", {
64
+ "sources": ["src/native/videotoolbox_encoder.cc"],
65
+ "libraries": [
66
+ "-framework CoreFoundation", "-framework CoreMedia", "-framework CoreVideo", "-framework VideoToolbox",
67
+ "-L<(ffmpeg_dir)/lib", "-lavcodec-appium", "-lavutil-appium", "-lswscale-appium",
68
+ "-Wl,-rpath,@loader_path"
69
+ ]
70
+ }],
71
+ ["OS=='linux'", {
72
+ "libraries": [
73
+ "-L<(ffmpeg_dir)/lib", "-lavcodec-appium", "-lavutil-appium", "-lswscale-appium", "-ldl",
74
+ "-Wl,-rpath,'$$ORIGIN'"
75
+ ]
76
+ }],
77
+ ["OS=='win'", {
78
+ "defines": ["_CRT_SECURE_NO_WARNINGS"],
79
+ "sources": ["src/native/mediafoundation_encoder.cc"],
80
+ "libraries": [
81
+ "mfplat.lib", "mf.lib", "mfuuid.lib", "strmiids.lib", "ole32.lib", "oleaut32.lib",
82
+ "<(ffmpeg_dir)/lib/avcodec-appium.lib",
83
+ "<(ffmpeg_dir)/lib/avutil-appium.lib",
84
+ "<(ffmpeg_dir)/lib/swscale-appium.lib"
85
+ ]
86
+ }]
87
+ ]
88
+ }
89
+ ]
90
+ }
@@ -0,0 +1,5 @@
1
+ /** Awaits `promise` in the background; a rejection is dropped instead of left unhandled. */
2
+ export declare function ignoreRejection(promise: PromiseLike<unknown> | undefined): void;
3
+ /** Asks an async source to stop without waiting: an idle one may not settle until its next item. */
4
+ export declare function releaseQuietly(iterator: AsyncIterator<unknown>): void;
5
+ //# sourceMappingURL=background.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../src/background.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,CAQ/E;AAED,oGAAoG;AACpG,wBAAgB,cAAc,CAAC,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,IAAI,CAErE"}
@@ -0,0 +1,16 @@
1
+ /** Awaits `promise` in the background; a rejection is dropped instead of left unhandled. */
2
+ export function ignoreRejection(promise) {
3
+ void (async () => {
4
+ try {
5
+ await promise;
6
+ }
7
+ catch {
8
+ // best-effort: failures are surfaced elsewhere or irrelevant
9
+ }
10
+ })();
11
+ }
12
+ /** Asks an async source to stop without waiting: an idle one may not settle until its next item. */
13
+ export function releaseQuietly(iterator) {
14
+ ignoreRejection(iterator.return?.());
15
+ }
16
+ //# sourceMappingURL=background.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"background.js","sourceRoot":"","sources":["../../src/background.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,MAAM,UAAU,eAAe,CAAC,OAAyC;IACvE,KAAK,CAAC,KAAK,IAAI,EAAE;QACf,IAAI,CAAC;YACH,MAAM,OAAO,CAAC;QAChB,CAAC;QAAC,MAAM,CAAC;YACP,6DAA6D;QAC/D,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;AACP,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,cAAc,CAAC,QAAgC;IAC7D,eAAe,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { NativeModule } from './types.js';
2
+ /**
3
+ * H.264 encoders that can open on this machine, e.g. `['h264_videotoolbox']` (OpenH264 only once installed). An empty
4
+ * list means `createTranscoder({codec: 'h264'})` would throw `MediaProxyEncoderUnavailableError`.
5
+ *
6
+ * @throws MediaProxyUnavailableError if the addon can't be loaded
7
+ */
8
+ export declare function listH264Encoders(native?: Pick<NativeModule, 'capabilities'>): string[];
9
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/capabilities.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAE7C;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,IAAI,CAAC,YAAY,EAAE,cAAc,CAAgB,GAAG,MAAM,EAAE,CAEpG"}
@@ -0,0 +1,11 @@
1
+ import { loadNative } from './native.js';
2
+ /**
3
+ * H.264 encoders that can open on this machine, e.g. `['h264_videotoolbox']` (OpenH264 only once installed). An empty
4
+ * list means `createTranscoder({codec: 'h264'})` would throw `MediaProxyEncoderUnavailableError`.
5
+ *
6
+ * @throws MediaProxyUnavailableError if the addon can't be loaded
7
+ */
8
+ export function listH264Encoders(native = loadNative()) {
9
+ return native.capabilities().encoders.filter((name) => name.startsWith('h264_') || name === 'libopenh264');
10
+ }
11
+ //# sourceMappingURL=capabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAGvC;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAA6C,UAAU,EAAE;IACxF,OAAO,MAAM,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,IAAI,KAAK,aAAa,CAAC,CAAC;AAC7G,CAAC"}
@@ -0,0 +1,26 @@
1
+ /** Base error for every failure raised by this package. */
2
+ export declare class MediaProxyError extends Error {
3
+ name: string;
4
+ }
5
+ /** The native addon can't be used here (unsupported platform/arch or no matching prebuild). */
6
+ export declare class MediaProxyUnavailableError extends MediaProxyError {
7
+ readonly platform: string;
8
+ readonly arch: string;
9
+ name: string;
10
+ constructor(message: string, platform: string, arch: string);
11
+ }
12
+ /** No encoder satisfying the request is available (e.g. H.264 with no HW encoder or OpenH264). */
13
+ export declare class MediaProxyEncoderUnavailableError extends MediaProxyError {
14
+ name: string;
15
+ }
16
+ /** An option failed validation. */
17
+ export declare class MediaProxyOptionError extends MediaProxyError {
18
+ name: string;
19
+ }
20
+ /** The stream or a framed payload was malformed (e.g. APST desynchronization). */
21
+ export declare class MediaProxyProtocolError extends MediaProxyError {
22
+ name: string;
23
+ }
24
+ /** Re-types an error thrown by the native addon by its `name`; others pass through. */
25
+ export declare function wrapNativeError(err: unknown): Error;
26
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,qBAAa,eAAgB,SAAQ,KAAK;IACxB,IAAI,SAAqB;CAC1C;AAED,+FAA+F;AAC/F,qBAAa,0BAA2B,SAAQ,eAAe;aAK3C,QAAQ,EAAE,MAAM;aAChB,IAAI,EAAE,MAAM;IALd,IAAI,SAAgC;gBAGlD,OAAO,EAAE,MAAM,EACC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM;CAI/B;AAED,kGAAkG;AAClG,qBAAa,iCAAkC,SAAQ,eAAe;IACpD,IAAI,SAAuC;CAC5D;AAED,mCAAmC;AACnC,qBAAa,qBAAsB,SAAQ,eAAe;IACxC,IAAI,SAA2B;CAChD;AAED,kFAAkF;AAClF,qBAAa,uBAAwB,SAAQ,eAAe;IAC1C,IAAI,SAA6B;CAClD;AAED,uFAAuF;AACvF,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CAUnD"}