electron-cast 0.3.1 → 0.5.0-next.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.
Files changed (758) hide show
  1. package/CHANGELOG.md +340 -0
  2. package/CONTRIBUTING.md +305 -0
  3. package/README.md +215 -60
  4. package/SECURITY.md +324 -0
  5. package/dist/cjs/client/auth/build-time.d.ts +7 -0
  6. package/dist/cjs/client/auth/build-time.js +11 -0
  7. package/dist/cjs/client/auth/build-time.js.map +1 -0
  8. package/dist/cjs/client/auth/cast-auth.d.ts +46 -0
  9. package/dist/cjs/client/auth/cast-auth.js +145 -0
  10. package/dist/cjs/client/auth/cast-auth.js.map +1 -0
  11. package/dist/cjs/client/auth/cast-cert-validator.d.ts +34 -0
  12. package/dist/cjs/client/auth/cast-cert-validator.js +89 -0
  13. package/dist/cjs/client/auth/cast-cert-validator.js.map +1 -0
  14. package/dist/cjs/client/auth/crl.d.ts +45 -0
  15. package/dist/cjs/client/auth/crl.js +227 -0
  16. package/dist/cjs/client/auth/crl.js.map +1 -0
  17. package/dist/cjs/client/auth/der.d.ts +62 -0
  18. package/dist/cjs/client/auth/der.js +208 -0
  19. package/dist/cjs/client/auth/der.js.map +1 -0
  20. package/dist/cjs/client/auth/names.d.ts +52 -0
  21. package/dist/cjs/client/auth/names.js +447 -0
  22. package/dist/cjs/client/auth/names.js.map +1 -0
  23. package/dist/cjs/client/auth/path-validator.d.ts +29 -0
  24. package/dist/cjs/client/auth/path-validator.js +421 -0
  25. package/dist/cjs/client/auth/path-validator.js.map +1 -0
  26. package/dist/cjs/client/auth/trust-data.d.ts +24 -0
  27. package/dist/cjs/client/auth/trust-data.js +97 -0
  28. package/dist/cjs/client/auth/trust-data.js.map +1 -0
  29. package/dist/cjs/client/auth/x509.d.ts +109 -0
  30. package/dist/cjs/client/auth/x509.js +442 -0
  31. package/dist/cjs/client/auth/x509.js.map +1 -0
  32. package/dist/cjs/client/cast-client.d.ts +111 -0
  33. package/dist/cjs/client/cast-client.js +505 -0
  34. package/dist/cjs/client/cast-client.js.map +1 -0
  35. package/dist/cjs/client/errors.d.ts +28 -0
  36. package/dist/cjs/client/errors.js +50 -0
  37. package/dist/cjs/client/errors.js.map +1 -0
  38. package/dist/cjs/client/index.d.ts +6 -0
  39. package/dist/cjs/client/index.js +21 -0
  40. package/dist/cjs/client/index.js.map +1 -0
  41. package/dist/cjs/client/namespaces.d.ts +9 -0
  42. package/dist/cjs/client/namespaces.js +13 -0
  43. package/dist/cjs/client/namespaces.js.map +1 -0
  44. package/dist/cjs/client/types.d.ts +27 -0
  45. package/dist/cjs/client/types.js +3 -0
  46. package/dist/cjs/client/types.js.map +1 -0
  47. package/dist/cjs/dial/dial-registry.d.ts +104 -0
  48. package/dist/cjs/dial/dial-registry.js +301 -0
  49. package/dist/cjs/dial/dial-registry.js.map +1 -0
  50. package/dist/cjs/dial/dial-sink-service.d.ts +108 -0
  51. package/dist/cjs/dial/dial-sink-service.js +314 -0
  52. package/dist/cjs/dial/dial-sink-service.js.map +1 -0
  53. package/dist/cjs/dial/http.d.ts +40 -0
  54. package/dist/cjs/dial/http.js +172 -0
  55. package/dist/cjs/dial/http.js.map +1 -0
  56. package/dist/cjs/dial/index.d.ts +63 -0
  57. package/dist/cjs/dial/index.js +134 -0
  58. package/dist/cjs/dial/index.js.map +1 -0
  59. package/dist/cjs/dial/origins.d.ts +4 -0
  60. package/dist/cjs/dial/origins.js +36 -0
  61. package/dist/cjs/dial/origins.js.map +1 -0
  62. package/dist/cjs/dial/parse.d.ts +101 -0
  63. package/dist/cjs/dial/parse.js +296 -0
  64. package/dist/cjs/dial/parse.js.map +1 -0
  65. package/dist/cjs/dial/route-provider.d.ts +96 -0
  66. package/dist/cjs/dial/route-provider.js +376 -0
  67. package/dist/cjs/dial/route-provider.js.map +1 -0
  68. package/dist/cjs/dial/ssdp-socket.d.ts +34 -0
  69. package/dist/cjs/dial/ssdp-socket.js +72 -0
  70. package/dist/cjs/dial/ssdp-socket.js.map +1 -0
  71. package/dist/cjs/dial/xml.d.ts +13 -0
  72. package/dist/cjs/dial/xml.js +208 -0
  73. package/dist/cjs/dial/xml.js.map +1 -0
  74. package/dist/cjs/discovery/cast-discovery.d.ts +105 -0
  75. package/dist/cjs/discovery/cast-discovery.js +323 -0
  76. package/dist/cjs/discovery/cast-discovery.js.map +1 -0
  77. package/dist/cjs/discovery/device-cache.d.ts +54 -0
  78. package/dist/cjs/discovery/device-cache.js +240 -0
  79. package/dist/cjs/discovery/device-cache.js.map +1 -0
  80. package/dist/cjs/discovery/dns-packet.d.ts +70 -0
  81. package/dist/cjs/discovery/dns-packet.js +251 -0
  82. package/dist/cjs/discovery/dns-packet.js.map +1 -0
  83. package/dist/cjs/discovery/index.d.ts +5 -0
  84. package/dist/cjs/discovery/index.js +22 -0
  85. package/dist/cjs/discovery/index.js.map +1 -0
  86. package/dist/cjs/discovery/ip-policy.d.ts +20 -0
  87. package/dist/cjs/discovery/ip-policy.js +109 -0
  88. package/dist/cjs/discovery/ip-policy.js.map +1 -0
  89. package/dist/cjs/discovery/udp-socket.d.ts +19 -0
  90. package/dist/cjs/discovery/udp-socket.js +166 -0
  91. package/dist/cjs/discovery/udp-socket.js.map +1 -0
  92. package/dist/cjs/electron/access-code.d.ts +221 -0
  93. package/dist/cjs/electron/access-code.js +586 -0
  94. package/dist/cjs/electron/access-code.js.map +1 -0
  95. package/dist/cjs/electron/app-discovery.d.ts +82 -0
  96. package/dist/cjs/electron/app-discovery.js +219 -0
  97. package/dist/cjs/electron/app-discovery.js.map +1 -0
  98. package/dist/cjs/electron/default-presentation.d.ts +38 -0
  99. package/dist/cjs/electron/default-presentation.js +88 -0
  100. package/dist/cjs/electron/default-presentation.js.map +1 -0
  101. package/dist/cjs/electron/main.d.ts +173 -0
  102. package/dist/cjs/electron/main.js +990 -0
  103. package/dist/cjs/electron/main.js.map +1 -0
  104. package/dist/cjs/electron/manager-api.d.ts +314 -0
  105. package/dist/cjs/electron/manager-api.js +402 -0
  106. package/dist/cjs/electron/manager-api.js.map +1 -0
  107. package/dist/cjs/electron/media-controller.d.ts +79 -0
  108. package/dist/cjs/electron/media-controller.js +251 -0
  109. package/dist/cjs/electron/media-controller.js.map +1 -0
  110. package/dist/cjs/electron/network-monitor.d.ts +61 -0
  111. package/dist/cjs/electron/network-monitor.js +124 -0
  112. package/dist/cjs/electron/network-monitor.js.map +1 -0
  113. package/dist/cjs/electron/preload.d.ts +39 -0
  114. package/dist/cjs/electron/preload.js +96 -0
  115. package/dist/cjs/electron/preload.js.map +1 -0
  116. package/dist/cjs/electron/presentation-envelope.d.ts +60 -0
  117. package/dist/cjs/electron/presentation-envelope.js +318 -0
  118. package/dist/cjs/electron/presentation-envelope.js.map +1 -0
  119. package/dist/cjs/electron/presentation-handler.d.ts +135 -0
  120. package/dist/cjs/electron/presentation-handler.js +643 -0
  121. package/dist/cjs/electron/presentation-handler.js.map +1 -0
  122. package/dist/cjs/electron/presentation-source.d.ts +76 -0
  123. package/dist/cjs/electron/presentation-source.js +132 -0
  124. package/dist/cjs/electron/presentation-source.js.map +1 -0
  125. package/dist/cjs/electron/session-service.d.ts +348 -0
  126. package/dist/cjs/electron/session-service.js +1273 -0
  127. package/dist/cjs/electron/session-service.js.map +1 -0
  128. package/dist/cjs/electron/session-tracker.d.ts +82 -0
  129. package/dist/cjs/electron/session-tracker.js +225 -0
  130. package/dist/cjs/electron/session-tracker.js.map +1 -0
  131. package/dist/cjs/electron/sink-service.d.ts +246 -0
  132. package/dist/cjs/electron/sink-service.js +606 -0
  133. package/dist/cjs/electron/sink-service.js.map +1 -0
  134. package/dist/cjs/electron/wired-display/controller.d.ts +76 -0
  135. package/dist/cjs/electron/wired-display/controller.js +198 -0
  136. package/dist/cjs/electron/wired-display/controller.js.map +1 -0
  137. package/dist/cjs/electron/wired-display/displays.d.ts +44 -0
  138. package/dist/cjs/electron/wired-display/displays.js +98 -0
  139. package/dist/cjs/electron/wired-display/displays.js.map +1 -0
  140. package/dist/cjs/electron/wired-display/electron-windows.d.ts +111 -0
  141. package/dist/cjs/electron/wired-display/electron-windows.js +306 -0
  142. package/dist/cjs/electron/wired-display/electron-windows.js.map +1 -0
  143. package/dist/cjs/electron/wired-display/index.d.ts +90 -0
  144. package/dist/cjs/electron/wired-display/index.js +115 -0
  145. package/dist/cjs/electron/wired-display/index.js.map +1 -0
  146. package/dist/cjs/electron/wired-display/local-presentation.d.ts +98 -0
  147. package/dist/cjs/electron/wired-display/local-presentation.js +234 -0
  148. package/dist/cjs/electron/wired-display/local-presentation.js.map +1 -0
  149. package/dist/cjs/electron/wired-display/provider.d.ts +112 -0
  150. package/dist/cjs/electron/wired-display/provider.js +202 -0
  151. package/dist/cjs/electron/wired-display/provider.js.map +1 -0
  152. package/dist/cjs/index.d.ts +9 -0
  153. package/dist/cjs/index.js +27 -0
  154. package/dist/cjs/index.js.map +1 -0
  155. package/dist/cjs/mirroring/backend.d.ts +76 -0
  156. package/dist/cjs/mirroring/backend.js +21 -0
  157. package/dist/cjs/mirroring/backend.js.map +1 -0
  158. package/dist/cjs/mirroring/electron/agent-protocol.d.ts +158 -0
  159. package/dist/cjs/mirroring/electron/agent-protocol.js +11 -0
  160. package/dist/cjs/mirroring/electron/agent-protocol.js.map +1 -0
  161. package/dist/cjs/mirroring/electron/agent-source.d.ts +20 -0
  162. package/dist/cjs/mirroring/electron/agent-source.js +621 -0
  163. package/dist/cjs/mirroring/electron/agent-source.js.map +1 -0
  164. package/dist/cjs/mirroring/electron/engine-process.d.ts +87 -0
  165. package/dist/cjs/mirroring/electron/engine-process.js +81 -0
  166. package/dist/cjs/mirroring/electron/engine-process.js.map +1 -0
  167. package/dist/cjs/mirroring/electron/host.d.ts +89 -0
  168. package/dist/cjs/mirroring/electron/host.js +321 -0
  169. package/dist/cjs/mirroring/electron/host.js.map +1 -0
  170. package/dist/cjs/mirroring/electron/port-backend.d.ts +107 -0
  171. package/dist/cjs/mirroring/electron/port-backend.js +446 -0
  172. package/dist/cjs/mirroring/electron/port-backend.js.map +1 -0
  173. package/dist/cjs/mirroring/encoding-support.d.ts +66 -0
  174. package/dist/cjs/mirroring/encoding-support.js +89 -0
  175. package/dist/cjs/mirroring/encoding-support.js.map +1 -0
  176. package/dist/cjs/mirroring/engine.d.ts +16 -0
  177. package/dist/cjs/mirroring/engine.js +78 -0
  178. package/dist/cjs/mirroring/engine.js.map +1 -0
  179. package/dist/cjs/mirroring/mirror-settings.d.ts +101 -0
  180. package/dist/cjs/mirroring/mirror-settings.js +140 -0
  181. package/dist/cjs/mirroring/mirror-settings.js.map +1 -0
  182. package/dist/cjs/mirroring/mirroring-activity.d.ts +207 -0
  183. package/dist/cjs/mirroring/mirroring-activity.js +367 -0
  184. package/dist/cjs/mirroring/mirroring-activity.js.map +1 -0
  185. package/dist/cjs/mirroring/mirroring-manager.d.ts +134 -0
  186. package/dist/cjs/mirroring/mirroring-manager.js +286 -0
  187. package/dist/cjs/mirroring/mirroring-manager.js.map +1 -0
  188. package/dist/cjs/mirroring/protocol/answer.d.ts +87 -0
  189. package/dist/cjs/mirroring/protocol/answer.js +233 -0
  190. package/dist/cjs/mirroring/protocol/answer.js.map +1 -0
  191. package/dist/cjs/mirroring/protocol/constants.d.ts +64 -0
  192. package/dist/cjs/mirroring/protocol/constants.js +70 -0
  193. package/dist/cjs/mirroring/protocol/constants.js.map +1 -0
  194. package/dist/cjs/mirroring/protocol/errors.d.ts +25 -0
  195. package/dist/cjs/mirroring/protocol/errors.js +34 -0
  196. package/dist/cjs/mirroring/protocol/errors.js.map +1 -0
  197. package/dist/cjs/mirroring/protocol/frame-id.d.ts +9 -0
  198. package/dist/cjs/mirroring/protocol/frame-id.js +24 -0
  199. package/dist/cjs/mirroring/protocol/frame-id.js.map +1 -0
  200. package/dist/cjs/mirroring/protocol/messenger.d.ts +42 -0
  201. package/dist/cjs/mirroring/protocol/messenger.js +122 -0
  202. package/dist/cjs/mirroring/protocol/messenger.js.map +1 -0
  203. package/dist/cjs/mirroring/protocol/offer.d.ts +109 -0
  204. package/dist/cjs/mirroring/protocol/offer.js +192 -0
  205. package/dist/cjs/mirroring/protocol/offer.js.map +1 -0
  206. package/dist/cjs/mirroring/protocol/recommendations.d.ts +28 -0
  207. package/dist/cjs/mirroring/protocol/recommendations.js +103 -0
  208. package/dist/cjs/mirroring/protocol/recommendations.js.map +1 -0
  209. package/dist/cjs/mirroring/routing.d.ts +60 -0
  210. package/dist/cjs/mirroring/routing.js +147 -0
  211. package/dist/cjs/mirroring/routing.js.map +1 -0
  212. package/dist/cjs/mirroring/rtcp/ntp.d.ts +27 -0
  213. package/dist/cjs/mirroring/rtcp/ntp.js +62 -0
  214. package/dist/cjs/mirroring/rtcp/ntp.js.map +1 -0
  215. package/dist/cjs/mirroring/rtcp/parser.d.ts +50 -0
  216. package/dist/cjs/mirroring/rtcp/parser.js +270 -0
  217. package/dist/cjs/mirroring/rtcp/parser.js.map +1 -0
  218. package/dist/cjs/mirroring/rtcp/sender-report.d.ts +32 -0
  219. package/dist/cjs/mirroring/rtcp/sender-report.js +56 -0
  220. package/dist/cjs/mirroring/rtcp/sender-report.js.map +1 -0
  221. package/dist/cjs/mirroring/rtcp/wire.d.ts +54 -0
  222. package/dist/cjs/mirroring/rtcp/wire.js +73 -0
  223. package/dist/cjs/mirroring/rtcp/wire.js.map +1 -0
  224. package/dist/cjs/mirroring/rtp/frame-crypto.d.ts +11 -0
  225. package/dist/cjs/mirroring/rtp/frame-crypto.js +39 -0
  226. package/dist/cjs/mirroring/rtp/frame-crypto.js.map +1 -0
  227. package/dist/cjs/mirroring/rtp/frame.d.ts +23 -0
  228. package/dist/cjs/mirroring/rtp/frame.js +3 -0
  229. package/dist/cjs/mirroring/rtp/frame.js.map +1 -0
  230. package/dist/cjs/mirroring/rtp/packetizer.d.ts +27 -0
  231. package/dist/cjs/mirroring/rtp/packetizer.js +92 -0
  232. package/dist/cjs/mirroring/rtp/packetizer.js.map +1 -0
  233. package/dist/cjs/mirroring/sender/audio-sender.d.ts +23 -0
  234. package/dist/cjs/mirroring/sender/audio-sender.js +52 -0
  235. package/dist/cjs/mirroring/sender/audio-sender.js.map +1 -0
  236. package/dist/cjs/mirroring/sender/bandwidth-estimator.d.ts +26 -0
  237. package/dist/cjs/mirroring/sender/bandwidth-estimator.js +107 -0
  238. package/dist/cjs/mirroring/sender/bandwidth-estimator.js.map +1 -0
  239. package/dist/cjs/mirroring/sender/capture-size-oracle.d.ts +121 -0
  240. package/dist/cjs/mirroring/sender/capture-size-oracle.js +440 -0
  241. package/dist/cjs/mirroring/sender/capture-size-oracle.js.map +1 -0
  242. package/dist/cjs/mirroring/sender/frame-sender.d.ts +103 -0
  243. package/dist/cjs/mirroring/sender/frame-sender.js +217 -0
  244. package/dist/cjs/mirroring/sender/frame-sender.js.map +1 -0
  245. package/dist/cjs/mirroring/sender/packet-router.d.ts +74 -0
  246. package/dist/cjs/mirroring/sender/packet-router.js +196 -0
  247. package/dist/cjs/mirroring/sender/packet-router.js.map +1 -0
  248. package/dist/cjs/mirroring/sender/sender-session.d.ts +85 -0
  249. package/dist/cjs/mirroring/sender/sender-session.js +240 -0
  250. package/dist/cjs/mirroring/sender/sender-session.js.map +1 -0
  251. package/dist/cjs/mirroring/sender/sender.d.ts +120 -0
  252. package/dist/cjs/mirroring/sender/sender.js +457 -0
  253. package/dist/cjs/mirroring/sender/sender.js.map +1 -0
  254. package/dist/cjs/mirroring/sender/video-encoder-metrics.d.ts +29 -0
  255. package/dist/cjs/mirroring/sender/video-encoder-metrics.js +64 -0
  256. package/dist/cjs/mirroring/sender/video-encoder-metrics.js.map +1 -0
  257. package/dist/cjs/mirroring/sender/video-sender.d.ts +95 -0
  258. package/dist/cjs/mirroring/sender/video-sender.js +183 -0
  259. package/dist/cjs/mirroring/sender/video-sender.js.map +1 -0
  260. package/dist/cjs/mirroring/session-host.d.ts +185 -0
  261. package/dist/cjs/mirroring/session-host.js +630 -0
  262. package/dist/cjs/mirroring/session-host.js.map +1 -0
  263. package/dist/cjs/mirroring/stats/clock-offset-estimator.d.ts +11 -0
  264. package/dist/cjs/mirroring/stats/clock-offset-estimator.js +123 -0
  265. package/dist/cjs/mirroring/stats/clock-offset-estimator.js.map +1 -0
  266. package/dist/cjs/mirroring/stats/openscreen-stats-client.d.ts +12 -0
  267. package/dist/cjs/mirroring/stats/openscreen-stats-client.js +21 -0
  268. package/dist/cjs/mirroring/stats/openscreen-stats-client.js.map +1 -0
  269. package/dist/cjs/mirroring/stats/sorted-map.d.ts +23 -0
  270. package/dist/cjs/mirroring/stats/sorted-map.js +70 -0
  271. package/dist/cjs/mirroring/stats/sorted-map.js.map +1 -0
  272. package/dist/cjs/mirroring/stats/statistics-analyzer.d.ts +50 -0
  273. package/dist/cjs/mirroring/stats/statistics-analyzer.js +339 -0
  274. package/dist/cjs/mirroring/stats/statistics-analyzer.js.map +1 -0
  275. package/dist/cjs/mirroring/stats/statistics-collector.d.ts +29 -0
  276. package/dist/cjs/mirroring/stats/statistics-collector.js +53 -0
  277. package/dist/cjs/mirroring/stats/statistics-collector.js.map +1 -0
  278. package/dist/cjs/mirroring/stats/statistics-common.d.ts +61 -0
  279. package/dist/cjs/mirroring/stats/statistics-common.js +45 -0
  280. package/dist/cjs/mirroring/stats/statistics-common.js.map +1 -0
  281. package/dist/cjs/mirroring/stats/statistics-dispatcher.d.ts +28 -0
  282. package/dist/cjs/mirroring/stats/statistics-dispatcher.js +104 -0
  283. package/dist/cjs/mirroring/stats/statistics-dispatcher.js.map +1 -0
  284. package/dist/cjs/mirroring/stats/statistics.d.ts +84 -0
  285. package/dist/cjs/mirroring/stats/statistics.js +147 -0
  286. package/dist/cjs/mirroring/stats/statistics.js.map +1 -0
  287. package/dist/cjs/mirroring/transport/udp-environment.d.ts +40 -0
  288. package/dist/cjs/mirroring/transport/udp-environment.js +97 -0
  289. package/dist/cjs/mirroring/transport/udp-environment.js.map +1 -0
  290. package/dist/cjs/package.json +1 -0
  291. package/dist/cjs/polyfill/bridge-types.d.ts +97 -0
  292. package/dist/cjs/polyfill/bridge-types.js +3 -0
  293. package/dist/cjs/polyfill/bridge-types.js.map +1 -0
  294. package/dist/cjs/polyfill/install.d.ts +12 -0
  295. package/dist/cjs/polyfill/install.js +1569 -0
  296. package/dist/cjs/polyfill/install.js.map +1 -0
  297. package/dist/cjs/polyfill/presentation-receiver.d.ts +12 -0
  298. package/dist/cjs/polyfill/presentation-receiver.js +369 -0
  299. package/dist/cjs/polyfill/presentation-receiver.js.map +1 -0
  300. package/dist/cjs/polyfill/presentation-standin.d.ts +13 -0
  301. package/dist/cjs/polyfill/presentation-standin.js +421 -0
  302. package/dist/cjs/polyfill/presentation-standin.js.map +1 -0
  303. package/dist/cjs/protocol/cast-message.d.ts +20 -0
  304. package/dist/cjs/protocol/cast-message.js +171 -0
  305. package/dist/cjs/protocol/cast-message.js.map +1 -0
  306. package/dist/cjs/protocol/device-auth.d.ts +61 -0
  307. package/dist/cjs/protocol/device-auth.js +113 -0
  308. package/dist/cjs/protocol/device-auth.js.map +1 -0
  309. package/dist/cjs/protocol/errors.d.ts +4 -0
  310. package/dist/cjs/protocol/errors.js +12 -0
  311. package/dist/cjs/protocol/errors.js.map +1 -0
  312. package/dist/cjs/protocol/framing.d.ts +18 -0
  313. package/dist/cjs/protocol/framing.js +100 -0
  314. package/dist/cjs/protocol/framing.js.map +1 -0
  315. package/dist/cjs/protocol/index.d.ts +4 -0
  316. package/dist/cjs/protocol/index.js +21 -0
  317. package/dist/cjs/protocol/index.js.map +1 -0
  318. package/dist/cjs/protocol/proto-wire.d.ts +11 -0
  319. package/dist/cjs/protocol/proto-wire.js +64 -0
  320. package/dist/cjs/protocol/proto-wire.js.map +1 -0
  321. package/dist/cli.d.ts +2 -0
  322. package/dist/cli.js +56 -0
  323. package/dist/cli.js.map +1 -0
  324. package/dist/client/auth/build-time.d.ts +7 -0
  325. package/dist/client/auth/build-time.js +8 -0
  326. package/dist/client/auth/build-time.js.map +1 -0
  327. package/dist/client/auth/cast-auth.d.ts +46 -0
  328. package/dist/client/auth/cast-auth.js +141 -0
  329. package/dist/client/auth/cast-auth.js.map +1 -0
  330. package/dist/client/auth/cast-cert-validator.d.ts +34 -0
  331. package/dist/client/auth/cast-cert-validator.js +86 -0
  332. package/dist/client/auth/cast-cert-validator.js.map +1 -0
  333. package/dist/client/auth/crl.d.ts +45 -0
  334. package/dist/client/auth/crl.js +221 -0
  335. package/dist/client/auth/crl.js.map +1 -0
  336. package/dist/client/auth/der.d.ts +62 -0
  337. package/dist/client/auth/der.js +196 -0
  338. package/dist/client/auth/der.js.map +1 -0
  339. package/dist/client/auth/names.d.ts +52 -0
  340. package/dist/client/auth/names.js +438 -0
  341. package/dist/client/auth/names.js.map +1 -0
  342. package/dist/client/auth/path-validator.d.ts +29 -0
  343. package/dist/client/auth/path-validator.js +417 -0
  344. package/dist/client/auth/path-validator.js.map +1 -0
  345. package/dist/client/auth/trust-data.d.ts +24 -0
  346. package/dist/client/auth/trust-data.js +94 -0
  347. package/dist/client/auth/trust-data.js.map +1 -0
  348. package/dist/client/auth/x509.d.ts +109 -0
  349. package/dist/client/auth/x509.js +430 -0
  350. package/dist/client/auth/x509.js.map +1 -0
  351. package/dist/client/cast-client.d.ts +20 -1
  352. package/dist/client/cast-client.js +74 -3
  353. package/dist/client/cast-client.js.map +1 -1
  354. package/dist/client/errors.d.ts +11 -0
  355. package/dist/client/errors.js +13 -0
  356. package/dist/client/errors.js.map +1 -1
  357. package/dist/client/index.d.ts +2 -0
  358. package/dist/dial/dial-registry.d.ts +104 -0
  359. package/dist/dial/dial-registry.js +297 -0
  360. package/dist/dial/dial-registry.js.map +1 -0
  361. package/dist/dial/dial-sink-service.d.ts +108 -0
  362. package/dist/dial/dial-sink-service.js +310 -0
  363. package/dist/dial/dial-sink-service.js.map +1 -0
  364. package/dist/dial/http.d.ts +40 -0
  365. package/dist/dial/http.js +165 -0
  366. package/dist/dial/http.js.map +1 -0
  367. package/dist/dial/index.d.ts +63 -0
  368. package/dist/dial/index.js +115 -0
  369. package/dist/dial/index.js.map +1 -0
  370. package/dist/dial/origins.d.ts +4 -0
  371. package/dist/dial/origins.js +32 -0
  372. package/dist/dial/origins.js.map +1 -0
  373. package/dist/dial/parse.d.ts +101 -0
  374. package/dist/dial/parse.js +281 -0
  375. package/dist/dial/parse.js.map +1 -0
  376. package/dist/dial/route-provider.d.ts +96 -0
  377. package/dist/dial/route-provider.js +369 -0
  378. package/dist/dial/route-provider.js.map +1 -0
  379. package/dist/dial/ssdp-socket.d.ts +34 -0
  380. package/dist/dial/ssdp-socket.js +65 -0
  381. package/dist/dial/ssdp-socket.js.map +1 -0
  382. package/dist/dial/xml.d.ts +13 -0
  383. package/dist/dial/xml.js +204 -0
  384. package/dist/dial/xml.js.map +1 -0
  385. package/dist/dial-test/cli-main.d.ts +17 -0
  386. package/dist/dial-test/cli-main.js +130 -0
  387. package/dist/dial-test/cli-main.js.map +1 -0
  388. package/dist/dial-test/report.d.ts +55 -0
  389. package/dist/dial-test/report.js +77 -0
  390. package/dist/dial-test/report.js.map +1 -0
  391. package/dist/dial-test/runner.d.ts +42 -0
  392. package/dist/dial-test/runner.js +566 -0
  393. package/dist/dial-test/runner.js.map +1 -0
  394. package/dist/dial-test/scrub.d.ts +14 -0
  395. package/dist/dial-test/scrub.js +73 -0
  396. package/dist/dial-test/scrub.js.map +1 -0
  397. package/dist/discovery/cast-discovery.d.ts +23 -2
  398. package/dist/discovery/cast-discovery.js +94 -14
  399. package/dist/discovery/cast-discovery.js.map +1 -1
  400. package/dist/discovery/device-cache.d.ts +15 -1
  401. package/dist/discovery/device-cache.js +31 -7
  402. package/dist/discovery/device-cache.js.map +1 -1
  403. package/dist/discovery/index.d.ts +1 -0
  404. package/dist/discovery/index.js +1 -0
  405. package/dist/discovery/index.js.map +1 -1
  406. package/dist/discovery/ip-policy.d.ts +20 -0
  407. package/dist/discovery/ip-policy.js +103 -0
  408. package/dist/discovery/ip-policy.js.map +1 -0
  409. package/dist/discovery/udp-socket.d.ts +8 -1
  410. package/dist/discovery/udp-socket.js +59 -5
  411. package/dist/discovery/udp-socket.js.map +1 -1
  412. package/dist/electron/access-code.d.ts +221 -0
  413. package/dist/electron/access-code.js +577 -0
  414. package/dist/electron/access-code.js.map +1 -0
  415. package/dist/electron/app-discovery.d.ts +82 -0
  416. package/dist/electron/app-discovery.js +215 -0
  417. package/dist/electron/app-discovery.js.map +1 -0
  418. package/dist/electron/default-presentation.d.ts +38 -0
  419. package/dist/electron/default-presentation.js +83 -0
  420. package/dist/electron/default-presentation.js.map +1 -0
  421. package/dist/electron/main.d.ts +122 -13
  422. package/dist/electron/main.js +776 -63
  423. package/dist/electron/main.js.map +1 -1
  424. package/dist/electron/manager-api.d.ts +314 -0
  425. package/dist/electron/manager-api.js +390 -0
  426. package/dist/electron/manager-api.js.map +1 -0
  427. package/dist/electron/media-controller.d.ts +79 -0
  428. package/dist/electron/media-controller.js +248 -0
  429. package/dist/electron/media-controller.js.map +1 -0
  430. package/dist/electron/network-monitor.d.ts +61 -0
  431. package/dist/electron/network-monitor.js +117 -0
  432. package/dist/electron/network-monitor.js.map +1 -0
  433. package/dist/electron/preload.d.ts +5 -0
  434. package/dist/electron/preload.js +9 -1
  435. package/dist/electron/preload.js.map +1 -1
  436. package/dist/electron/presentation-envelope.js +7 -1
  437. package/dist/electron/presentation-envelope.js.map +1 -1
  438. package/dist/electron/presentation-handler.d.ts +39 -4
  439. package/dist/electron/presentation-handler.js +208 -57
  440. package/dist/electron/presentation-handler.js.map +1 -1
  441. package/dist/electron/presentation-source.d.ts +76 -0
  442. package/dist/electron/presentation-source.js +125 -0
  443. package/dist/electron/presentation-source.js.map +1 -0
  444. package/dist/electron/session-service.d.ts +225 -10
  445. package/dist/electron/session-service.js +735 -151
  446. package/dist/electron/session-service.js.map +1 -1
  447. package/dist/electron/session-tracker.d.ts +82 -0
  448. package/dist/electron/session-tracker.js +219 -0
  449. package/dist/electron/session-tracker.js.map +1 -0
  450. package/dist/electron/sink-service.d.ts +246 -0
  451. package/dist/electron/sink-service.js +602 -0
  452. package/dist/electron/sink-service.js.map +1 -0
  453. package/dist/electron/wired-display/controller.d.ts +76 -0
  454. package/dist/electron/wired-display/controller.js +194 -0
  455. package/dist/electron/wired-display/controller.js.map +1 -0
  456. package/dist/electron/wired-display/displays.d.ts +44 -0
  457. package/dist/electron/wired-display/displays.js +91 -0
  458. package/dist/electron/wired-display/displays.js.map +1 -0
  459. package/dist/electron/wired-display/electron-windows.d.ts +111 -0
  460. package/dist/electron/wired-display/electron-windows.js +301 -0
  461. package/dist/electron/wired-display/electron-windows.js.map +1 -0
  462. package/dist/electron/wired-display/index.d.ts +90 -0
  463. package/dist/electron/wired-display/index.js +99 -0
  464. package/dist/electron/wired-display/index.js.map +1 -0
  465. package/dist/electron/wired-display/local-presentation.d.ts +98 -0
  466. package/dist/electron/wired-display/local-presentation.js +228 -0
  467. package/dist/electron/wired-display/local-presentation.js.map +1 -0
  468. package/dist/electron/wired-display/provider.d.ts +112 -0
  469. package/dist/electron/wired-display/provider.js +197 -0
  470. package/dist/electron/wired-display/provider.js.map +1 -0
  471. package/dist/index.d.ts +1 -0
  472. package/dist/index.js +1 -0
  473. package/dist/index.js.map +1 -1
  474. package/dist/mirroring/backend.d.ts +76 -0
  475. package/dist/mirroring/backend.js +18 -0
  476. package/dist/mirroring/backend.js.map +1 -0
  477. package/dist/mirroring/electron/agent-protocol.d.ts +158 -0
  478. package/dist/mirroring/electron/agent-protocol.js +10 -0
  479. package/dist/mirroring/electron/agent-protocol.js.map +1 -0
  480. package/dist/mirroring/electron/agent-source.d.ts +20 -0
  481. package/dist/mirroring/electron/agent-source.js +618 -0
  482. package/dist/mirroring/electron/agent-source.js.map +1 -0
  483. package/dist/mirroring/electron/engine-process.d.ts +87 -0
  484. package/dist/mirroring/electron/engine-process.js +78 -0
  485. package/dist/mirroring/electron/engine-process.js.map +1 -0
  486. package/dist/mirroring/electron/host.d.ts +89 -0
  487. package/dist/mirroring/electron/host.js +318 -0
  488. package/dist/mirroring/electron/host.js.map +1 -0
  489. package/dist/mirroring/electron/port-backend.d.ts +107 -0
  490. package/dist/mirroring/electron/port-backend.js +441 -0
  491. package/dist/mirroring/electron/port-backend.js.map +1 -0
  492. package/dist/mirroring/encoding-support.d.ts +66 -0
  493. package/dist/mirroring/encoding-support.js +81 -0
  494. package/dist/mirroring/encoding-support.js.map +1 -0
  495. package/dist/mirroring/engine.d.ts +16 -0
  496. package/dist/mirroring/engine.js +75 -0
  497. package/dist/mirroring/engine.js.map +1 -0
  498. package/dist/mirroring/mirror-settings.d.ts +101 -0
  499. package/dist/mirroring/mirror-settings.js +134 -0
  500. package/dist/mirroring/mirror-settings.js.map +1 -0
  501. package/dist/mirroring/mirroring-activity.d.ts +207 -0
  502. package/dist/mirroring/mirroring-activity.js +362 -0
  503. package/dist/mirroring/mirroring-activity.js.map +1 -0
  504. package/dist/mirroring/mirroring-manager.d.ts +134 -0
  505. package/dist/mirroring/mirroring-manager.js +281 -0
  506. package/dist/mirroring/mirroring-manager.js.map +1 -0
  507. package/dist/mirroring/protocol/answer.d.ts +87 -0
  508. package/dist/mirroring/protocol/answer.js +226 -0
  509. package/dist/mirroring/protocol/answer.js.map +1 -0
  510. package/dist/mirroring/protocol/constants.d.ts +64 -0
  511. package/dist/mirroring/protocol/constants.js +66 -0
  512. package/dist/mirroring/protocol/constants.js.map +1 -0
  513. package/dist/mirroring/protocol/errors.d.ts +25 -0
  514. package/dist/mirroring/protocol/errors.js +29 -0
  515. package/dist/mirroring/protocol/errors.js.map +1 -0
  516. package/dist/mirroring/protocol/frame-id.d.ts +9 -0
  517. package/dist/mirroring/protocol/frame-id.js +20 -0
  518. package/dist/mirroring/protocol/frame-id.js.map +1 -0
  519. package/dist/mirroring/protocol/messenger.d.ts +42 -0
  520. package/dist/mirroring/protocol/messenger.js +118 -0
  521. package/dist/mirroring/protocol/messenger.js.map +1 -0
  522. package/dist/mirroring/protocol/offer.d.ts +109 -0
  523. package/dist/mirroring/protocol/offer.js +176 -0
  524. package/dist/mirroring/protocol/offer.js.map +1 -0
  525. package/dist/mirroring/protocol/recommendations.d.ts +28 -0
  526. package/dist/mirroring/protocol/recommendations.js +99 -0
  527. package/dist/mirroring/protocol/recommendations.js.map +1 -0
  528. package/dist/mirroring/routing.d.ts +60 -0
  529. package/dist/mirroring/routing.js +130 -0
  530. package/dist/mirroring/routing.js.map +1 -0
  531. package/dist/mirroring/rtcp/ntp.d.ts +27 -0
  532. package/dist/mirroring/rtcp/ntp.js +57 -0
  533. package/dist/mirroring/rtcp/ntp.js.map +1 -0
  534. package/dist/mirroring/rtcp/parser.d.ts +50 -0
  535. package/dist/mirroring/rtcp/parser.js +265 -0
  536. package/dist/mirroring/rtcp/parser.js.map +1 -0
  537. package/dist/mirroring/rtcp/sender-report.d.ts +32 -0
  538. package/dist/mirroring/rtcp/sender-report.js +51 -0
  539. package/dist/mirroring/rtcp/sender-report.js.map +1 -0
  540. package/dist/mirroring/rtcp/wire.d.ts +54 -0
  541. package/dist/mirroring/rtcp/wire.js +68 -0
  542. package/dist/mirroring/rtcp/wire.js.map +1 -0
  543. package/dist/mirroring/rtp/frame-crypto.d.ts +11 -0
  544. package/dist/mirroring/rtp/frame-crypto.js +35 -0
  545. package/dist/mirroring/rtp/frame-crypto.js.map +1 -0
  546. package/dist/mirroring/rtp/frame.d.ts +23 -0
  547. package/dist/mirroring/rtp/frame.js +2 -0
  548. package/dist/mirroring/rtp/frame.js.map +1 -0
  549. package/dist/mirroring/rtp/packetizer.d.ts +27 -0
  550. package/dist/mirroring/rtp/packetizer.js +88 -0
  551. package/dist/mirroring/rtp/packetizer.js.map +1 -0
  552. package/dist/mirroring/sender/audio-sender.d.ts +23 -0
  553. package/dist/mirroring/sender/audio-sender.js +54 -0
  554. package/dist/mirroring/sender/audio-sender.js.map +1 -0
  555. package/dist/mirroring/sender/bandwidth-estimator.d.ts +26 -0
  556. package/dist/mirroring/sender/bandwidth-estimator.js +103 -0
  557. package/dist/mirroring/sender/bandwidth-estimator.js.map +1 -0
  558. package/dist/mirroring/sender/capture-size-oracle.d.ts +121 -0
  559. package/dist/mirroring/sender/capture-size-oracle.js +433 -0
  560. package/dist/mirroring/sender/capture-size-oracle.js.map +1 -0
  561. package/dist/mirroring/sender/frame-sender.d.ts +103 -0
  562. package/dist/mirroring/sender/frame-sender.js +212 -0
  563. package/dist/mirroring/sender/frame-sender.js.map +1 -0
  564. package/dist/mirroring/sender/packet-router.d.ts +74 -0
  565. package/dist/mirroring/sender/packet-router.js +191 -0
  566. package/dist/mirroring/sender/packet-router.js.map +1 -0
  567. package/dist/mirroring/sender/sender-session.d.ts +85 -0
  568. package/dist/mirroring/sender/sender-session.js +235 -0
  569. package/dist/mirroring/sender/sender-session.js.map +1 -0
  570. package/dist/mirroring/sender/sender.d.ts +120 -0
  571. package/dist/mirroring/sender/sender.js +452 -0
  572. package/dist/mirroring/sender/sender.js.map +1 -0
  573. package/dist/mirroring/sender/video-encoder-metrics.d.ts +29 -0
  574. package/dist/mirroring/sender/video-encoder-metrics.js +58 -0
  575. package/dist/mirroring/sender/video-encoder-metrics.js.map +1 -0
  576. package/dist/mirroring/sender/video-sender.d.ts +95 -0
  577. package/dist/mirroring/sender/video-sender.js +190 -0
  578. package/dist/mirroring/sender/video-sender.js.map +1 -0
  579. package/dist/mirroring/session-host.d.ts +185 -0
  580. package/dist/mirroring/session-host.js +625 -0
  581. package/dist/mirroring/session-host.js.map +1 -0
  582. package/dist/mirroring/stats/clock-offset-estimator.d.ts +11 -0
  583. package/dist/mirroring/stats/clock-offset-estimator.js +120 -0
  584. package/dist/mirroring/stats/clock-offset-estimator.js.map +1 -0
  585. package/dist/mirroring/stats/openscreen-stats-client.d.ts +12 -0
  586. package/dist/mirroring/stats/openscreen-stats-client.js +17 -0
  587. package/dist/mirroring/stats/openscreen-stats-client.js.map +1 -0
  588. package/dist/mirroring/stats/sorted-map.d.ts +23 -0
  589. package/dist/mirroring/stats/sorted-map.js +66 -0
  590. package/dist/mirroring/stats/sorted-map.js.map +1 -0
  591. package/dist/mirroring/stats/statistics-analyzer.d.ts +50 -0
  592. package/dist/mirroring/stats/statistics-analyzer.js +335 -0
  593. package/dist/mirroring/stats/statistics-analyzer.js.map +1 -0
  594. package/dist/mirroring/stats/statistics-collector.d.ts +29 -0
  595. package/dist/mirroring/stats/statistics-collector.js +49 -0
  596. package/dist/mirroring/stats/statistics-collector.js.map +1 -0
  597. package/dist/mirroring/stats/statistics-common.d.ts +61 -0
  598. package/dist/mirroring/stats/statistics-common.js +39 -0
  599. package/dist/mirroring/stats/statistics-common.js.map +1 -0
  600. package/dist/mirroring/stats/statistics-dispatcher.d.ts +28 -0
  601. package/dist/mirroring/stats/statistics-dispatcher.js +100 -0
  602. package/dist/mirroring/stats/statistics-dispatcher.js.map +1 -0
  603. package/dist/mirroring/stats/statistics.d.ts +84 -0
  604. package/dist/mirroring/stats/statistics.js +141 -0
  605. package/dist/mirroring/stats/statistics.js.map +1 -0
  606. package/dist/mirroring/transport/udp-environment.d.ts +40 -0
  607. package/dist/mirroring/transport/udp-environment.js +93 -0
  608. package/dist/mirroring/transport/udp-environment.js.map +1 -0
  609. package/dist/polyfill/bridge-types.d.ts +11 -0
  610. package/dist/polyfill/presentation-receiver.d.ts +12 -0
  611. package/dist/polyfill/presentation-receiver.js +366 -0
  612. package/dist/polyfill/presentation-receiver.js.map +1 -0
  613. package/dist/polyfill/presentation-standin.js +160 -17
  614. package/dist/polyfill/presentation-standin.js.map +1 -1
  615. package/dist/protocol/device-auth.d.ts +61 -0
  616. package/dist/protocol/device-auth.js +106 -0
  617. package/dist/protocol/device-auth.js.map +1 -0
  618. package/dist/protocol/framing.d.ts +1 -1
  619. package/dist/protocol/framing.js +1 -1
  620. package/dist/protocol/framing.js.map +1 -1
  621. package/dist/protocol/index.d.ts +1 -0
  622. package/dist/protocol/index.js +1 -0
  623. package/dist/protocol/index.js.map +1 -1
  624. package/dist/protocol/proto-wire.d.ts +11 -0
  625. package/dist/protocol/proto-wire.js +60 -0
  626. package/dist/protocol/proto-wire.js.map +1 -0
  627. package/docs/API.md +724 -0
  628. package/docs/ARCHITECTURE.md +242 -0
  629. package/docs/CHROMIUM-MAP.md +176 -0
  630. package/docs/DESIGN.md +1189 -0
  631. package/docs/FAQ.md +123 -0
  632. package/docs/GETTING-STARTED.md +248 -0
  633. package/docs/MAIN-API.md +524 -0
  634. package/docs/TROUBLESHOOTING.md +283 -0
  635. package/docs/guides/audio-and-groups.md +75 -0
  636. package/docs/guides/custom-receivers.md +109 -0
  637. package/docs/guides/device-authentication.md +145 -0
  638. package/docs/guides/device-picker.md +176 -0
  639. package/docs/guides/index.md +17 -0
  640. package/docs/guides/low-level-client.md +103 -0
  641. package/docs/guides/restart-rejoin.md +172 -0
  642. package/docs/guides/testing.md +162 -0
  643. package/docs/guides/windows-and-iframes.md +116 -0
  644. package/docs/readme/badges/dependencies.svg +1 -0
  645. package/docs/readme/badges/electron.svg +1 -0
  646. package/docs/readme/badges/license.svg +1 -0
  647. package/docs/readme/badges/node.svg +1 -0
  648. package/docs/readme/board.jpg +0 -0
  649. package/docs/readme/hero-dark.jpg +0 -0
  650. package/docs/readme/hero-light.jpg +0 -0
  651. package/docs/readme/nosignal.jpg +0 -0
  652. package/docs/readme/parity.jpg +0 -0
  653. package/docs/readme/trace.svg +22 -0
  654. package/package.json +67 -16
  655. package/src/cli.ts +57 -0
  656. package/src/client/auth/build-time.ts +7 -0
  657. package/src/client/auth/cast-auth.ts +186 -0
  658. package/src/client/auth/cast-cert-validator.ts +133 -0
  659. package/src/client/auth/crl.ts +228 -0
  660. package/src/client/auth/der.ts +193 -0
  661. package/src/client/auth/names.ts +411 -0
  662. package/src/client/auth/path-validator.ts +449 -0
  663. package/src/client/auth/trust-data.ts +95 -0
  664. package/src/client/auth/x509.ts +488 -0
  665. package/src/client/cast-client.ts +85 -3
  666. package/src/client/errors.ts +29 -0
  667. package/src/client/index.ts +2 -0
  668. package/src/dial/dial-registry.ts +316 -0
  669. package/src/dial/dial-sink-service.ts +343 -0
  670. package/src/dial/http.ts +200 -0
  671. package/src/dial/index.ts +135 -0
  672. package/src/dial/origins.ts +31 -0
  673. package/src/dial/parse.ts +319 -0
  674. package/src/dial/route-provider.ts +429 -0
  675. package/src/dial/ssdp-socket.ts +79 -0
  676. package/src/dial/xml.ts +180 -0
  677. package/src/dial-test/cli-main.ts +146 -0
  678. package/src/dial-test/report.ts +109 -0
  679. package/src/dial-test/runner.ts +615 -0
  680. package/src/dial-test/scrub.ts +74 -0
  681. package/src/discovery/cast-discovery.ts +106 -19
  682. package/src/discovery/device-cache.ts +43 -8
  683. package/src/discovery/index.ts +1 -0
  684. package/src/discovery/ip-policy.ts +97 -0
  685. package/src/discovery/udp-socket.ts +66 -4
  686. package/src/electron/access-code.ts +681 -0
  687. package/src/electron/app-discovery.ts +244 -0
  688. package/src/electron/default-presentation.ts +104 -0
  689. package/src/electron/main.ts +866 -72
  690. package/src/electron/manager-api.ts +664 -0
  691. package/src/electron/media-controller.ts +313 -0
  692. package/src/electron/network-monitor.ts +140 -0
  693. package/src/electron/preload.ts +16 -2
  694. package/src/electron/presentation-envelope.ts +7 -1
  695. package/src/electron/presentation-handler.ts +211 -58
  696. package/src/electron/presentation-source.ts +155 -0
  697. package/src/electron/session-service.ts +808 -149
  698. package/src/electron/session-tracker.ts +248 -0
  699. package/src/electron/sink-service.ts +726 -0
  700. package/src/electron/wired-display/controller.ts +212 -0
  701. package/src/electron/wired-display/displays.ts +107 -0
  702. package/src/electron/wired-display/electron-windows.ts +386 -0
  703. package/src/electron/wired-display/index.ts +181 -0
  704. package/src/electron/wired-display/local-presentation.ts +286 -0
  705. package/src/electron/wired-display/provider.ts +276 -0
  706. package/src/index.ts +1 -0
  707. package/src/mirroring/backend.ts +103 -0
  708. package/src/mirroring/electron/agent-protocol.ts +84 -0
  709. package/src/mirroring/electron/agent-source.ts +619 -0
  710. package/src/mirroring/electron/engine-process.ts +131 -0
  711. package/src/mirroring/electron/host.ts +361 -0
  712. package/src/mirroring/electron/port-backend.ts +466 -0
  713. package/src/mirroring/encoding-support.ts +146 -0
  714. package/src/mirroring/engine.ts +91 -0
  715. package/src/mirroring/mirror-settings.ts +174 -0
  716. package/src/mirroring/mirroring-activity.ts +466 -0
  717. package/src/mirroring/mirroring-manager.ts +342 -0
  718. package/src/mirroring/protocol/answer.ts +285 -0
  719. package/src/mirroring/protocol/constants.ts +75 -0
  720. package/src/mirroring/protocol/errors.ts +36 -0
  721. package/src/mirroring/protocol/frame-id.ts +20 -0
  722. package/src/mirroring/protocol/messenger.ts +128 -0
  723. package/src/mirroring/protocol/offer.ts +275 -0
  724. package/src/mirroring/protocol/recommendations.ts +135 -0
  725. package/src/mirroring/routing.ts +160 -0
  726. package/src/mirroring/rtcp/ntp.ts +61 -0
  727. package/src/mirroring/rtcp/parser.ts +292 -0
  728. package/src/mirroring/rtcp/sender-report.ts +88 -0
  729. package/src/mirroring/rtcp/wire.ts +76 -0
  730. package/src/mirroring/rtp/frame-crypto.ts +38 -0
  731. package/src/mirroring/rtp/frame.ts +25 -0
  732. package/src/mirroring/rtp/packetizer.ts +95 -0
  733. package/src/mirroring/sender/audio-sender.ts +59 -0
  734. package/src/mirroring/sender/bandwidth-estimator.ts +111 -0
  735. package/src/mirroring/sender/capture-size-oracle.ts +476 -0
  736. package/src/mirroring/sender/frame-sender.ts +293 -0
  737. package/src/mirroring/sender/packet-router.ts +228 -0
  738. package/src/mirroring/sender/sender-session.ts +306 -0
  739. package/src/mirroring/sender/sender.ts +497 -0
  740. package/src/mirroring/sender/video-encoder-metrics.ts +64 -0
  741. package/src/mirroring/sender/video-sender.ts +243 -0
  742. package/src/mirroring/session-host.ts +725 -0
  743. package/src/mirroring/stats/clock-offset-estimator.ts +139 -0
  744. package/src/mirroring/stats/openscreen-stats-client.ts +19 -0
  745. package/src/mirroring/stats/sorted-map.ts +68 -0
  746. package/src/mirroring/stats/statistics-analyzer.ts +388 -0
  747. package/src/mirroring/stats/statistics-collector.ts +69 -0
  748. package/src/mirroring/stats/statistics-common.ts +112 -0
  749. package/src/mirroring/stats/statistics-dispatcher.ts +133 -0
  750. package/src/mirroring/stats/statistics.ts +170 -0
  751. package/src/mirroring/transport/udp-environment.ts +100 -0
  752. package/src/polyfill/bridge-types.ts +11 -0
  753. package/src/polyfill/presentation-receiver.ts +350 -0
  754. package/src/polyfill/presentation-standin.ts +150 -17
  755. package/src/protocol/device-auth.ts +126 -0
  756. package/src/protocol/framing.ts +1 -1
  757. package/src/protocol/index.ts +1 -0
  758. package/src/protocol/proto-wire.ts +55 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,345 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0-next.1 (prerelease)
