@camera.ui/server 0.0.50-internal.0 → 0.0.50-internal.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 (387) hide show
  1. package/dist/interface/index.html +44 -44
  2. package/dist/interface/js/{@primevue.OhxoO3MD.0.0.50-internal.0.js → @primevue.CiB2EGly.0.0.50-internal.1.js} +1 -1
  3. package/dist/interface/js/{@tanstack.D1IL6eOv.0.0.50-internal.0.js → @tanstack.DxMw_rJn.0.0.50-internal.1.js} +1 -1
  4. package/dist/interface/js/{@vee-validate.BGPyWWTh.0.0.50-internal.0.js → @vee-validate.RxZ3hn6V.0.0.50-internal.1.js} +1 -1
  5. package/dist/interface/js/{@vueuse.BsKtqdiG.0.0.50-internal.0.js → @vueuse.C-k73ACm.0.0.50-internal.1.js} +1 -1
  6. package/dist/interface/js/{Adminpanel.D93Kvbwp.0.0.50-internal.0.js → Adminpanel.DumNu6GD.0.0.50-internal.1.js} +1 -1
  7. package/dist/interface/js/{Camera.DF2l3OMA.0.0.50-internal.0.js → Camera.BuosoqFl.0.0.50-internal.1.js} +1 -1
  8. package/dist/interface/js/{Cameras.YzvZccdv.0.0.50-internal.0.js → Cameras.A7NJflGG.0.0.50-internal.1.js} +2 -2
  9. package/dist/interface/js/Cammesh.Dv3C0UiR.0.0.50-internal.1.js +1 -0
  10. package/dist/interface/js/{Camview.CB7_HnoQ.0.0.50-internal.0.js → Camview.GgjJp7JR.0.0.50-internal.1.js} +1 -1
  11. package/dist/interface/js/{Config.BwflsWTm.0.0.50-internal.0.js → Config.BL3L-BFE.0.0.50-internal.1.js} +2 -2
  12. package/dist/interface/js/{Console.DZM8pN8Q.0.0.50-internal.0.js → Console.CxwRmUVF.0.0.50-internal.1.js} +1 -1
  13. package/dist/interface/js/{CuiConsole.BXXU7Gth.0.0.50-internal.0.js → CuiConsole.D16kkT6R.0.0.50-internal.1.js} +1 -1
  14. package/dist/interface/js/{CuiPluginCard.YFOrpbVD.0.0.50-internal.0.js → CuiPluginCard.Bkp__d8n.0.0.50-internal.1.js} +1 -1
  15. package/dist/interface/js/{CuiTimeline.VV5KSJd5.0.0.50-internal.0.js → CuiTimeline.C9HKvo0G.0.0.50-internal.1.js} +1 -1
  16. package/dist/interface/js/{FirstSteps.b-nvymgb.0.0.50-internal.0.js → FirstSteps.QuJjtAtF.0.0.50-internal.1.js} +1 -1
  17. package/dist/interface/js/{Plugin.BOMpVEwM.0.0.50-internal.0.js → Plugin.BLUUbEej.0.0.50-internal.1.js} +1 -1
  18. package/dist/interface/js/{Plugins.DdPwaUDA.0.0.50-internal.0.js → Plugins.DviCIk7w.0.0.50-internal.1.js} +1 -1
  19. package/dist/interface/js/Recordings.Dsp07cHs.0.0.50-internal.1.js +1 -0
  20. package/dist/interface/js/{Settings.D24ttaPu.0.0.50-internal.0.js → Settings.Clx4y9gP.0.0.50-internal.1.js} +1 -1
  21. package/dist/interface/js/{SettingsAccount.ms3aqz4E.0.0.50-internal.0.js → SettingsAccount.cfY4-PYd.0.0.50-internal.1.js} +1 -1
  22. package/dist/interface/js/SettingsAppearance.CBGZAazb.0.0.50-internal.1.js +1 -0
  23. package/dist/interface/js/{SettingsAppearance.vue_vue_type_script_setup_true_lang.CBQ6lL3T.0.0.50-internal.0.js → SettingsAppearance.vue_vue_type_script_setup_true_lang.kxAPXcBy.0.0.50-internal.1.js} +1 -1
  24. package/dist/interface/js/{SettingsBackup.BPEc4Rjg.0.0.50-internal.0.js → SettingsBackup.DOaJA4pp.0.0.50-internal.1.js} +1 -1
  25. package/dist/interface/js/SettingsRecordings.BGcwL6tk.0.0.50-internal.1.js +1 -0
  26. package/dist/interface/js/{SettingsRemote.BL5nXbUT.0.0.50-internal.0.js → SettingsRemote.BVU_w1Jm.0.0.50-internal.1.js} +1 -1
  27. package/dist/interface/js/{SettingsSystem.D7T0AIpm.0.0.50-internal.0.js → SettingsSystem.P0vy90vA.0.0.50-internal.1.js} +1 -1
  28. package/dist/interface/js/{SettingsUsers.1u0vCOVG.0.0.50-internal.0.js → SettingsUsers.DaP5m7eo.0.0.50-internal.1.js} +1 -1
  29. package/dist/interface/js/{VersionsHandler.vue_vue_type_script_setup_true_lang.xDishkkS.0.0.50-internal.0.js → VersionsHandler.vue_vue_type_script_setup_true_lang.MmrWYW3K.0.0.50-internal.1.js} +1 -1
  30. package/dist/interface/js/{ace-builds.D1nmvCwb.0.0.50-internal.0.js → ace-builds.C0aqA_3x.0.0.50-internal.1.js} +2 -2
  31. package/dist/interface/js/{ace.config.G96T2z54.0.0.50-internal.0.js → ace.config.C9wgzklI.0.0.50-internal.1.js} +1 -1
  32. package/dist/interface/js/{backup.B_Gzxtp_.0.0.50-internal.0.js → backup.BeH6lJ5t.0.0.50-internal.1.js} +1 -1
  33. package/dist/interface/js/{chart.js.CP_nMnnf.0.0.50-internal.0.js → chart.js.BQHSWV_g.0.0.50-internal.1.js} +1 -1
  34. package/dist/interface/js/{close-circle.DYLuVIOg.0.0.50-internal.0.js → close-circle.DDKMxauw.0.0.50-internal.1.js} +1 -1
  35. package/dist/interface/js/{dnd-core.T9OeW7mu.0.0.50-internal.0.js → dnd-core.dWz9rJqH.0.0.50-internal.1.js} +1 -1
  36. package/dist/interface/js/{draggabilly.D3zGcBb3.0.0.50-internal.0.js → draggabilly.D-iZIS1n.0.0.50-internal.1.js} +1 -1
  37. package/dist/interface/js/{engine.io-client.kITRnq-g.0.0.50-internal.0.js → engine.io-client.BwxOddB_.0.0.50-internal.1.js} +1 -1
  38. package/dist/interface/js/{fast-deep-equal.Bpc9mIsj.0.0.50-internal.0.js → fast-deep-equal.Dz96RC_N.0.0.50-internal.1.js} +1 -1
  39. package/dist/interface/js/{highlight.js.BlSXU-Wb.0.0.50-internal.0.js → highlight.js.CmcM8OM6.0.0.50-internal.1.js} +1 -1
  40. package/dist/interface/js/{linkify-it.C3N1lWsJ.0.0.50-internal.0.js → linkify-it.BgLcBzlw.0.0.50-internal.1.js} +1 -1
  41. package/dist/interface/js/{main.D0YR3Jat.0.0.50-internal.0.js → main.6bOgRV7D.0.0.50-internal.1.js} +3 -3
  42. package/dist/interface/js/{markdown-it.Dj0dt5s2.0.0.50-internal.0.js → markdown-it.CTgfs-3p.0.0.50-internal.1.js} +1 -1
  43. package/dist/interface/js/{nprogress.BwQWDcGj.0.0.50-internal.0.js → nprogress.CMhnq8jS.0.0.50-internal.1.js} +1 -1
  44. package/dist/interface/js/{pinia.DRh7plEC.0.0.50-internal.0.js → pinia.CuC5ZfNs.0.0.50-internal.1.js} +1 -1
  45. package/dist/interface/js/{primevue.Cl58krXf.0.0.50-internal.0.js → primevue.DmwjJ4xV.0.0.50-internal.1.js} +1 -1
  46. package/dist/interface/js/{qrcode.C1sDj6P8.0.0.50-internal.0.js → qrcode.DGZO3j1c.0.0.50-internal.1.js} +1 -1
  47. package/dist/interface/js/{react-dnd-touch-backend.BA4WhUJo.0.0.50-internal.0.js → react-dnd-touch-backend.CEGHlD-T.0.0.50-internal.1.js} +1 -1
  48. package/dist/interface/js/{refresh-rounded.D_SmhhUf.0.0.50-internal.0.js → refresh-rounded.D0keXzBc.0.0.50-internal.1.js} +1 -1
  49. package/dist/interface/js/{rxjs.C-fTBwEO.0.0.50-internal.0.js → rxjs.CiDbFOB0.0.0.50-internal.1.js} +1 -1
  50. package/dist/interface/js/{socket.io-client.DKrRxgjP.0.0.50-internal.0.js → socket.io-client.BPcXPAHG.0.0.50-internal.1.js} +1 -1
  51. package/dist/interface/js/{socket.io-parser.EXj3YDH2.0.0.50-internal.0.js → socket.io-parser.DSGzrW_l.0.0.50-internal.1.js} +1 -1
  52. package/dist/interface/js/{system.CY8rGd-Q.0.0.50-internal.0.js → system.BKlEObmx.0.0.50-internal.1.js} +1 -1
  53. package/dist/interface/js/{trash-fill.CMnCN3Oy.0.0.50-internal.0.js → trash-fill.BDFILs86.0.0.50-internal.1.js} +1 -1
  54. package/dist/interface/js/{unidragger.D0w6Tqtt.0.0.50-internal.0.js → unidragger.DcxsxHCS.0.0.50-internal.1.js} +1 -1
  55. package/dist/interface/js/{vee-validate.BeiObIH8.0.0.50-internal.0.js → vee-validate.BGRg3oQ8.0.0.50-internal.1.js} +1 -1
  56. package/dist/interface/js/{vue-chartjs.DtdZdiYw.0.0.50-internal.0.js → vue-chartjs.B9yk2de7.0.0.50-internal.1.js} +1 -1
  57. package/dist/interface/js/{vue-i18n.BW2bx_6z.0.0.50-internal.0.js → vue-i18n.DXDZITpf.0.0.50-internal.1.js} +1 -1
  58. package/dist/interface/js/{vue-inline-svg.BJkQGmKz.0.0.50-internal.0.js → vue-inline-svg.BDYaTfbi.0.0.50-internal.1.js} +1 -1
  59. package/dist/interface/js/{vue-router.B2mOXHaC.0.0.50-internal.0.js → vue-router.CFEDA008.0.0.50-internal.1.js} +1 -1
  60. package/dist/interface/js/{vue-zoomable.BKDyCJE7.0.0.50-internal.0.js → vue-zoomable.zqTafMgD.0.0.50-internal.1.js} +1 -1
  61. package/dist/interface/js/{vue3-dnd.DRK24CBp.0.0.50-internal.0.js → vue3-dnd.BxM3dbYs.0.0.50-internal.1.js} +1 -1
  62. package/dist/interface/js/{zoom-out.DxvzgVEo.0.0.50-internal.0.js → zoom-out.B6SY9IIj.0.0.50-internal.1.js} +1 -1
  63. package/dist/interface/sw.js +1 -1
  64. package/dist/server/package.json +1 -1
  65. package/package.json +1 -1
  66. package/.prettierignore +0 -12
  67. package/.prettierrc.json +0 -12
  68. package/artillery.yaml +0 -29
  69. package/bin/cameraui-server.ts +0 -11
  70. package/dist/interface/js/Cammesh.D-6dAROQ.0.0.50-internal.0.js +0 -1
  71. package/dist/interface/js/Recordings.DhxjIW7e.0.0.50-internal.0.js +0 -1
  72. package/dist/interface/js/SettingsAppearance.DsTjKXk1.0.0.50-internal.0.js +0 -1
  73. package/dist/interface/js/SettingsRecordings.DgW7M0jj.0.0.50-internal.0.js +0 -1
  74. package/eslint.config.js +0 -103
  75. package/localdeps.txt +0 -10
  76. package/mypy.ini +0 -30
  77. package/requirements.txt +0 -15
  78. package/ruff.toml +0 -90
  79. package/src/__init__.py +0 -0
  80. package/src/_camera_ui_tools/__init__.py +0 -0
  81. package/src/_camera_ui_tools/__pycache__/__init__.cpython-311.pyc +0 -0
  82. package/src/api/controllers/api.controller.ts +0 -19
  83. package/src/api/controllers/auth.controller.ts +0 -294
  84. package/src/api/controllers/backup.controller.ts +0 -72
  85. package/src/api/controllers/cameras.controller.ts +0 -1029
  86. package/src/api/controllers/config.controller.ts +0 -102
  87. package/src/api/controllers/files.controller.ts +0 -35
  88. package/src/api/controllers/frameWorkers.controller.ts +0 -109
  89. package/src/api/controllers/plugins.controller.ts +0 -1206
  90. package/src/api/controllers/system.controller.ts +0 -273
  91. package/src/api/controllers/users.controller.ts +0 -648
  92. package/src/api/database/checks.ts +0 -268
  93. package/src/api/database/constants.ts +0 -8
  94. package/src/api/database/index.ts +0 -262
  95. package/src/api/database/migration.ts +0 -62
  96. package/src/api/database/selfcheck.ts +0 -492
  97. package/src/api/database/types.ts +0 -104
  98. package/src/api/go2rtc/api/application.ts +0 -48
  99. package/src/api/go2rtc/api/config.ts +0 -61
  100. package/src/api/go2rtc/api/discover.ts +0 -197
  101. package/src/api/go2rtc/api/index.ts +0 -49
  102. package/src/api/go2rtc/api/snapshot.ts +0 -44
  103. package/src/api/go2rtc/api/streams.ts +0 -168
  104. package/src/api/go2rtc/index.ts +0 -43
  105. package/src/api/go2rtc/queue.ts +0 -50
  106. package/src/api/go2rtc/types.ts +0 -174
  107. package/src/api/index.ts +0 -286
  108. package/src/api/middlewares/authPermission.middleware.ts +0 -46
  109. package/src/api/middlewares/authValidation.middleware.ts +0 -160
  110. package/src/api/middlewares/pagination.middleware.ts +0 -67
  111. package/src/api/middlewares/socketAuth.middleware.ts +0 -136
  112. package/src/api/plugins/header.plugin.ts +0 -15
  113. package/src/api/plugins/logger.plugin.ts +0 -44
  114. package/src/api/plugins/proxy.plugin.ts +0 -255
  115. package/src/api/plugins/socket.plugin.ts +0 -28
  116. package/src/api/plugins/system.plugin.ts +0 -48
  117. package/src/api/plugins/useragent.plugin.ts +0 -19
  118. package/src/api/routes/api.routes.ts +0 -10
  119. package/src/api/routes/auth.routes.ts +0 -56
  120. package/src/api/routes/backup.routes.ts +0 -28
  121. package/src/api/routes/cameras.routes.ts +0 -281
  122. package/src/api/routes/config.routes.ts +0 -66
  123. package/src/api/routes/files.routes.ts +0 -15
  124. package/src/api/routes/frameWorkers.routes.ts +0 -39
  125. package/src/api/routes/index.ts +0 -37
  126. package/src/api/routes/plugins.routes.ts +0 -420
  127. package/src/api/routes/system.routes.ts +0 -101
  128. package/src/api/routes/users.routes.ts +0 -167
  129. package/src/api/schemas/backup.schema.ts +0 -112
  130. package/src/api/schemas/cameras.schema.ts +0 -479
  131. package/src/api/schemas/config.schema.ts +0 -38
  132. package/src/api/schemas/go2rtc.schema.ts +0 -189
  133. package/src/api/schemas/plugins.schema.ts +0 -126
  134. package/src/api/schemas/storage.schema.ts +0 -11
  135. package/src/api/schemas/system.schema.ts +0 -45
  136. package/src/api/schemas/users.schema.ts +0 -185
  137. package/src/api/services/auth.service.ts +0 -210
  138. package/src/api/services/backup.service.ts +0 -144
  139. package/src/api/services/cameras.service.ts +0 -671
  140. package/src/api/services/plugins.service.ts +0 -470
  141. package/src/api/services/system.service.ts +0 -85
  142. package/src/api/services/users.service.ts +0 -276
  143. package/src/api/types/index.ts +0 -675
  144. package/src/api/utils/cert.ts +0 -254
  145. package/src/api/utils/constants.ts +0 -17
  146. package/src/api/utils/fetch.ts +0 -21
  147. package/src/api/utils/moveFiles.ts +0 -45
  148. package/src/api/utils/parse.ts +0 -17
  149. package/src/api/websocket/index.ts +0 -110
  150. package/src/api/websocket/nsp/logs.ts +0 -240
  151. package/src/api/websocket/nsp/main.ts +0 -27
  152. package/src/api/websocket/nsp/metrics.ts +0 -301
  153. package/src/api/websocket/nsp/notifications.ts +0 -43
  154. package/src/api/websocket/nsp/plugins.ts +0 -37
  155. package/src/api/websocket/nsp/server.ts +0 -220
  156. package/src/api/websocket/nsp/status.ts +0 -77
  157. package/src/api/websocket/types.ts +0 -55
  158. package/src/api.ts +0 -163
  159. package/src/camera/classes.ts +0 -32
  160. package/src/camera/controller.ts +0 -579
  161. package/src/camera/device.ts +0 -422
  162. package/src/camera/frameWorker.ts +0 -403
  163. package/src/camera/index.ts +0 -679
  164. package/src/camera/interfaces.ts +0 -95
  165. package/src/camera/iou.ts +0 -153
  166. package/src/camera/polygon.ts +0 -226
  167. package/src/camera/python/__init__.py +0 -0
  168. package/src/camera/python/__pycache__/__init__.cpython-311.pyc +0 -0
  169. package/src/camera/python/__pycache__/classes.cpython-311.pyc +0 -0
  170. package/src/camera/python/__pycache__/delegate_controller.cpython-311.pyc +0 -0
  171. package/src/camera/python/__pycache__/interfaces.cpython-311.pyc +0 -0
  172. package/src/camera/python/__pycache__/iou.cpython-310.pyc +0 -0
  173. package/src/camera/python/__pycache__/iou.cpython-311.pyc +0 -0
  174. package/src/camera/python/__pycache__/iou2.cpython-310.pyc +0 -0
  175. package/src/camera/python/__pycache__/polygon.cpython-311.pyc +0 -0
  176. package/src/camera/python/__pycache__/typings.cpython-311.pyc +0 -0
  177. package/src/camera/python/__pycache__/video_frame.cpython-311.pyc +0 -0
  178. package/src/camera/python/classes.py +0 -41
  179. package/src/camera/python/interfaces.py +0 -130
  180. package/src/camera/python/iou.py +0 -158
  181. package/src/camera/python/polygon.py +0 -230
  182. package/src/camera/python/test/__pycache__/polygon.cpython-310.pyc +0 -0
  183. package/src/camera/python/test/iou_test.py +0 -799
  184. package/src/camera/python/test/polygon.py +0 -238
  185. package/src/camera/python/test/polygon_test.py +0 -256
  186. package/src/camera/python/test/polygon_test2.py +0 -484
  187. package/src/camera/python/typings.py +0 -50
  188. package/src/camera/python/video_frame.py +0 -143
  189. package/src/camera/session.ts +0 -192
  190. package/src/camera/streaming/fmp4-session.ts +0 -390
  191. package/src/camera/streaming/peer-connection.ts +0 -273
  192. package/src/camera/streaming/rtsp-session.ts +0 -331
  193. package/src/camera/streaming/webrtc-connection.ts +0 -260
  194. package/src/camera/streaming/werift-session.ts +0 -317
  195. package/src/camera/test/iou_test.ts +0 -761
  196. package/src/camera/test/polygon.test.ts +0 -611
  197. package/src/camera/test/polygon_test.ts +0 -210
  198. package/src/camera/types.ts +0 -48
  199. package/src/camera/utils.ts +0 -489
  200. package/src/camera/videoFrame.ts +0 -123
  201. package/src/cloud/index.ts +0 -61
  202. package/src/cloud/remote/cloudflare.ts +0 -18
  203. package/src/cloud/remote/upnp.ts +0 -18
  204. package/src/cloud/remote/utils.ts +0 -24
  205. package/src/cloud/types.ts +0 -16
  206. package/src/decoder/child.ts +0 -883
  207. package/src/decoder/imageUtils.ts +0 -275
  208. package/src/decoder/manager.ts +0 -251
  209. package/src/decoder/python/__init__.py +0 -0
  210. package/src/decoder/python/__pycache__/__init__.cpython-311.pyc +0 -0
  211. package/src/decoder/python/__pycache__/image_utils.cpython-311.pyc +0 -0
  212. package/src/decoder/python/__pycache__/typings.cpython-311.pyc +0 -0
  213. package/src/decoder/python/__pycache__/utils.cpython-311.pyc +0 -0
  214. package/src/decoder/python/child.py +0 -903
  215. package/src/decoder/python/image_utils.py +0 -196
  216. package/src/decoder/python/pool.py +0 -45
  217. package/src/decoder/python/test/group.py +0 -62
  218. package/src/decoder/python/test/motion.mp4 +0 -0
  219. package/src/decoder/python/test/motion2.mp4 +0 -0
  220. package/src/decoder/python/test/opencl.cl +0 -70
  221. package/src/decoder/python/test/opencl2.cl +0 -130
  222. package/src/decoder/python/test/test.py +0 -427
  223. package/src/decoder/python/test/test1.jpg +0 -0
  224. package/src/decoder/python/test/test1_resized.jpg +0 -0
  225. package/src/decoder/python/test/test2.jpg +0 -0
  226. package/src/decoder/python/test/test2.py +0 -451
  227. package/src/decoder/python/test/test2_resized.jpg +0 -0
  228. package/src/decoder/python/test/test3.jpg +0 -0
  229. package/src/decoder/python/test/utils.py +0 -50
  230. package/src/decoder/python/typings.py +0 -57
  231. package/src/decoder/python/utils.py +0 -70
  232. package/src/decoder/test/child.ts +0 -117
  233. package/src/decoder/test/ffmpeg.ts +0 -371
  234. package/src/decoder/test/test.ts +0 -182
  235. package/src/decoder/types.ts +0 -27
  236. package/src/decoder/utils.ts +0 -64
  237. package/src/decoder/wasm/asconfig.json +0 -28
  238. package/src/decoder/wasm/assembly/console.ts +0 -1
  239. package/src/decoder/wasm/assembly/index.ts +0 -890
  240. package/src/decoder/wasm/build/decoder.d.ts +0 -43
  241. package/src/decoder/wasm/build/decoder.js +0 -108
  242. package/src/decoder/wasm/build/decoder.wasm +0 -0
  243. package/src/decoder/wasm/tsconfig.json +0 -5
  244. package/src/decoder/worker.ts +0 -113
  245. package/src/go2rtc/index.ts +0 -324
  246. package/src/go2rtc/types.ts +0 -88
  247. package/src/main.ts +0 -267
  248. package/src/manager/coreManager.ts +0 -78
  249. package/src/manager/deviceManager.ts +0 -132
  250. package/src/manager/types.ts +0 -17
  251. package/src/plugins/index.ts +0 -443
  252. package/src/plugins/plugin.ts +0 -177
  253. package/src/plugins/runtime/base.ts +0 -282
  254. package/src/plugins/runtime/index.ts +0 -15
  255. package/src/plugins/runtime/node/child.ts +0 -193
  256. package/src/plugins/runtime/node/index.ts +0 -67
  257. package/src/plugins/runtime/node/plugin.ts +0 -122
  258. package/src/plugins/runtime/node/pluginApi.ts +0 -27
  259. package/src/plugins/runtime/node/proxy/cameraDevice.ts +0 -299
  260. package/src/plugins/runtime/node/proxy/coreManager.ts +0 -128
  261. package/src/plugins/runtime/node/proxy/deviceManager.ts +0 -187
  262. package/src/plugins/runtime/node/storage.ts +0 -312
  263. package/src/plugins/runtime/node/storageController.ts +0 -91
  264. package/src/plugins/runtime/python/__init__.py +0 -0
  265. package/src/plugins/runtime/python/__pycache__/__init__.cpython-311.pyc +0 -0
  266. package/src/plugins/runtime/python/__pycache__/camera_storage.cpython-311.pyc +0 -0
  267. package/src/plugins/runtime/python/__pycache__/config_service.cpython-311.pyc +0 -0
  268. package/src/plugins/runtime/python/__pycache__/constants.cpython-311.pyc +0 -0
  269. package/src/plugins/runtime/python/__pycache__/ipc.cpython-311.pyc +0 -0
  270. package/src/plugins/runtime/python/__pycache__/logger.cpython-311.pyc +0 -0
  271. package/src/plugins/runtime/python/__pycache__/message_queue.cpython-311.pyc +0 -0
  272. package/src/plugins/runtime/python/__pycache__/namespaces.cpython-311.pyc +0 -0
  273. package/src/plugins/runtime/python/__pycache__/plugin.cpython-311.pyc +0 -0
  274. package/src/plugins/runtime/python/__pycache__/plugin_api.cpython-311.pyc +0 -0
  275. package/src/plugins/runtime/python/__pycache__/plugin_logger.cpython-311.pyc +0 -0
  276. package/src/plugins/runtime/python/__pycache__/proxy_utils.cpython-311.pyc +0 -0
  277. package/src/plugins/runtime/python/__pycache__/schema.cpython-311.pyc +0 -0
  278. package/src/plugins/runtime/python/__pycache__/storage.cpython-311.pyc +0 -0
  279. package/src/plugins/runtime/python/__pycache__/storage_controller.cpython-311.pyc +0 -0
  280. package/src/plugins/runtime/python/__pycache__/typings.cpython-311.pyc +0 -0
  281. package/src/plugins/runtime/python/child.py +0 -248
  282. package/src/plugins/runtime/python/index.ts +0 -73
  283. package/src/plugins/runtime/python/namespaces.py +0 -101
  284. package/src/plugins/runtime/python/plugin.py +0 -155
  285. package/src/plugins/runtime/python/plugin_api.py +0 -29
  286. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-310.pyc +0 -0
  287. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-311.pyc +0 -0
  288. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-38.pyc +0 -0
  289. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-39.pyc +0 -0
  290. package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-311.pyc +0 -0
  291. package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-39.pyc +0 -0
  292. package/src/plugins/runtime/python/proxy/__pycache__/core_manager.cpython-311.pyc +0 -0
  293. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-310.pyc +0 -0
  294. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-311.pyc +0 -0
  295. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-38.pyc +0 -0
  296. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-39.pyc +0 -0
  297. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-310.pyc +0 -0
  298. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-311.pyc +0 -0
  299. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-38.pyc +0 -0
  300. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-39.pyc +0 -0
  301. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-310.pyc +0 -0
  302. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-311.pyc +0 -0
  303. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-38.pyc +0 -0
  304. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-39.pyc +0 -0
  305. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-310.pyc +0 -0
  306. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-311.pyc +0 -0
  307. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-38.pyc +0 -0
  308. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-39.pyc +0 -0
  309. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-310.pyc +0 -0
  310. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-311.pyc +0 -0
  311. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-38.pyc +0 -0
  312. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-39.pyc +0 -0
  313. package/src/plugins/runtime/python/proxy/camera_device.py +0 -1732
  314. package/src/plugins/runtime/python/proxy/core_manager.py +0 -126
  315. package/src/plugins/runtime/python/proxy/device_manager.py +0 -197
  316. package/src/plugins/runtime/python/schema.py +0 -99
  317. package/src/plugins/runtime/python/storage.py +0 -353
  318. package/src/plugins/runtime/python/storage_controller.py +0 -102
  319. package/src/plugins/runtime/python/typings.py +0 -195
  320. package/src/plugins/schema.ts +0 -472
  321. package/src/plugins/types.ts +0 -60
  322. package/src/plugins/worker.ts +0 -250
  323. package/src/rpc/index.ts +0 -149
  324. package/src/rpc/namespaces.ts +0 -79
  325. package/src/rpc/server.ts +0 -422
  326. package/src/rpc/types.ts +0 -119
  327. package/src/rpc/utils.ts +0 -16
  328. package/src/services/config/constants.ts +0 -47
  329. package/src/services/config/defaults.ts +0 -57
  330. package/src/services/config/index.ts +0 -744
  331. package/src/services/config/types.ts +0 -211
  332. package/src/services/logger/index.ts +0 -96
  333. package/src/types.ts +0 -47
  334. package/src/utils/path.ts +0 -16
  335. package/src/utils/pythonInstaller.ts +0 -597
  336. package/tsconfig.json +0 -37
  337. package/updates.config.js +0 -3
  338. /package/dist/interface/assets/{@xterm.DYP7pi_n.0.0.50-internal.0.css → @xterm.DYP7pi_n.0.0.50-internal.1.css} +0 -0
  339. /package/dist/interface/assets/{Adminpanel.BKek2EMH.0.0.50-internal.0.css → Adminpanel.BKek2EMH.0.0.50-internal.1.css} +0 -0
  340. /package/dist/interface/assets/{Cameras.BDWZJqPN.0.0.50-internal.0.css → Cameras.BDWZJqPN.0.0.50-internal.1.css} +0 -0
  341. /package/dist/interface/assets/{Camview.BFUFMoNX.0.0.50-internal.0.css → Camview.BFUFMoNX.0.0.50-internal.1.css} +0 -0
  342. /package/dist/interface/assets/{CuiConsole.DCYyxdVg.0.0.50-internal.0.css → CuiConsole.DCYyxdVg.0.0.50-internal.1.css} +0 -0
  343. /package/dist/interface/assets/{CuiPluginCard.yF8V0SZY.0.0.50-internal.0.css → CuiPluginCard.yF8V0SZY.0.0.50-internal.1.css} +0 -0
  344. /package/dist/interface/assets/{CuiTimeline.BkIwlYtw.0.0.50-internal.0.css → CuiTimeline.BkIwlYtw.0.0.50-internal.1.css} +0 -0
  345. /package/dist/interface/assets/{Plugin.DJElsAn5.0.0.50-internal.0.css → Plugin.DJElsAn5.0.0.50-internal.1.css} +0 -0
  346. /package/dist/interface/assets/{Plugins.0h77qnmN.0.0.50-internal.0.css → Plugins.0h77qnmN.0.0.50-internal.1.css} +0 -0
  347. /package/dist/interface/assets/{Settings.CkgfRkQr.0.0.50-internal.0.css → Settings.CkgfRkQr.0.0.50-internal.1.css} +0 -0
  348. /package/dist/interface/assets/{SettingsAccount.DeFul3eQ.0.0.50-internal.0.css → SettingsAccount.DeFul3eQ.0.0.50-internal.1.css} +0 -0
  349. /package/dist/interface/assets/{SettingsBackup.CX0rT0QJ.0.0.50-internal.0.css → SettingsBackup.CX0rT0QJ.0.0.50-internal.1.css} +0 -0
  350. /package/dist/interface/assets/{highlight.Ch2EwETz.0.0.50-internal.0.css → highlight.Ch2EwETz.0.0.50-internal.1.css} +0 -0
  351. /package/dist/interface/assets/{logo-256.BCQk9H1-.0.0.50-internal.0.png → logo-256.BCQk9H1-.0.0.50-internal.1.png} +0 -0
  352. /package/dist/interface/assets/{logo-512.DLKVOU2S.0.0.50-internal.0.png → logo-512.DLKVOU2S.0.0.50-internal.1.png} +0 -0
  353. /package/dist/interface/assets/{logo.DmEiRk0z.0.0.50-internal.0.png → logo.DmEiRk0z.0.0.50-internal.1.png} +0 -0
  354. /package/dist/interface/assets/{main.Cip9LkS3.0.0.50-internal.0.css → main.Cip9LkS3.0.0.50-internal.1.css} +0 -0
  355. /package/dist/interface/assets/{mode-json.Br7xisR1.0.0.50-internal.0.js → mode-json.Br7xisR1.0.0.50-internal.1.js} +0 -0
  356. /package/dist/interface/assets/{mode-yaml.CIYL8U3d.0.0.50-internal.0.js → mode-yaml.CIYL8U3d.0.0.50-internal.1.js} +0 -0
  357. /package/dist/interface/assets/{worker-base.jEXLGV2h.0.0.50-internal.0.js → worker-base.jEXLGV2h.0.0.50-internal.1.js} +0 -0
  358. /package/dist/interface/assets/{worker-json.DgwNIOck.0.0.50-internal.0.js → worker-json.DgwNIOck.0.0.50-internal.1.js} +0 -0
  359. /package/dist/interface/assets/{worker-yaml.B3uUYINB.0.0.50-internal.0.js → worker-yaml.B3uUYINB.0.0.50-internal.1.js} +0 -0
  360. /package/dist/interface/js/{@babel.l0sNRNKZ.0.0.50-internal.0.js → @babel.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  361. /package/dist/interface/js/{@intlify.BkGPX90O.0.0.50-internal.0.js → @intlify.BkGPX90O.0.0.50-internal.1.js} +0 -0
  362. /package/dist/interface/js/{@kurkle.D8fDXNIl.0.0.50-internal.0.js → @kurkle.D8fDXNIl.0.0.50-internal.1.js} +0 -0
  363. /package/dist/interface/js/{@primeuix.BFAY2Bk9.0.0.50-internal.0.js → @primeuix.BFAY2Bk9.0.0.50-internal.1.js} +0 -0
  364. /package/dist/interface/js/{@react-dnd.CcwRs9xb.0.0.50-internal.0.js → @react-dnd.CcwRs9xb.0.0.50-internal.1.js} +0 -0
  365. /package/dist/interface/js/{@socket.io.Dkula2eQ.0.0.50-internal.0.js → @socket.io.Dkula2eQ.0.0.50-internal.1.js} +0 -0
  366. /package/dist/interface/js/{@vue.B5vqhCp2.0.0.50-internal.0.js → @vue.B5vqhCp2.0.0.50-internal.1.js} +0 -0
  367. /package/dist/interface/js/{@xterm.CAa7rpjv.0.0.50-internal.0.js → @xterm.DIUBesyz.0.0.50-internal.1.js} +0 -0
  368. /package/dist/interface/js/{axios.DHr9lByg.0.0.50-internal.0.js → axios.DHr9lByg.0.0.50-internal.1.js} +0 -0
  369. /package/dist/interface/js/{birpc.l0sNRNKZ.0.0.50-internal.0.js → birpc.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  370. /package/dist/interface/js/{compare-versions.DqEOhma6.0.0.50-internal.0.js → compare-versions.DqEOhma6.0.0.50-internal.1.js} +0 -0
  371. /package/dist/interface/js/{dijkstrajs.C00ieaqj.0.0.50-internal.0.js → dijkstrajs.C00ieaqj.0.0.50-internal.1.js} +0 -0
  372. /package/dist/interface/js/{engine.io-parser.BiEtp6m2.0.0.50-internal.0.js → engine.io-parser.BiEtp6m2.0.0.50-internal.1.js} +0 -0
  373. /package/dist/interface/js/{entities.C20TfXL6.0.0.50-internal.0.js → entities.C20TfXL6.0.0.50-internal.1.js} +0 -0
  374. /package/dist/interface/js/{ev-emitter.X5f1qa-c.0.0.50-internal.0.js → ev-emitter.X5f1qa-c.0.0.50-internal.1.js} +0 -0
  375. /package/dist/interface/js/{get-size.D1dS-IaP.0.0.50-internal.0.js → get-size.D1dS-IaP.0.0.50-internal.1.js} +0 -0
  376. /package/dist/interface/js/{hookable.l0sNRNKZ.0.0.50-internal.0.js → hookable.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  377. /package/dist/interface/js/{mdurl.k9Sl0PQj.0.0.50-internal.0.js → mdurl.k9Sl0PQj.0.0.50-internal.1.js} +0 -0
  378. /package/dist/interface/js/{perfect-debounce.l0sNRNKZ.0.0.50-internal.0.js → perfect-debounce.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  379. /package/dist/interface/js/{primelocale.Bga3dOQu.0.0.50-internal.0.js → primelocale.Bga3dOQu.0.0.50-internal.1.js} +0 -0
  380. /package/dist/interface/js/{punycode.js.Dj65hjkv.0.0.50-internal.0.js → punycode.js.Dj65hjkv.0.0.50-internal.1.js} +0 -0
  381. /package/dist/interface/js/{react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.0.js → react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.1.js} +0 -0
  382. /package/dist/interface/js/{redux.BFxtlG_c.0.0.50-internal.0.js → redux.BFxtlG_c.0.0.50-internal.1.js} +0 -0
  383. /package/dist/interface/js/{tslib.9k7AwCpt.0.0.50-internal.0.js → tslib.9k7AwCpt.0.0.50-internal.1.js} +0 -0
  384. /package/dist/interface/js/{uc.micro.kMc2yuuw.0.0.50-internal.0.js → uc.micro.kMc2yuuw.0.0.50-internal.1.js} +0 -0
  385. /package/dist/interface/js/{uuid.C6aID195.0.0.50-internal.0.js → uuid.C6aID195.0.0.50-internal.1.js} +0 -0
  386. /package/dist/interface/js/{vue.l0sNRNKZ.0.0.50-internal.0.js → vue.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  387. /package/dist/interface/js/{zod.SKKegNRO.0.0.50-internal.0.js → zod.SKKegNRO.0.0.50-internal.1.js} +0 -0
@@ -1,260 +0,0 @@
1
- import { Subscribed } from '@camera.ui/common';
2
- import { ReplaySubject, Subject, fromEvent } from 'rxjs';
3
- import { concatMap } from 'rxjs/operators';
4
- import { WebSocket } from 'ws';
5
-
6
- import { WeriftPeerConnection } from './peer-connection.js';
7
-
8
- import type { BasicPeerConnection, CameraInput, LoggerService, WebRTCConnectionOptions } from '@camera.ui/types';
9
- import type { Observable } from 'rxjs';
10
- import type { RtpPacket } from 'werift';
11
- import type { CameraDevice } from '../device.js';
12
-
13
- export interface Go2RtcOfferMessage {
14
- type: 'webrtc/offer';
15
- value: Sdp;
16
- }
17
-
18
- export interface Go2RtcAnswerMessage {
19
- type: 'webrtc/answer';
20
- value: Sdp;
21
- }
22
-
23
- export interface Go2RtcIceCandidateMessage {
24
- type: 'webrtc/candidate';
25
- value: IceCandiate;
26
- }
27
-
28
- export type Sdp = string;
29
-
30
- export type IceCandiate = string;
31
-
32
- export interface ErrorMessage {
33
- type: 'error';
34
- value: string;
35
- }
36
-
37
- export type Go2RtcIncomingMessage = Go2RtcAnswerMessage | Go2RtcIceCandidateMessage | ErrorMessage;
38
-
39
- export type Go2RtcOutgoingMessage = Go2RtcOfferMessage | Go2RtcIceCandidateMessage;
40
-
41
- export class WebrtcConnection extends Subscribed {
42
- public onCameraConnected!: ReplaySubject<void>;
43
- public onCallAnswered!: ReplaySubject<string>;
44
- public onCallEnded!: ReplaySubject<void>;
45
- public onError!: ReplaySubject<void>;
46
- public onMessage!: ReplaySubject<{ method: string }>;
47
- public onWsOpen!: Observable<unknown>;
48
- public onAudioRtp!: Subject<RtpPacket>;
49
- public onVideoRtp!: Subject<RtpPacket>;
50
-
51
- #onOfferSent!: ReplaySubject<void>;
52
-
53
- #pc!: BasicPeerConnection;
54
- #ws!: WebSocket;
55
-
56
- #hasEnded = false;
57
-
58
- #cameraDevice: CameraDevice;
59
- #source: CameraInput;
60
- #logger: LoggerService;
61
- #options: WebRTCConnectionOptions;
62
-
63
- get #logPrefix(): string {
64
- return `[${this.#cameraDevice.name}]`;
65
- }
66
-
67
- constructor(cameraDevice: CameraDevice, source: CameraInput, logger: LoggerService, options: WebRTCConnectionOptions = {}) {
68
- super();
69
-
70
- this.#cameraDevice = cameraDevice;
71
- this.#source = source;
72
- this.#logger = logger;
73
- this.#options = options;
74
-
75
- this.#initializeConnection(this.#source);
76
- }
77
-
78
- public async upgradeConnection(source: CameraInput): Promise<void> {
79
- // Close existing WebSocket and PeerConnection
80
- this.unsubscribe();
81
- this.#ws.close();
82
- this.#pc.close();
83
-
84
- // Reinitialize connection
85
- this.#initializeConnection(source);
86
- }
87
-
88
- public sendAudioPacket(rtp: RtpPacket): void {
89
- if (this.#hasEnded) {
90
- return;
91
- }
92
-
93
- if (this.#pc instanceof WeriftPeerConnection) {
94
- this.#pc.returnAudioTrack.writeRtp(rtp);
95
- } else {
96
- throw new Error('Cannot send audio packets to a custom peer connection implementation');
97
- }
98
- }
99
-
100
- public stop(): void {
101
- this.#callEnded();
102
- }
103
-
104
- public requestKeyFrame(): void {
105
- this.#pc.requestKeyFrame?.();
106
- }
107
-
108
- #initializeConnection(source: CameraInput) {
109
- const cameraSource = this.#cameraDevice.sources.find((s) => s.name === source.name);
110
- const webRtcSource = cameraSource?.urls.ws.webrtc;
111
-
112
- if (!webRtcSource) {
113
- throw new Error(`Invalid source: ${source.name}`);
114
- }
115
-
116
- this.onCameraConnected = new ReplaySubject<void>(1);
117
- this.onCallAnswered = new ReplaySubject<string>(1);
118
- this.onCallEnded = new ReplaySubject<void>(1);
119
- this.onError = new ReplaySubject<void>(1);
120
- this.onMessage = new ReplaySubject<{ method: string }>();
121
- this.#onOfferSent = new ReplaySubject<void>(1);
122
-
123
- this.#ws = new WebSocket(webRtcSource, {
124
- rejectUnauthorized: false,
125
- });
126
-
127
- if (this.#options.createPeerConnection) {
128
- this.#pc = this.#options.createPeerConnection();
129
- this.onAudioRtp = new Subject<RtpPacket>();
130
- this.onVideoRtp = new Subject<RtpPacket>();
131
- } else {
132
- this.#pc = new WeriftPeerConnection(this.#cameraDevice, this.#logger);
133
- this.onAudioRtp = (this.#pc as WeriftPeerConnection).onAudioRtp;
134
- this.onVideoRtp = (this.#pc as WeriftPeerConnection).onVideoRtp;
135
- }
136
-
137
- this.onWsOpen = fromEvent(this.#ws, 'open');
138
-
139
- this.#setupEventListeners();
140
- }
141
-
142
- #setupEventListeners() {
143
- const onMessage = fromEvent(this.#ws, 'message');
144
- const onError = fromEvent(this.#ws, 'error');
145
- const onClose = fromEvent(this.#ws, 'close');
146
-
147
- this.addSubscriptions(
148
- onMessage
149
- .pipe(
150
- concatMap((event) => {
151
- const message = JSON.parse((event as any).data);
152
- this.onMessage.next(message);
153
-
154
- return this.#handleMessage(message).catch((error: any) => {
155
- this.onError.next(error);
156
- throw error;
157
- });
158
- }),
159
- )
160
- .subscribe(),
161
-
162
- onError.subscribe((error: any) => {
163
- this.#logger.error(this.#logPrefix, error);
164
- this.#callEnded();
165
- }),
166
-
167
- onClose.subscribe(() => {
168
- this.#callEnded();
169
- }),
170
-
171
- this.#cameraDevice.onConnected.subscribe((state) => {
172
- if (!state) {
173
- this.#callEnded();
174
- }
175
- }),
176
-
177
- this.#pc.onConnectionState.subscribe((state) => {
178
- if (state === 'failed') {
179
- this.#logger.error(this.#logPrefix, 'Stream connection failed');
180
- this.#callEnded();
181
- }
182
-
183
- if (state === 'closed') {
184
- this.#logger.debug(this.#logPrefix, 'Stream connection closed');
185
- this.#callEnded();
186
- }
187
- }),
188
-
189
- this.onError.subscribe((error: any) => {
190
- this.#logger.error(this.#logPrefix, error);
191
- this.#callEnded();
192
- }),
193
-
194
- this.onWsOpen.subscribe(() => {
195
- this.#initiateCall().catch((error: any) => {
196
- this.#logger.error(this.#logPrefix, error);
197
- this.#callEnded();
198
- });
199
- }),
200
-
201
- this.#pc.onIceCandidate.subscribe((iceCandidate) => {
202
- this.#sendMessage({
203
- type: 'webrtc/candidate',
204
- value: iceCandidate.toJSON().candidate || '',
205
- });
206
- }),
207
- );
208
- }
209
-
210
- async #initiateCall(): Promise<void> {
211
- const { sdp } = await this.#pc.createOffer();
212
-
213
- this.#sendMessage({
214
- type: 'webrtc/offer',
215
- value: sdp,
216
- });
217
-
218
- this.#onOfferSent.next();
219
- }
220
-
221
- async #handleMessage(message: Go2RtcIncomingMessage): Promise<void> {
222
- switch (message.type) {
223
- case 'webrtc/answer':
224
- const sdp = message.value;
225
- await this.#pc.acceptAnswer({ type: 'answer', sdp });
226
- this.onCallAnswered.next(sdp);
227
- return;
228
- case 'webrtc/candidate':
229
- await this.#pc.addIceCandidate({
230
- candidate: message.value,
231
- sdpMid: '0',
232
- });
233
- return;
234
- case 'error':
235
- throw new Error(message.value);
236
- default:
237
- throw new Error(message);
238
- }
239
- }
240
-
241
- #sendMessage(message: Go2RtcOutgoingMessage): void {
242
- if (this.#hasEnded) {
243
- return;
244
- }
245
-
246
- this.#ws.send(JSON.stringify(message));
247
- }
248
-
249
- #callEnded(): void {
250
- if (this.#hasEnded) {
251
- return;
252
- }
253
-
254
- this.#hasEnded = true;
255
- this.unsubscribe();
256
- this.onCallEnded.next();
257
- this.#pc.close();
258
- this.#ws.close();
259
- }
260
- }
@@ -1,317 +0,0 @@
1
- import { FfmpegProcess, reservePorts, RtpSplitter, transformAudioStreamInfoToFFmpegArgs } from '@camera.ui/common/camera';
2
- import { getCleanSdp, isWebRtcCompatibleAudioCodec, isWebRtcCompatibleVideoCodec, SubscribedPublic } from '@camera.ui/common/utils';
3
- import { firstValueFrom, ReplaySubject, Subject } from 'rxjs';
4
- import { take, tap } from 'rxjs/operators';
5
- import { RtpPacket } from 'werift';
6
-
7
- import { WebrtcConnection } from './webrtc-connection.js';
8
-
9
- import type {
10
- CameraInput,
11
- CameraSource,
12
- FfmpegOptions,
13
- LoggerService,
14
- ProbeStream,
15
- ReturnAudioFFmpegOptions,
16
- WebRTCConnectionOptions,
17
- WeriftSession as WeriftSessionInterface,
18
- } from '@camera.ui/types';
19
- import type { CameraDevice } from '../device.js';
20
-
21
- export class WeriftSession extends SubscribedPublic implements WeriftSessionInterface {
22
- readonly onStarted = new ReplaySubject<void>();
23
- readonly onError = new ReplaySubject<Error>();
24
- readonly onCallEnded = new ReplaySubject<void>(1);
25
- readonly onVideoRtp = new Subject<RtpPacket>();
26
- readonly onAudioRtp = new Subject<RtpPacket>();
27
-
28
- readonly #audioSplitter = new RtpSplitter();
29
- readonly #videoSplitter = new RtpSplitter();
30
- readonly #returnAudioSplitter = new RtpSplitter();
31
-
32
- #hasEnded = false;
33
- #cameraDevice: CameraDevice;
34
- #logger: LoggerService;
35
- #source: CameraSource;
36
- #webrtcConnection: WebrtcConnection;
37
-
38
- constructor(cameraDevice: CameraDevice, source: CameraInput, options: WebRTCConnectionOptions = {}) {
39
- super();
40
-
41
- this.#cameraDevice = cameraDevice;
42
- this.#logger = cameraDevice.logger;
43
- this.#source = this.#cameraDevice.sources.find((s) => s.name === source.name)!;
44
- this.#webrtcConnection = new WebrtcConnection(this.#cameraDevice, source, this.#logger, options);
45
-
46
- this.#bindConnection();
47
- }
48
-
49
- public async startTranscoding(ffmpegOptions: FfmpegOptions, streamProbe?: ProbeStream): Promise<void> {
50
- if (this.#hasEnded) {
51
- return;
52
- }
53
-
54
- const transcodeAudioStream = ffmpegOptions.audio !== undefined && ffmpegOptions.audio.length > 0;
55
- const transcodeVideoStream = ffmpegOptions.video !== undefined && ffmpegOptions.video.length > 0;
56
- const loggerPrefix = (ffmpegOptions.logPrefix ?? (transcodeAudioStream && transcodeVideoStream)) ? 'Transcoding' : transcodeAudioStream ? 'Audio' : 'Video';
57
-
58
- try {
59
- if (!transcodeAudioStream && !transcodeVideoStream) {
60
- throw new Error('No transcoding options provided! Can not start transcoding!');
61
- }
62
-
63
- const sdp = await Promise.race([firstValueFrom(this.#webrtcConnection.onCallAnswered), firstValueFrom(this.onCallEnded)]);
64
-
65
- if (!sdp) {
66
- throw new Error('No SDP received! Can not start transcoding!');
67
- }
68
-
69
- const probeStream = streamProbe ?? (await this.#source.probeStream({ video: true, audio: ['pcma', 'opus'] }));
70
- if (!probeStream) {
71
- throw new Error('Could not probe stream! Can not start transcoding!');
72
- }
73
-
74
- const audioStream = probeStream.audio.filter((audio) => audio.direction === 'sendonly' && isWebRtcCompatibleAudioCodec(audio.codec))[0];
75
- const videoStream = probeStream.video.filter((video) => video.direction === 'sendonly' && isWebRtcCompatibleVideoCodec(video.codec))[0];
76
-
77
- if (!audioStream && !videoStream) {
78
- throw new Error('No sendonly audio or video streams found! Can not start transcoding!');
79
- }
80
-
81
- await this.#audioSplitter.prepare('udp4');
82
- await this.#videoSplitter.prepare('udp4');
83
-
84
- if (!this.#audioSplitter.port || !this.#videoSplitter.port) {
85
- throw new Error('No ports available for audio or video splitter! Can not start transcoding!');
86
- }
87
-
88
- const videoPort = await this.#reservePort(1);
89
- const audioPort = await this.#reservePort(1);
90
-
91
- const audioInputArgs = audioStream && transcodeAudioStream && audioStream ? ['-acodec', audioStream.ffmpegCodec] : [];
92
- const videoInputArgs = videoStream && transcodeVideoStream && videoStream ? ['-vcodec', videoStream.ffmpegCodec] : [];
93
-
94
- const audioOutputArgs = audioStream && transcodeAudioStream ? (ffmpegOptions.audio ?? ['-acodec', audioStream.ffmpegCodec]) : [];
95
- const videoOutputArgs = videoStream && transcodeVideoStream ? (ffmpegOptions.video ?? ['-vcodec', videoStream.ffmpegCodec]) : [];
96
-
97
- const inputArgs = ffmpegOptions.input ?? [];
98
- const outputArgs = ffmpegOptions.output ?? [];
99
-
100
- const inputSdp = getCleanSdp(probeStream.sdp, transcodeVideoStream, 'sendonly', true)
101
- .replace(/m=audio \d+/, `m=audio ${audioPort}`)
102
- .replace(/m=video \d+/, `m=video ${videoPort}`);
103
-
104
- this.#logger.trace('Start transcoding with SDP:\n', inputSdp);
105
-
106
- const ff = new FfmpegProcess({
107
- ffmpegArgs: [
108
- '-hide_banner',
109
- '-protocol_whitelist',
110
- 'pipe,udp,rtp,file,crypto',
111
- '-reorder_queue_size',
112
- '0',
113
- ...audioInputArgs,
114
- ...videoInputArgs,
115
- '-f',
116
- 'sdp',
117
- ...inputArgs,
118
- '-i',
119
- 'pipe:',
120
- ...audioOutputArgs,
121
- ...videoOutputArgs,
122
- ...outputArgs,
123
- ],
124
- ffmpegPath: ffmpegOptions.ffmpegPath,
125
- startedCallback: () => {
126
- this.onStarted.next();
127
- },
128
- exitCallback: (code, signal) => {
129
- if (code !== 0 && code !== 255) {
130
- this.#callError(new Error(`FFmpeg exited with code ${code} and signal ${signal}`));
131
- } else {
132
- this.#callEnded();
133
- }
134
- },
135
- logLabel: loggerPrefix,
136
- logger: {
137
- error: (...args) => this.#logger.error(...args),
138
- trace: (...args) => this.#logger.trace(...args),
139
- },
140
- });
141
-
142
- if (transcodeAudioStream) {
143
- this.addSubscriptions(
144
- this.onAudioRtp
145
- .pipe(
146
- tap((rtp) => {
147
- return this.#audioSplitter.send(rtp.serialize(), {
148
- port: audioPort,
149
- address: '127.0.0.1',
150
- });
151
- }),
152
- )
153
- .subscribe(),
154
- );
155
- }
156
-
157
- if (transcodeVideoStream) {
158
- this.addSubscriptions(
159
- this.onVideoRtp
160
- .pipe(
161
- tap((rtp) => {
162
- return this.#videoSplitter.send(rtp.serialize(), {
163
- port: videoPort,
164
- address: '127.0.0.1',
165
- });
166
- }),
167
- )
168
- .subscribe(),
169
- );
170
- }
171
-
172
- this.onCallEnded.pipe(take(1)).subscribe(() => ff.stop());
173
-
174
- ff.writeStdin(inputSdp);
175
-
176
- this.requestKeyFrame();
177
- } catch (error: any) {
178
- this.stop();
179
- throw error;
180
- }
181
- }
182
-
183
- public async transcodeReturnAudio(ffmpegOptions: ReturnAudioFFmpegOptions, streamProbe?: ProbeStream): Promise<void> {
184
- if (this.#hasEnded) {
185
- return;
186
- }
187
-
188
- const loggerPrefix = ffmpegOptions.logPrefix ?? 'Return Audio';
189
-
190
- try {
191
- const probeStream = streamProbe ?? (await this.#source.probeStream({ microphone: true }));
192
- if (!probeStream) {
193
- this.stop();
194
- throw new Error('Could not probe stream! Can not start transcoding!');
195
- }
196
-
197
- const audioStreams = probeStream.audio.filter((audio) => audio.direction === 'recvonly');
198
- const returnAudioStream = audioStreams[0];
199
-
200
- if (!returnAudioStream) {
201
- this.stop();
202
- throw new Error('No recvonly audio stream found! Can not start transcoding!');
203
- }
204
-
205
- const audioOutForwarder = new RtpSplitter();
206
- await audioOutForwarder.prepare('udp4');
207
-
208
- if (!audioOutForwarder.port) {
209
- this.stop();
210
- throw new Error('No ports available for audio out splitter! Can not start transcoding!');
211
- }
212
-
213
- audioOutForwarder.addMessageHandler(({ message }) => {
214
- const rtp = RtpPacket.deSerialize(message);
215
- this.#webrtcConnection.sendAudioPacket(rtp);
216
- return null;
217
- });
218
-
219
- const inputArgs = ffmpegOptions.input ?? [];
220
- const returnAudioCodecs = transformAudioStreamInfoToFFmpegArgs(returnAudioStream);
221
-
222
- const ff = new FfmpegProcess({
223
- ffmpegArgs: [
224
- '-hide_banner',
225
- '-protocol_whitelist',
226
- 'pipe,udp,rtp,file,crypto',
227
- '-re',
228
- '-i',
229
- ...inputArgs,
230
- ...returnAudioCodecs,
231
- '-flags',
232
- '+global_header',
233
- '-f',
234
- 'rtp',
235
- `rtp://127.0.0.1:${audioOutForwarder.port}`,
236
- ],
237
- ffmpegPath: ffmpegOptions.ffmpegPath,
238
- startedCallback: () => {
239
- this.onStarted.next();
240
- },
241
- exitCallback: (code, signal) => {
242
- if (code !== 0 && code !== 255) {
243
- this.#callError(new Error(`FFmpeg exited with code ${code} and signal ${signal}`));
244
- } else {
245
- this.#callEnded();
246
- }
247
- },
248
- logLabel: loggerPrefix,
249
- logger: {
250
- error: (...args) => this.#logger.error(...args),
251
- trace: (...args) => this.#logger.trace(...args),
252
- },
253
- });
254
-
255
- this.onCallEnded.pipe(take(1)).subscribe(() => ff.stop());
256
- } catch (error: any) {
257
- this.stop();
258
- throw error;
259
- }
260
- }
261
-
262
- public stop(): void {
263
- this.#callEnded();
264
- }
265
-
266
- public sendAudioPacket(rtp: RtpPacket | Buffer): void {
267
- if (this.#hasEnded) {
268
- return;
269
- }
270
-
271
- this.#webrtcConnection.sendAudioPacket(Buffer.isBuffer(rtp) ? RtpPacket.deSerialize(rtp) : rtp);
272
- }
273
-
274
- public requestKeyFrame(): void {
275
- this.#webrtcConnection.requestKeyFrame();
276
- }
277
-
278
- async #reservePort(bufferPorts = 0): Promise<number> {
279
- const ports = await reservePorts({ count: bufferPorts + 1 });
280
- return ports[0];
281
- }
282
-
283
- #handleVideo(rtp: RtpPacket): void {
284
- this.onVideoRtp.next(rtp);
285
- }
286
-
287
- #handleAudio(rtp: RtpPacket): void {
288
- this.onAudioRtp.next(rtp);
289
- }
290
-
291
- #bindConnection(): void {
292
- this.addSubscriptions(
293
- this.#webrtcConnection.onVideoRtp.subscribe(this.#handleVideo.bind(this)),
294
- this.#webrtcConnection.onAudioRtp.subscribe(this.#handleAudio.bind(this)),
295
- this.#webrtcConnection.onCallEnded.subscribe(() => this.#callEnded()),
296
- );
297
- }
298
-
299
- #callError(error: Error): void {
300
- this.onError.next(error);
301
- }
302
-
303
- #callEnded(): void {
304
- if (this.#hasEnded) {
305
- return;
306
- }
307
-
308
- this.#hasEnded = true;
309
-
310
- this.unsubscribe();
311
- this.onCallEnded.next();
312
- this.#webrtcConnection.stop();
313
- this.#audioSplitter.close();
314
- this.#videoSplitter.close();
315
- this.#returnAudioSplitter.close();
316
- }
317
- }