4
+
5
+ A prerelease of 0.5.0 on the npm `next` tag: install it with `npm i electron-cast@next` (`npm i electron-cast`
6
+ still installs 0.4.0).
7
+
8
+ This release brings electron-cast's main process in line with Chrome's Media Router: devices are tracked over kept-open
9
+ channels, the sessions on them are followed whoever started them, the app can cast and control media from its own
10
+ UI, DIAL devices are found and cast to next to Cast devices, a page can present on another screen (a wired
11
+ display) with the Presentation Receiver API on the other end, and the app can mirror a tab or the desktop. Each rule names the Chromium code it follows ([docs/CHROMIUM-MAP.md](docs/CHROMIUM-MAP.md)). `mode: "chromecast"`
12
+ is frozen and behaves as before for pages; it shares the device list.
13
+
14
+ ### Highlights
15
+
16
+ - **Tab and desktop mirroring, tested on a Chromecast Ultra and a Nest Hub Max.** `createCastManager({ mirroring })` enables
17
+ `startCasting(sinkId, { castMode: "tab_mirror", webContentsId })` and
18
+ `startCasting(sinkId, { castMode: "desktop_mirror", desktopSourceId, withAudio })` in the main process, Chrome's `TAB_MIRROR` and `DESKTOP_MIRROR` cast modes, with `castMode` and `withAudio` filters on
19
+ `registerMediaSinksObserver`. `startCasting` is one method for the three modes (`StartCastingOptions`, a union on
20
+ `castMode`; `MediaCastMode` gains the two mirroring modes). It is a TypeScript port of Chrome's Cast Streaming sender
21
+ (openscreen's sender session, Chromium's frame sender policy and Mirroring Service host, and the MirroringActivity
22
+ routing): OFFER/ANSWER, VP8, VP9, H.264 in hardware and Opus, AES encryption, RTCP, NACK retransmission and bitrate adaptation.
23
+ The video encoder is set up as Chrome's `MediaVideoEncoderWrapper` sets it up (a constant bitrate, the screen content
24
+ hint), and frame drops are logged by reason.
25
+ Capture and WebCodecs encoding run in a hidden window; the sender runs in a utility process per route; the session
26
+ runs on the device's one kept-open channel. A mirrored tab is muted locally while it is cast (Chrome's muter);
27
+ desktop audio follows Chrome per platform (local playback keeps going on Windows, `kCastDesktopMirroringKeepLocalAudio`,
28
+ and is muted elsewhere). No new dependencies. Tested on Windows to a Chromecast Ultra (1080p, tab and desktop) and a
29
+ Nest Hub Max (720p): at 720p frames reach the device in about 30 ms with none late; on the Ultra, video lag at 1080p
30
+ is under investigation. Tab mirroring sends Opus and VP8 in software, with the audio in sync and only on the TV;
31
+ desktop mirroring sends the picture and system audio and keeps local audio on Windows. Not tested on Linux or macOS. Desktop mirroring on macOS is untested on a real Mac; CI covers it with video only on Electron 40+. Not ported: remoting (Electron has no hook
32
+ for it, see [DESIGN.md](docs/DESIGN.md#media-remoting-capabilities-only-the-renderer-side-is-not-reachable)). Like Chrome, a mirroring session sends `GET_CAPABILITIES`
33
+ once after the first negotiation and keeps the receiver's remoting capabilities. Tested on a Nest Hub Max: it answers
34
+ error 10106 "Remoting is not supported" and mirroring goes on.
35
+ - **Wired displays, as Chrome's `WiredDisplayMediaRouteProvider` has them, tested on a second monitor** (Windows, a
36
+ 1080x1920 portrait display). New `wiredDisplay` option on `createCastManager` (presentation mode): other screens are presentation sinks (`wired_display_<id>`, "Display N"). A
37
+ `PresentationRequest` whose URL is https (not the legacy Cast URL) or http on localhost can start on a display: the
38
+ page opens fullscreen in a receiver window that has its own in-memory session (cleared and reused, not one per
39
+ presentation), no menu or developer tools, no permissions except fullscreen, and ends the presentation if it
40
+ navigates away. The receiver is sandboxed as Chrome's is (`kPresentationReceiverSandboxFlags`: no modals, popups or
41
+ top-level navigation) by a `Content-Security-Policy: sandbox` header on every receiver document, so an iframe's
42
+ `alert()` is refused too. A display connection starts `connecting` and becomes `connected` when the receiver page is
43
+ ready, as Blink's does.
44
+ - The receiver page gets `navigator.presentation.receiver` (`connectionList`, `connectionavailable`, `send`, `close`,
45
+ `terminate`), and the controller can `reconnect(id)`. Closing the window, removing the display or `terminate()`
46
+ ends the presentation for every controller; a controller that goes away only leaves it.
47
+ - The display a page is on is left out of the picker by default, found with the new `BrowserWindow` option and
48
+ `screen.getDisplayMatching`, and `request.observeSinks` follows the window as it moves (`displayOf` overrides it).
49
+ - A request that lists both a Cast (or `cast-dial:`) URL and a page URL is one picker, as Chrome's dialog lists both
50
+ kinds of sink: `selectDevice` gets `request.displays` and may answer `{ display }` (new type `DisplayChoice`), and the
51
+ request starts on the sink it returns. Its `getAvailability()` is true when either kind has a sink.
52
+ - New exports: `createReceiverWindows` (the Electron `BrowserWindow` part, taking `BrowserWindow`, `session`,
53
+ `ipcMain` and a folder for the generated receiver preload; calling it twice on one `ipcMain` and channel throws),
54
+ the display rules (`isWiredDisplaySource`, `availableDisplays`, `wiredDisplaySinks`), and `manager.wiredDisplay`
55
+ (sinks and routes observers, `terminateRoute`). `mode: "chromecast"` is unchanged.
56
+ - **DIAL, as Chrome's Media Router does it (presentation mode).** DIAL discovery and device descriptions are tested on
57
+ real Chromecasts (1st gen, Ultra); launching an app over DIAL needs a DIAL-only TV and is untested. electron-cast now
58
+ discovers DIAL devices by SSDP and
59
+ serves the `cast-dial:` sources that Google's SDK adds to a request when the page passes a `dialRequest`
60
+ (`chrome.cast.DialRequest`, as YouTube's web app does for non-Cast TVs). Each rule follows a Chromium function,
61
+ cited in [docs/DESIGN.md](docs/DESIGN.md#dial-srcdial): an M-SEARCH on every IPv4 interface (four searches a second
62
+ apart, every 120 s), the UPnP device description and the `Application-URL` header (both only for private addresses
63
+ that equal the sender's), app info for the app a page asks about, and a sink per device. A page sees availability
64
+ per app (only to the origins Chrome allows for that app) through the same observation as its Cast URL, the picker
65
+ offers DIAL sinks that have the app next to the Cast devices that have theirs, and starting one runs the SDK's
66
+ `custom_dial_launch` round trip, an HTTP launch with the SDK's launch parameter, and a stop by `DELETE` of the run
67
+ URL. A device that is also a Cast sink (its UDN is the Cast id, and its channel is open) is shown as a Cast device
68
+ only, as in Chrome. On by default, as in Chrome; `dial: false` on `createCastManager` turns it off (SSDP and the
69
+ HTTP requests to devices stop entirely). A custom `discovery` turns it off unless `dial` is given.
70
+ - A DIAL sink that is a Cast sink too is removed, as Chrome removes it, and only DIAL discovery adds it back (not
71
+ the Cast sink going away).
72
+ - Differences from Chrome: requests have timeouts (Chrome sets none). A DIAL route has no volume or media control,
73
+ as in Chrome (`BindMediaController` is not implemented there).
74
+ - **A DIAL device is tried as a Cast device**, as Chrome's `CastMediaSinkServiceImpl` does
75
+ (`OnSinkAddedOrUpdated`, `TryConnectDialDiscoveredSink`, `CreateCastSinkFromDialSink`): when a DIAL sink is new or
76
+ changed, and on `discoverSinksNow()`, a Cast channel is opened to its address on port 8009. If it opens and the device
77
+ authenticates, the device is a Cast sink (id the sink's UUID, its friendly name and model, audio and video, or audio
78
+ only for an audio-only certificate) and the DIAL sink is removed, as above. It is skipped when a Cast sink has that id or that
79
+ address. Every failed attempt is counted per device; at ten (`kMaxDialSinkFailureCount`) the device is taken for a
80
+ non-Cast device and not tried again, until it is opened from mDNS or the network changes.
81
+ - DIAL discovery errors (no interface, a socket that fails to bind or send) are logged through `dial.log` and never
82
+ thrown; `start()` works with no network. Nothing is asked of a device for an app the page's origin may not see,
83
+ the monitored apps are bounded, stopping aborts requests in flight (a route terminated mid-launch cancels its
84
+ POST), and a `start()` without an earlier availability watch waits (up to 5 s) for the devices' app answers.
85
+ - API: `MediaSink` and `MediaRoute` gain `providerId` (`"cast"` or `"dial"`), `SinkIconType` gains `"generic"`, and
86
+ `CastDevice` gains an optional `dial` field that marks a DIAL sink. The sinks observer without a query also
87
+ reports DIAL sinks (they have no capabilities, so a `capabilities` query never does, and a `presentationUrls` query
88
+ matches them for its `cast-dial:` URLs); `manager.devices()` still lists Cast devices only. `selectDevice` can be handed a DIAL
89
+ device when the request carries a `cast-dial:` URL: return it like any other and the manager does the rest (do not
90
+ connect to it yourself). `getMediaController` on a DIAL route throws `route_not_found`. The SDK canary no longer
91
+ lists the DIAL messages and `cast-dial:` as unhandled.
92
+ - New options and methods for the device list: `sinks` (`openDelayMaxMs`, `reportDelayMs`, `retry`, `allowAllIps`,
93
+ `dynamicTimeoutDeltaMs`) on `createCastManager` and `CastSessionService`, each a Chrome setting (there is no cap or
94
+ off switch, because Chrome has none); `CastManager.discoverSinksNow()` and `CastManager.settled()` (with
95
+ `{ retries: true }`); the type `ChannelParams`.
96
+ - `isPubliclyRoutable`, `isLoopback`, `isCastAddressAllowed` and `parseIpBytes` are exported from the discovery layer
97
+ (ports of `net::IPAddress`). `APP_AVAILABILITY_REFRESH_MS` is exported.
98
+ - **Access code casting: devices can be added by address, as Chrome's access code casting adds the device a code
99
+ resolves to.** `manager.addSinkByAddress({ id, name, capabilities, ipV4Address, port })` opens a channel to a device the app knows the
100
+ address of, lists it like a discovered one (the picker, availability for pages, the sinks observers) and remembers it,
101
+ with Chrome's checks, quick open parameters (2 s connect, 3 attempts 1 s apart) and expiry: it stays for
102
+ `accessCode.deviceDuration` seconds (default 0) plus 20 s, a device a page is casting to stays until the cast ends, and a
103
+ network change removes it and brings the remembered ones back. It is off
104
+ unless `createCastManager({ accessCode: { enabled: true } })`, as Chrome's `AccessCodeCastEnabled` policy is. Turning a
105
+ typed code into an address is a private Google service that needs Chrome's sign-in, so it is not part of electron-cast;
106
+ [DESIGN.md](docs/DESIGN.md#access-code-casting-access-codets) says why. The address comes from the app, not from
107
+ Google's server as in Chrome, so validate what users type: Chrome's rules allow any private address and port. New: `addSinkByAddress`, `configureAccessCode`,
108
+ `rememberedSinks`, `createAccessCodeSink`, the `accessCode` option (with `store` to keep devices
109
+ between runs), and `pingIntervalMs` in `createClient`'s second argument.
110
+ - **`electron-cast dial-test`, a one-command test for DIAL TVs** (`npx electron-cast@next dial-test`; Node 20 or later, no
111
+ Electron), run on a real network: it found three Chromecasts over DIAL and flagged them as Cast devices. It runs the
112
+ library's own DIAL discovery, device description, app info, launch and stop against a real device, asks before it opens YouTube on it, and writes a Markdown report with names, serial numbers, UUIDs, MAC addresses,
113
+ IP addresses and URL hosts removed, plus a prefilled GitHub issue link. The package gains a `bin` entry
114
+ (`electron-cast` -> `dist/cli.js`). See the README's "Test a DIAL TV".
115
+
116
+ Not yet tried on real devices: casting from the app's own UI (`startCasting` from its menu) and the sessions that other
117
+ senders started. Both are covered by unit tests with fakes.
118
+
119
+ ### Added
120
+
121
+ - **A session tracker follows what every device runs**, from the receiver status and media status on the device's
122
+ channel, whoever started it (Chrome's `CastSessionTracker`). Sessions started elsewhere, or by this app before it
123
+ restarted, are reported through the routes observers and `getRoutes()` as non-local routes, as Chrome does;
124
+ `MediaRoute` gains `isLocal` and `sinkName`, and `origin` is empty on a non-local route. A non-local route can be
125
+ terminated and have its volume set.
126
+ - **Media control from the main process.** `manager.getMediaController(routeId, observer?)` is Chrome's
127
+ `MediaController` and `MediaStatusObserver` for a route: `play`, `pause`, `seek`, `nextTrack`, `previousTrack`,
128
+ `setVolume`, `setMute`, and the media status (title, play state, position, duration, volume, what the media can do,
129
+ images). It works on non-local routes too. Its status comes from the session tracker, as `CastMediaController`'s does:
130
+ every receiver status and every `MEDIA_STATUS` reaches every observer, changed or not, with media updates merged
131
+ into what was known and the `supportedMediaCommands` mask turned into a list. Binding sends the session's state
132
+ first and then `MEDIA_GET_STATUS`. New types `MediaController`, `MediaStatus`, `MediaStatusObserver`, `MediaImage`
133
+ and `MediaPlayState`. See docs/MAIN-API.md.
134
+ - **Casting from the app's own UI, on the page's default request.** In Chrome a page sets
135
+ `navigator.presentation.defaultRequest = new PresentationRequest(urls)`; the Cast dialog, opened from the browser's
136
+ menu or toolbar, offers it as a source, and when the user picks a device Chrome starts the presentation and fires
137
+ `connectionavailable` on the default request, which Google's Cast SDK adopts. electron-cast now does the same:
138
+ - The page-side stand-in reports `navigator.presentation.defaultRequest` (set, replaced, cleared) to the main
139
+ process, and only the window's main frame counts. A navigation or a destroyed window clears it.
140
+ - New `CastManager` methods, named after Chrome's `WebContentsPresentationManager` and `MediaRouterUI`:
141
+ `hasDefaultPresentationRequest(webContentsId)`, `getDefaultPresentationRequest(webContentsId)`,
142
+ `addPresentationObserver(webContentsId, observer)` and `startCasting(sinkId, { webContentsId })`, which starts the
143
+ default request on a sink with no picker and no user gesture. The page gets `connectionavailable` with a working
144
+ connection and the route appears in routes observers. It rejects with `MediaRouteError` carrying Chrome's
145
+ `RouteRequestResultCode` (`timed_out`, `sink_not_found`, `invalid_origin`, `cancelled`, `redundant_request`,
146
+ `unknown_error`) or `unable_to_cast`. `startCasting` launches anew on a sink that already has a route, stops the
147
+ route its window launched before, and uses the URL's `__castLaunchTimeout__` or 60 s, all as Chrome's
148
+ `CastActivityManager` does. New types `PresentationRequest`, `PresentationObserver` and `MediaCastMode`.
149
+ - `MediaSinksQuery` gains `presentationUrls`, the sinks that can run a presentation URL: as in Chrome, the device
150
+ must say the app is available (`GET_APP_AVAILABILITY`) and have its capabilities. A DIAL sink matches a
151
+ `cast-dial:` URL whose app it has, for the query's new `origin`, and `startCasting` starts a DIAL route on it, as
152
+ Chrome's dialog offers DIAL sinks for a default request's `cast-dial:` URLs.
153
+ - **Switch the mirrored tab, freeze the picture.** `switchMirroringSourceTab(routeId, webContentsId)` moves a
154
+ `tab_mirror` route to another page without ending or renegotiating the session (Chrome's "share this tab instead":
155
+ capture and the audio stream restart on the new page, encoders and timelines carry on, local muting moves to the new
156
+ page, and a second route on the same page ends). `freezeRoute` / `unfreezeRoute` pause and resume the video on its last
157
+ frame as Chrome's freeze does (audio goes on, 500 ms delay), and mirroring routes report `freezeInfo` (`canFreeze`,
158
+ `isFrozen`). Tested on a Nest Hub Max: a switch keeps the same route with no new OFFER and runs at about 30 fps after (the
159
+ picture was not checked on screen); freezing the picture works and keeps the session, but the Hub stopped acknowledging frames for about 9 s during a 15 s freeze and for 8 s after unfreezing (the sender matches Chrome; a Chrome control run is pending).
160
+ - **One route per page, and a closed tab ends its mirroring.** As in Chrome, a page that becomes a mirroring source
161
+ (a launch or a switch) loses the Cast SDK / Presentation API sessions it launched, and a page that launches one
162
+ loses its mirroring routes (`CastActivityManager::routes_by_frame_`). Closing the page being mirrored ends a tab route
163
+ (`CastMirroringServiceHost::WebContentsDestroyed`); a desktop route is unaffected. Tested on a Nest Hub Max: closing the
164
+ mirrored tab ends the route at once, and the receiver app is gone within 3 s.
165
+ - **Mirroring statistics.** A debugging aid with Chrome's names and units, like `chrome://media-router-internals`
166
+ "Mirroring stats": `setMirroringStatsEnabled(true)` before `startCasting`, then `getMirroringStats(routeId)` and
167
+ `registerMirroringStatsObserver` (every 500 ms) give `{ audio, video }` with `ENQUEUE_FPS`, the latency averages and
168
+ histograms, bitrates, packet counts and the sender's own counters. A port of openscreen's statistics collector,
169
+ clock offset estimator and analyzer, with the receiver's RTCP event log parsed. Off by default; nothing is uploaded
170
+ (Chrome's UMA is not ported). `examples/live-mirroring` takes `--stats`. `getMirroringStats` never throws, as
171
+ Chrome's `MediaRouterDebuggerImpl::GetMirroringStats` has no error path: `{}` while off and for an unknown route, and an
172
+ ended route keeps its last statistics until another route pushes. Tested on a Nest Hub Max: Chrome's names, internally
173
+ consistent; `AVG_E2E_LATENCY_MS` is 0 on the Hub, which sends no playout events.
174
+ - **Mirroring uses a hardware encoder when there is one, as Chrome does.** The capture page asks WebCodecs
175
+ (`prefer-hardware`) which of H.264, VP8 and VP9 a hardware encoder takes, and offers those hardware-first (H.264 as
176
+ Annex B); VP8 in software is offered only when no hardware codec is, or when the receiver takes none of the hardware
177
+ ones. A hardware encoder that fails mid-session no longer stops mirroring: the codec is dropped for the rest of the
178
+ app's run and the session negotiates again. Chrome's `--cast-streaming-force-{enable,disable}-hardware-<codec>` and
179
+ `--disable-cast-letterboxing` switches, and the `CastStreamingVp8` / `Vp9` / `Av1` / `HardwareHevc` / `Win|MacHardwareH264`
180
+ features of `--enable-features` / `--disable-features`, are honoured, read from `app.commandLine` (so switches the app
181
+ appends count) when the `electron` object passed as `mirroring.electron` includes `app`. Tested on a Nest Hub Max: the
182
+ Hub chose H.264 in hardware, about 30 fps at 2.7 Mbps, with about 4.4 ms per encode.
183
+ - **VP9 is offered by default, as in Chrome.** In hardware when an encoder takes it, in software under the same
184
+ hardware-first rule as VP8; there is no option for it.
185
+ - **Mirroring letterboxes like Chrome.** The capture now asks for the `fixed_aspect_ratio` policy when the receiver
186
+ cannot scale (always for a Nest Hub): frames keep a 16:9 shape whatever the page or screen looks like, and a tab is
187
+ no longer upscaled to 1920x1080. The new offer after an encoder failure and the letterboxing are tested
188
+ against the fake receiver and in the smoke test; not yet on a real device (H.264 in hardware is, above).
189
+ - **Mirroring adapts to encoder load as Chrome does.** Each encoded frame now carries Chrome's encoder utilization
190
+ (smoothed, clamped) and lossiness, estimated from the frame's pixels because WebCodecs reports no quantizer (a port of
191
+ `FrameComplexityEstimator`). `VideoSender` feeds the larger of the two back, and for a tab the capture size follows it
192
+ like Chrome's `VideoCaptureOracle`: it steps down when the encoder or the link is overloaded and back up when there is
193
+ room, within the limits of the resolution change policy. Screens are captured at the full size, as in Chrome.
194
+ Switching the tab starts the size over, as a new capture device does in Chrome. The `LOSSINESS` statistic now reads
195
+ each frame's value; it is -100, as in Chrome, until a frame has reported one. Not yet tried on a real device.
196
+ - **Mirrored frames carry their capture time, and the capture rate is limited as Chrome limits it.** A frame's
197
+ reference time is its capture time from the frame metadata when the source gives one (else the capture timestamp
198
+ moved onto the wall clock by the smallest delay seen), so uneven delivery no longer skews the receiver's playout.
199
+ Each frame carries its capture begin and end times to the sender, which logs them as `FRAME_CAPTURE_BEGIN` and
200
+ `FRAME_CAPTURE_END`, so the capture, encode and end-to-end latency statistics start at capture. The capture is thinned
201
+ to the session's frame rate by a port of Chrome's `SmoothEventSampler` (a token bucket of 1.5 frame periods, judged
202
+ on capture timestamps), so a burst after a stall is kept whole. The sender logs its pipeline stages, the router's
203
+ bursts and the frame sizes, and `smoke/perf.mjs` mirrors a 1080p page to the fake receiver to measure them. Checked
204
+ on a Nest Hub Max: a steady 30 fps, 1.1% of the video frames dropped, no audio dropped.
205
+ - **The manager follows network changes by itself, as Chrome's `DiscoveryNetworkMonitor` tells its media router.** It
206
+ computes Chrome's network id from the connected interfaces and, when it changes, does what Chrome's two observers do:
207
+ DIAL devices given up on as non-Cast are tried again, the sinks of the network being left are remembered and reopened
208
+ on coming back to it (`CastMediaSinkServiceImpl::OnNetworksChanged`), and devices added by address with no route are
209
+ removed and the remembered ones added back 4.45 s later (`AccessCodeCastSinkService::OnNetworksChanged`). DIAL
210
+ discovery forgets its devices and searches again at once instead of waiting up to 120 s, and does not search while
211
+ there is no network (`DialRegistry::OnConnectionChanged`). Node has no
212
+ network-change event, so it reads `os.networkInterfaces()` every 5 s while started; Node has no Wi-Fi SSID either, so
213
+ an interface is identified by its MAC and IPv4 network. A custom `discovery` turns it off unless the new
214
+ `networkMonitor` option is given, and `networkMonitor: false` turns it off; a `NetworkMonitor` of your own drives it in
215
+ tests. There is no method for the app to call.
216
+ - Presentation mode: `PresentationConnection.send()` takes ArrayBuffer, ArrayBufferView and Blob as well as strings,
217
+ and `binaryType` (`arraybuffer` or `blob`) picks what `message` events carry, as in Chrome. Binary goes to wired
218
+ displays, in both directions. To a Cast device it is dropped without an error, as Chrome's
219
+ `CastSessionClientImpl::OnMessage` ignores messages that are not text. One 64 MiB cap holds for text and bytes in both
220
+ directions; a larger `send()` throws `RangeError`, and a detached ArrayBuffer is a `TypeError`. Before,
221
+ `send()` threw a `TypeError` for anything but a string.
222
+
223
+ ### Changed
224
+
225
+ - **Devices are tracked as Chrome's Media Router tracks them.** electron-cast opens a channel to every device mDNS
226
+ finds (after Chrome's random delay of up to 5 s), runs device authentication on it, and lists the device only once
227
+ that has passed. A failed attempt is retried with Chrome's backoff (15 s, 3 attempts); a device that fails
228
+ authentication is never listed, where before it appeared in the picker and failed on use. The channel then stays
229
+ open, with a ping every 5 s, and is reopened after a failure (sleep and resume included); a device is dropped only
230
+ when it cannot be reopened, not when mDNS stops reporting it. The list is reported once it has been quiet for 3 s.
231
+ `manager.devices()`, the picker's list and the sinks observers show these devices, so **right after `start()` the
232
+ list is empty and fills in over a few seconds**.
233
+ - **`createClient` is called once per device, and its signature is now `(device, params)`.** A device's channel is
234
+ shared by its sessions and kept open, so clients live as long as the device is a sink, not as long as a session,
235
+ and must be fine to keep connected. `createClient` is called again after a failure, with
236
+ `params = { connectTimeoutMs, livenessTimeoutMs }` for that attempt; pass them on to `CastClient`
237
+ (`connectTimeoutMs`, `heartbeatTimeoutMs`). A channel replaced because the device's address changed stays open while
238
+ a session uses it (as Chrome leaves the old socket); an address list that mDNS merely reorders changes nothing. A
239
+ device whose host is not an IP address is skipped with a warning.
240
+ - **App availability for pages, as in Chrome.** In the default mode a page's `getAvailability()` and the devices its
241
+ `start()` offers come from the devices' own answer to `GET_APP_AVAILABILITY` for the request's app, asked over the
242
+ channels already open (Chrome's `CastAppDiscoveryServiceImpl`): a device that does not have the app is not offered,
243
+ availability turns true as soon as a device says it has the app, and `change` events follow each answer. An
244
+ "available" answer stands, an "unavailable" one for a minute, no answer never. `discoverSinksNow()` asks again by
245
+ the same rules. `mode: "chromecast"` still goes by capabilities.
246
+ - **Public and loopback device addresses are refused, as in Chrome.** Chrome opens no Cast channel to a publicly
247
+ routable or loopback address unless `MediaRouterCastAllowAllIPs` is set (`CastMediaSinkServiceImpl::OpenChannel`).
248
+ The sink service checks the address each time it opens a channel, so such a device is not listed, offered or
249
+ connected to; `sinks: { allowAllIps: true }` turns it off. Private, link-local, unique-local and `100.64.0.0/10`
250
+ addresses are unaffected.
251
+ - `joinRunningSession` is answered from the session tracker instead of connecting to every device and asking, with the
252
+ same results and errors; the device must be listed (its channel open) by then. A session whose pages all let go now
253
+ stays a (non-local) route while the device runs it, where it used to disappear from the list.
254
+ - `navigator.presentation.defaultRequest` is now a nullable attribute as in Blink: it takes a `PresentationRequest`
255
+ or `null` and throws `TypeError` for anything else. `connectionavailable` fires after the current task, as Blink
256
+ enqueues it.
257
+ - Up to 1024 media requests from a page may wait for the receiver's answer, as in Chrome
258
+ (`kMaxPendingMediaRequests`); a full table drops its older half before taking the new one (it was 100).
259
+
260
+ ### Fixed
261
+
262
+ - **Mirroring and remote-playback sources are never launched as ordinary apps.** A presentation URL naming a Cast
263
+ Streaming app (`0F5096E8`, `85CDB22F`), alone or beside other apps in one legacy URL, and a `remote-playback:` URL
264
+ are unavailable (`getAvailability()` is `false`) and `start()` rejects with `NotFoundError` ("No screens found.").
265
+ Of several URLs the first ordinary Cast app one is served. The stand-in's `PresentationRequest` drops URLs of unknown
266
+ protocol like Blink and throws `NotSupportedError` when none is left.
267
+ - A device that fails device authentication no longer shows in the picker (see Changed).
268
+
269
+ ### Documentation
270
+
271
+ - A rewritten README with a Chrome parity table (including what is out of scope, such as Chrome's Global Media
272
+ Controls panel, and what is partly done: access-code
273
+ casting, without the code lookup), a getting-started page, guides (device picker, restart rejoin, windows and iframes, custom
274
+ receivers, audio-only devices and groups, device authentication, the low-level client, testing), troubleshooting
275
+ and a FAQ, architecture diagrams and a glossary, a map of the Chromium code each module follows, and CONTRIBUTING.
276
+ - Tested-on facts: casting, rejoin after a force-kill, and stop verified end to end in an Electron 45 app on Linux
277
+ (Ubuntu under WSL2, dev and packaged builds) as well as Windows; IPv6 discovery and the Cast channel with TLS and device
278
+ authentication over unique-local and link-local addresses verified on real devices.
279
+ - `npm run check` now also checks the docs: every public export is mentioned, the TypeScript examples typecheck
280
+ against the sources, and relative links and anchors resolve; `npm run docs:check:chromium` (network) rechecks the
281
+ Chromium citations. Comment fixes only in `src/`.
282
+
283
+ ## 0.4.0
284
+
285
+ - **Devices are now verified, as in Chrome.** `CastClient.connect()` runs the Cast device authentication challenge
286
+ after TLS and before CONNECT: it checks the device's certificate chain against Google's Cast roots (a port of
287
+ Chromium's checks, with no new dependencies), revocation, and a signature tied to the connection's TLS certificate.
288
+ A device that fails makes `connect()` reject with the new `CastAuthError` (with a `reason`), and the page sees an
289
+ unreachable device. It is on by default. Set `verifyDevices: false` on `createCastManager`, or `verifyDevice: false`
290
+ on `CastClient`, for receivers that are not Google-certified. `CastClient` also gains `authTimeoutMs`, `deviceAuth`
291
+ (trust roots and clock, for tests and private deployments) and a `deviceAuth` result (`policy`, `hashAlgorithm`,
292
+ `nonceEchoed`, `usedFallbackCrl`, `revocationChecked`). The protocol layer gains `DeviceAuthMessage` encoding and
293
+ decoding. Tested on 8 real devices, which all passed.
294
+ - Device authentication does not start refusing devices that send no CRL once the built-in fallback CRL is past its 20
295
+ weeks: with a lapsed fallback and no valid CRL from the device, the revocation check is skipped and
296
+ `deviceAuth.revocationChecked` is `false` (Chromium fails closed; Chrome updates itself, an app may not). All other
297
+ checks, the device's own CRL, and revocation by a still-valid fallback CRL are unchanged. The fallback window starts
298
+ at the package's build time, stamped by `npm run build`.
299
+ - Presentation mode: `start()` now needs transient user activation in the main process too, not only in the page's
300
+ stand-in. The preload reads `navigator.userActivation.isActive` in its isolated world and the main process refuses
301
+ a start without it (`AbortError`, "PresentationRequest::start() requires user gesture.", as Chrome's browser-side
302
+ check). The stand-in's own refusal now throws Blink's `InvalidAccessError` instead of `AbortError`. Electron has no
303
+ main-process API for activation, so a compromised renderer could still forge it (see SECURITY.md).
304
+ - Presentation mode: a page can rejoin a session that kept playing on the device after the app restarted, the way it
305
+ can in Chrome. The library persists nothing: the app keeps the session id, the page calls
306
+ `chrome.cast.requestSessionById`, Google's SDK turns that into `reconnect("cast-session_<id>")`, and electron-cast
307
+ finds the session by asking the known devices what they run (the new `joinRunningSession` service call). Auto-join
308
+ still does not join such sessions, as in Chrome. Joining by id no longer checks the origin, also for a session this
309
+ run holds, as in Chrome (`AppActivity::CanJoinSession`); `allowOrigin` still applies. `mode: "chromecast"` is
310
+ unchanged.
311
+ - Google's Cast SDK now works inside iframes in presentation mode, with Chrome's per-frame semantics: each frame has its
312
+ own availability watches, connections and sessions, receives only its own events, and uses its own origin. An iframe
313
+ that navigates parks its sessions; a removed iframe or a navigating page ends them. Needs
314
+ `nodeIntegrationInSubFrames: true` in the window's `webPreferences` so the preload runs in iframes; without it nothing
315
+ changes. `mode: "chromecast"` stays main-frame only.
316
+ - Discovery also runs mDNS over IPv6 (link-local, per adapter), so IPv6-only devices are found; `fe80::` addresses carry
317
+ their scope so they can be connected to, and IPv4 is still preferred. A network adapter that goes away takes its
318
+ devices with it at once, and sockets are replaced after the machine wakes from sleep.
319
+ - Main-process API on the cast manager, modelled on Chrome's Media Router: sinks and routes observers, `getRoutes`,
320
+ `terminateRoute`, `detachRoute`, route volume control, and a third `selectDevice` argument that streams devices
321
+ found while the picker is open. Sink icon types follow Chrome's `GetCastSinkIconType`, and a route's `members` are
322
+ `webContents.id`s, also for iframes. See docs/MAIN-API.md.
323
+ - Presentation mode matches Chrome's Media Router for v2 requests: `QUEUE_NEXT`, `QUEUE_PREV` and `PRECACHE` are
324
+ forwarded to the receiver (they were dropped, so their callbacks never fired); a failed `SET_VOLUME` or `STOP`
325
+ reports `internal_error` / "unknown error"; a media request that cannot be sent gets no reply; an app message for a
326
+ vanished session reports `session_error` "Invalid session ID". Unknown v2 message types are still dropped, as in Chrome.
327
+ - Added a CommonJS build (`dist/cjs`, no new dependencies) with `import` / `require` conditions on every entry point, so a
328
+ non-sandboxed CommonJS preload or main process can `require("electron-cast/preload")` and `require("electron-cast/main")`.
329
+ The ESM build is unchanged. `package.json` declares an optional peer dependency on `electron >=35`.
330
+ - CI runs a smoke test in a real Electron (35, 40 and the latest stable, on Linux, Windows and macOS): a sandboxed
331
+ preload built from `electron-cast/preload`, `createCastManager` from `electron-cast/main` with a fake device, both
332
+ modes. `npm run smoke` runs it locally. A weekly canary (`npm run canary`) fetches Google's Cast sender SDK for the
333
+ current Chrome majors and checks it still speaks the message envelope the translator expects; a failed run opens one
334
+ issue.
335
+ - The `DeviceAuthResult`, `DeviceAuthOptions`, `CastCertError` and `CastDeviceCertPolicy` types are exported.
336
+ - The page's IPC channel accepts only the bridge's own methods. `joinRunningSession`, which only main calls, is refused
337
+ from a page as an unknown method.
338
+ - Thanks to Michael Arthur (@mikey0000). Restart rejoin was proposed by him in
339
+ [#1](https://github.com/adammpkins/electron-cast/pull/1) (an optional `sessionStore`); 0.4.0 does it the way Chrome
340
+ does instead, as described above. His [#2](https://github.com/adammpkins/electron-cast/pull/2) arrived independently
341
+ at the presentation-mode design that 0.3.0 shipped.
342
+
3
343
  ## 0.3.1
4
344
 
5
345
  - A page that reloads while casting now gets its session back. A navigation used to leave the page's sessions, which