@vtx/player 1.7.19 → 1.7.21

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 (115) hide show
  1. package/lib/api/fetch.js +5 -33
  2. package/lib/api/fetch.js.map +1 -1
  3. package/lib/api/index.js +5 -49
  4. package/lib/api/index.js.map +1 -1
  5. package/lib/api/types.js.map +1 -1
  6. package/lib/bd/PlayerManager.js +34 -67
  7. package/lib/bd/PlayerManager.js.map +1 -1
  8. package/lib/bill-player/index.js +64 -119
  9. package/lib/bill-player/index.js.map +1 -1
  10. package/lib/bill-player/style/css.js +0 -9
  11. package/lib/bill-player/style/css.js.map +1 -1
  12. package/lib/bill-player/style/index.js +0 -9
  13. package/lib/bill-player/style/index.js.map +1 -1
  14. package/lib/components/set-tag-video/index.js +4 -32
  15. package/lib/components/set-tag-video/index.js.map +1 -1
  16. package/lib/components/set-tag-video/style/css.js.map +1 -1
  17. package/lib/components/set-tag-video/style/index.js.map +1 -1
  18. package/lib/components/split-screen/index.js +3 -14
  19. package/lib/components/split-screen/index.js.map +1 -1
  20. package/lib/components/split-screen/style/css.js.map +1 -1
  21. package/lib/components/split-screen/style/index.js.map +1 -1
  22. package/lib/components/tag-video/index.js +10 -38
  23. package/lib/components/tag-video/index.js.map +1 -1
  24. package/lib/components/tag-video/style/css.js.map +1 -1
  25. package/lib/components/tag-video/style/index.js.map +1 -1
  26. package/lib/components/video-scale/index.js +2 -9
  27. package/lib/components/video-scale/index.js.map +1 -1
  28. package/lib/components/video-scale/style/css.js.map +1 -1
  29. package/lib/components/video-scale/style/index.js.map +1 -1
  30. package/lib/context/index.js +0 -4
  31. package/lib/context/index.js.map +1 -1
  32. package/lib/controls/index.js +34 -99
  33. package/lib/controls/index.js.map +1 -1
  34. package/lib/controls/style/css.js +0 -5
  35. package/lib/controls/style/css.js.map +1 -1
  36. package/lib/controls/style/index.js +0 -5
  37. package/lib/controls/style/index.js.map +1 -1
  38. package/lib/h264/PlayerManager.js +14 -26
  39. package/lib/h264/PlayerManager.js.map +1 -1
  40. package/lib/history-control/index.js +63 -122
  41. package/lib/history-control/index.js.map +1 -1
  42. package/lib/history-control/style/css.js +0 -6
  43. package/lib/history-control/style/css.js.map +1 -1
  44. package/lib/history-control/style/index.js +0 -6
  45. package/lib/history-control/style/index.js.map +1 -1
  46. package/lib/history-control-v2/components/grid-item/index.js +36 -75
  47. package/lib/history-control-v2/components/grid-item/index.js.map +1 -1
  48. package/lib/history-control-v2/components/panel/index.js +47 -117
  49. package/lib/history-control-v2/components/panel/index.js.map +1 -1
  50. package/lib/history-control-v2/context.js +0 -2
  51. package/lib/history-control-v2/context.js.map +1 -1
  52. package/lib/history-control-v2/index.js +46 -113
  53. package/lib/history-control-v2/index.js.map +1 -1
  54. package/lib/history-control-v2/style/css.js +0 -10
  55. package/lib/history-control-v2/style/css.js.map +1 -1
  56. package/lib/history-control-v2/style/index.js +0 -10
  57. package/lib/history-control-v2/style/index.js.map +1 -1
  58. package/lib/history-control-v2/utils.js +0 -20
  59. package/lib/history-control-v2/utils.js.map +1 -1
  60. package/lib/history-player/index.js +51 -109
  61. package/lib/history-player/index.js.map +1 -1
  62. package/lib/history-player/style/css.js +0 -3
  63. package/lib/history-player/style/css.js.map +1 -1
  64. package/lib/history-player/style/index.js +0 -3
  65. package/lib/history-player/style/index.js.map +1 -1
  66. package/lib/hooks/useSettings.js +1 -6
  67. package/lib/hooks/useSettings.js.map +1 -1
  68. package/lib/icc/PlayerManager.js +21 -58
  69. package/lib/icc/PlayerManager.js.map +1 -1
  70. package/lib/icc/api.js +2 -16
  71. package/lib/icc/api.js.map +1 -1
  72. package/lib/icons/index.js +23 -171
  73. package/lib/icons/index.js.map +1 -1
  74. package/lib/index.js +0 -10
  75. package/lib/index.js.map +1 -1
  76. package/lib/live-channel-player/index.js +16 -51
  77. package/lib/live-channel-player/index.js.map +1 -1
  78. package/lib/live-channel-player/style/css.js +0 -1
  79. package/lib/live-channel-player/style/css.js.map +1 -1
  80. package/lib/live-channel-player/style/index.js +0 -1
  81. package/lib/live-channel-player/style/index.js.map +1 -1
  82. package/lib/live-control/index.js +33 -84
  83. package/lib/live-control/index.js.map +1 -1
  84. package/lib/live-control/style/css.js +0 -4
  85. package/lib/live-control/style/css.js.map +1 -1
  86. package/lib/live-control/style/index.js +0 -4
  87. package/lib/live-control/style/index.js.map +1 -1
  88. package/lib/live-control-v2/index.js +68 -154
  89. package/lib/live-control-v2/index.js.map +1 -1
  90. package/lib/live-control-v2/style/css.js +0 -7
  91. package/lib/live-control-v2/style/css.js.map +1 -1
  92. package/lib/live-control-v2/style/index.js +0 -7
  93. package/lib/live-control-v2/style/index.js.map +1 -1
  94. package/lib/live-player/index.js +45 -85
  95. package/lib/live-player/index.js.map +1 -1
  96. package/lib/live-player/style/css.js +0 -2
  97. package/lib/live-player/style/css.js.map +1 -1
  98. package/lib/live-player/style/index.js +0 -2
  99. package/lib/live-player/style/index.js.map +1 -1
  100. package/lib/player/index.js +38 -206
  101. package/lib/player/index.js.map +1 -1
  102. package/lib/player/style/css.js.map +1 -1
  103. package/lib/player/style/index.js.map +1 -1
  104. package/lib/rsl/PlayerManager.js +14 -63
  105. package/lib/rsl/PlayerManager.js.map +1 -1
  106. package/lib/utils/index.d.ts +0 -7
  107. package/lib/utils/index.js +12 -112
  108. package/lib/utils/index.js.map +1 -1
  109. package/lib/vtxHls/PlayerManager.js +2 -19
  110. package/lib/vtxHls/PlayerManager.js.map +1 -1
  111. package/lib/vtxHls/WhepManager.js +4 -70
  112. package/lib/vtxHls/WhepManager.js.map +1 -1
  113. package/lib/webrtc/PlayerManager.js +24 -40
  114. package/lib/webrtc/PlayerManager.js.map +1 -1
  115. package/package.json +3 -2
@@ -1 +1 @@
1
- {"version":3,"file":"PlayerManager.js","names":["VtxHlsPlayerManager","opt","url","video","player","timer","initPlayer","hls","Hls","maxLiveSyncPlaybackRate","on","Events","ERROR","evt","data","type","ErrorTypes","MEDIA_ERROR","recoverMediaError","fatal","clearTimeout","destroy","setTimeout","MEDIA_ATTACHED","loadSource","MANIFEST_PARSED","play","attachMedia","speed","recordPlayer","playSpeed","setSize","fullScreen","playerAdapter","setPlayerAdapter","number","setPlayerNum","index","setSelectIndex"],"sources":["vtxHls/PlayerManager.js"],"sourcesContent":["class VtxHlsPlayerManager {\n constructor(opt) {\n this.url = opt.url;\n this.video = opt.video;\n this.player = null;\n this.timer = null;\n this.initPlayer();\n }\n //初始化视频插件\n initPlayer() {\n const video = this.video;\n const hls = new Hls({\n maxLiveSyncPlaybackRate: 1.5,\n });\n this.player = hls;\n this.player.on(Hls.Events.ERROR, (evt, data) => {\n if (data.type === Hls.ErrorTypes.MEDIA_ERROR) {\n this.player.recoverMediaError();\n }\n else if (data.fatal) {\n this.timer && clearTimeout(this.timer);\n this.player.destroy();\n this.timer = setTimeout(() => this.initPlayer(video), 300);\n }\n });\n this.player.on(Hls.Events.MEDIA_ATTACHED, () => {\n this.player.loadSource(`${this.url}index.m3u8`);\n });\n this.player.on(Hls.Events.MANIFEST_PARSED, () => {\n video.play();\n });\n this.player.attachMedia(video);\n }\n /**\n * 倍速播放\n * @param {number} speed 速率 0.125 0.25 0.5 1 2 4 8 共7种速率\n */\n playSpeed(speed) {\n this.recordPlayer && this.recordPlayer.playSpeed(speed);\n }\n /**\n * 关闭播放器\n * @param {number} index 可选,关闭指定索引的窗口的播放器,不传则表示关闭所有播放器\n */\n close() {\n if (this.player) {\n this.player.destroy();\n this.player = null;\n this.timer = null;\n }\n }\n resize() {\n this.player && this.player.setSize();\n }\n /**\n * 设置全屏\n */\n setFullScreen() {\n this.player.fullScreen();\n }\n /**\n * 设置窗口自适应还是拉伸\n * @param {string} playerAdapter selfAdaption 自适应 | stretching 拉伸\n */\n setPlayerAdapter(playerAdapter) {\n this.player.setPlayerAdapter(playerAdapter);\n }\n /**\n * 控制视频播放器显示的路数: 1 4 9 16 25,不会超过最大显示路数\n * @param {number} number\n */\n setPlayerNum(number) {\n this.player.setPlayerNum(number);\n }\n /**\n * 设置选中的播放器的索引\n * @param {number} index\n */\n setSelectIndex(index) {\n this.player.setSelectIndex(index);\n }\n}\nexport default VtxHlsPlayerManager;\n"],"mappings":";;;;;;;;;;;;;IAAMA,mB;EACF,6BAAYC,GAAZ,EAAiB;IAAA;;IACb,KAAKC,GAAL,GAAWD,GAAG,CAACC,GAAf;IACA,KAAKC,KAAL,GAAaF,GAAG,CAACE,KAAjB;IACA,KAAKC,MAAL,GAAc,IAAd;IACA,KAAKC,KAAL,GAAa,IAAb;IACA,KAAKC,UAAL;EACH,C,CACD;;;;;WACA,sBAAa;MAAA;;MACT,IAAMH,KAAK,GAAG,KAAKA,KAAnB;MACA,IAAMI,GAAG,GAAG,IAAIC,GAAJ,CAAQ;QAChBC,uBAAuB,EAAE;MADT,CAAR,CAAZ;MAGA,KAAKL,MAAL,GAAcG,GAAd;MACA,KAAKH,MAAL,CAAYM,EAAZ,CAAeF,GAAG,CAACG,MAAJ,CAAWC,KAA1B,EAAiC,UAACC,GAAD,EAAMC,IAAN,EAAe;QAC5C,IAAIA,IAAI,CAACC,IAAL,KAAcP,GAAG,CAACQ,UAAJ,CAAeC,WAAjC,EAA8C;UAC1C,KAAI,CAACb,MAAL,CAAYc,iBAAZ;QACH,CAFD,MAGK,IAAIJ,IAAI,CAACK,KAAT,EAAgB;UACjB,KAAI,CAACd,KAAL,IAAce,YAAY,CAAC,KAAI,CAACf,KAAN,CAA1B;;UACA,KAAI,CAACD,MAAL,CAAYiB,OAAZ;;UACA,KAAI,CAAChB,KAAL,GAAaiB,UAAU,CAAC;YAAA,OAAM,KAAI,CAAChB,UAAL,CAAgBH,KAAhB,CAAN;UAAA,CAAD,EAA+B,GAA/B,CAAvB;QACH;MACJ,CATD;MAUA,KAAKC,MAAL,CAAYM,EAAZ,CAAeF,GAAG,CAACG,MAAJ,CAAWY,cAA1B,EAA0C,YAAM;QAC5C,KAAI,CAACnB,MAAL,CAAYoB,UAAZ,WAA0B,KAAI,CAACtB,GAA/B;MACH,CAFD;MAGA,KAAKE,MAAL,CAAYM,EAAZ,CAAeF,GAAG,CAACG,MAAJ,CAAWc,eAA1B,EAA2C,YAAM;QAC7CtB,KAAK,CAACuB,IAAN;MACH,CAFD;MAGA,KAAKtB,MAAL,CAAYuB,WAAZ,CAAwBxB,KAAxB;IACH;IACD;AACJ;AACA;AACA;;;;WACI,mBAAUyB,KAAV,EAAiB;MACb,KAAKC,YAAL,IAAqB,KAAKA,YAAL,CAAkBC,SAAlB,CAA4BF,KAA5B,CAArB;IACH;IACD;AACJ;AACA;AACA;;;;WACI,iBAAQ;MACJ,IAAI,KAAKxB,MAAT,EAAiB;QACb,KAAKA,MAAL,CAAYiB,OAAZ;QACA,KAAKjB,MAAL,GAAc,IAAd;QACA,KAAKC,KAAL,GAAa,IAAb;MACH;IACJ;;;WACD,kBAAS;MACL,KAAKD,MAAL,IAAe,KAAKA,MAAL,CAAY2B,OAAZ,EAAf;IACH;IACD;AACJ;AACA;;;;WACI,yBAAgB;MACZ,KAAK3B,MAAL,CAAY4B,UAAZ;IACH;IACD;AACJ;AACA;AACA;;;;WACI,0BAAiBC,aAAjB,EAAgC;MAC5B,KAAK7B,MAAL,CAAY8B,gBAAZ,CAA6BD,aAA7B;IACH;IACD;AACJ;AACA;AACA;;;;WACI,sBAAaE,MAAb,EAAqB;MACjB,KAAK/B,MAAL,CAAYgC,YAAZ,CAAyBD,MAAzB;IACH;IACD;AACJ;AACA;AACA;;;;WACI,wBAAeE,KAAf,EAAsB;MAClB,KAAKjC,MAAL,CAAYkC,cAAZ,CAA2BD,KAA3B;IACH;;;;;;eAEUrC,mB"}
1
+ {"version":3,"file":"PlayerManager.js","names":["VtxHlsPlayerManager","opt","_classCallCheck","url","video","player","timer","initPlayer","_createClass","key","value","_this","hls","Hls","maxLiveSyncPlaybackRate","on","Events","ERROR","evt","data","type","ErrorTypes","MEDIA_ERROR","recoverMediaError","fatal","clearTimeout","destroy","setTimeout","MEDIA_ATTACHED","loadSource","concat","MANIFEST_PARSED","play","attachMedia","playSpeed","speed","recordPlayer","close","resize","setSize","setFullScreen","fullScreen","setPlayerAdapter","playerAdapter","setPlayerNum","number","setSelectIndex","index","_default","exports"],"sources":["vtxHls/PlayerManager.js"],"sourcesContent":["class VtxHlsPlayerManager {\n constructor(opt) {\n this.url = opt.url;\n this.video = opt.video;\n this.player = null;\n this.timer = null;\n this.initPlayer();\n }\n //初始化视频插件\n initPlayer() {\n const video = this.video;\n const hls = new Hls({\n maxLiveSyncPlaybackRate: 1.5,\n });\n this.player = hls;\n this.player.on(Hls.Events.ERROR, (evt, data) => {\n if (data.type === Hls.ErrorTypes.MEDIA_ERROR) {\n this.player.recoverMediaError();\n }\n else if (data.fatal) {\n this.timer && clearTimeout(this.timer);\n this.player.destroy();\n this.timer = setTimeout(() => this.initPlayer(video), 300);\n }\n });\n this.player.on(Hls.Events.MEDIA_ATTACHED, () => {\n this.player.loadSource(`${this.url}index.m3u8`);\n });\n this.player.on(Hls.Events.MANIFEST_PARSED, () => {\n video.play();\n });\n this.player.attachMedia(video);\n }\n /**\n * 倍速播放\n * @param {number} speed 速率 0.125 0.25 0.5 1 2 4 8 共7种速率\n */\n playSpeed(speed) {\n this.recordPlayer && this.recordPlayer.playSpeed(speed);\n }\n /**\n * 关闭播放器\n * @param {number} index 可选,关闭指定索引的窗口的播放器,不传则表示关闭所有播放器\n */\n close() {\n if (this.player) {\n this.player.destroy();\n this.player = null;\n this.timer = null;\n }\n }\n resize() {\n this.player && this.player.setSize();\n }\n /**\n * 设置全屏\n */\n setFullScreen() {\n this.player.fullScreen();\n }\n /**\n * 设置窗口自适应还是拉伸\n * @param {string} playerAdapter selfAdaption 自适应 | stretching 拉伸\n */\n setPlayerAdapter(playerAdapter) {\n this.player.setPlayerAdapter(playerAdapter);\n }\n /**\n * 控制视频播放器显示的路数: 1 4 9 16 25,不会超过最大显示路数\n * @param {number} number\n */\n setPlayerNum(number) {\n this.player.setPlayerNum(number);\n }\n /**\n * 设置选中的播放器的索引\n * @param {number} index\n */\n setSelectIndex(index) {\n this.player.setSelectIndex(index);\n }\n}\nexport default VtxHlsPlayerManager;\n"],"mappings":";;;;;;;;;IAAMA,mBAAmB;EACrB,SAAAA,oBAAYC,GAAG,EAAE;IAAAC,eAAA,OAAAF,mBAAA;IACb,IAAI,CAACG,GAAG,GAAGF,GAAG,CAACE,GAAG;IAClB,IAAI,CAACC,KAAK,GAAGH,GAAG,CAACG,KAAK;IACtB,IAAI,CAACC,MAAM,GAAG,IAAI;IAClB,IAAI,CAACC,KAAK,GAAG,IAAI;IACjB,IAAI,CAACC,UAAU,CAAC,CAAC;EACrB;EACA;EAAAC,YAAA,CAAAR,mBAAA;IAAAS,GAAA;IAAAC,KAAA,EACA,SAAAH,WAAA,EAAa;MAAA,IAAAI,KAAA;MACT,IAAMP,KAAK,GAAG,IAAI,CAACA,KAAK;MACxB,IAAMQ,GAAG,GAAG,IAAIC,GAAG,CAAC;QAChBC,uBAAuB,EAAE;MAC7B,CAAC,CAAC;MACF,IAAI,CAACT,MAAM,GAAGO,GAAG;MACjB,IAAI,CAACP,MAAM,CAACU,EAAE,CAACF,GAAG,CAACG,MAAM,CAACC,KAAK,EAAE,UAACC,GAAG,EAAEC,IAAI,EAAK;QAC5C,IAAIA,IAAI,CAACC,IAAI,KAAKP,GAAG,CAACQ,UAAU,CAACC,WAAW,EAAE;UAC1CX,KAAI,CAACN,MAAM,CAACkB,iBAAiB,CAAC,CAAC;QACnC,CAAC,MACI,IAAIJ,IAAI,CAACK,KAAK,EAAE;UACjBb,KAAI,CAACL,KAAK,IAAImB,YAAY,CAACd,KAAI,CAACL,KAAK,CAAC;UACtCK,KAAI,CAACN,MAAM,CAACqB,OAAO,CAAC,CAAC;UACrBf,KAAI,CAACL,KAAK,GAAGqB,UAAU,CAAC;YAAA,OAAMhB,KAAI,CAACJ,UAAU,CAACH,KAAK,CAAC;UAAA,GAAE,GAAG,CAAC;QAC9D;MACJ,CAAC,CAAC;MACF,IAAI,CAACC,MAA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C;IACA;AACJ;AACA;AACA;EAHI;IAAAlC,GAAA;IAAAC,KAAA,EAIA,SAAAkC,aAAaC,MAAM,EAAE;MACjB,IAAI,CAACxC,MAAM,CAACuC,YAAY,CAACC,MAAM,CAAC;IACpC;IACA;AACJ;AACA;AACA;EAHI;IAAApC,GAAA;IAAAC,KAAA,EAIA,SAAAoC,eAAeC,KAAK,EAAE;MAClB,IAAI,CAAC1C,MAAM,CAACyC,cAAc,CAACC,KAAK,CAAC;IACrC;EAAC;EAAA,OAAA/C,mBAAA;AAAA;AAAA,IAAAgD,QAAA,GAEUhD,mBAAmB;AAAAiD,OAAA,cAAAD,QAAA","ignoreList":[]}
@@ -4,96 +4,72 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
-
10
8
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
-
12
9
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
-
14
10
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
15
-
16
11
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
17
-
18
12
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
19
-
20
13
  var restartPause = 2000;
21
-
22
14
  var linkToIceServers = function linkToIceServers(links) {
23
15
  return links !== null ? links.split(', ').map(function (link) {
24
16
  var m = link.match(/^<(.+?)>; rel="ice-server"(; username="(.*?)"; credential="(.*?)"; credential-type="password")?/i);
25
17
  var ret = {
26
18
  urls: [m[1]]
27
19
  };
28
-
29
20
  if (m[3] !== undefined) {
30
21
  ret.username = unquoteCredential(m[3]);
31
22
  ret.credential = unquoteCredential(m[4]);
32
23
  ret.credentialType = 'password';
33
24
  }
34
-
35
25
  return ret;
36
26
  }) : [];
37
27
  };
38
-
39
28
  var editOffer = function editOffer(offer) {
40
29
  var sections = offer.sdp.split('m=');
41
-
42
30
  for (var i = 0; i < sections.length; i++) {
43
31
  var section = sections[i];
44
-
45
32
  if (section.startsWith('audio')) {
46
33
  sections[i] = enableStereoOpus(section);
47
34
  }
48
35
  }
49
-
50
36
  offer.sdp = sections.join('m=');
51
37
  };
52
-
53
38
  var enableStereoOpus = function enableStereoOpus(section) {
54
39
  var opusPayloadFormat = '';
55
40
  var lines = section.split('\r\n');
56
-
57
41
  for (var i = 0; i < lines.length; i++) {
58
42
  if (lines[i].startsWith('a=rtpmap:') && lines[i].toLowerCase().includes('opus/')) {
59
43
  opusPayloadFormat = lines[i].slice('a=rtpmap:'.length).split(' ')[0];
60
44
  break;
61
45
  }
62
46
  }
63
-
64
47
  if (opusPayloadFormat === '') {
65
48
  return section;
66
49
  }
67
-
68
50
  for (var _i = 0; _i < lines.length; _i++) {
69
51
  if (lines[_i].startsWith('a=fmtp:' + opusPayloadFormat + ' ')) {
70
52
  if (!lines[_i].includes('stereo')) {
71
53
  lines[_i] += ';stereo=1';
72
54
  }
73
-
74
55
  if (!lines[_i].includes('sprop-stereo')) {
75
56
  lines[_i] += ';sprop-stereo=1';
76
57
  }
77
58
  }
78
59
  }
79
-
80
60
  return lines.join('\r\n');
81
61
  };
82
-
83
62
  var parseOffer = function parseOffer(offer) {
84
63
  var ret = {
85
64
  iceUfrag: '',
86
65
  icePwd: '',
87
66
  medias: []
88
67
  };
89
-
90
68
  var _iterator = _createForOfIteratorHelper(offer.split('\r\n')),
91
- _step;
92
-
69
+ _step;
93
70
  try {
94
71
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
95
72
  var line = _step.value;
96
-
97
73
  if (line.startsWith('m=')) {
98
74
  ret.medias.push(line.slice('m='.length));
99
75
  } else if (ret.iceUfrag === '' && line.startsWith('a=ice-ufrag:')) {
@@ -107,25 +83,19 @@ var parseOffer = function parseOffer(offer) {
107
83
  } finally {
108
84
  _iterator.f();
109
85
  }
110
-
111
86
  return ret;
112
87
  };
113
-
114
88
  var generateSdpFragment = function generateSdpFragment(offerData, candidates) {
115
89
  var candidatesByMedia = {};
116
-
117
90
  var _iterator2 = _createForOfIteratorHelper(candidates),
118
- _step2;
119
-
91
+ _step2;
120
92
  try {
121
93
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
122
94
  var candidate = _step2.value;
123
95
  var _mid = candidate.sdpMLineIndex;
124
-
125
96
  if (candidatesByMedia[_mid] === undefined) {
126
97
  candidatesByMedia[_mid] = [];
127
98
  }
128
-
129
99
  candidatesByMedia[_mid].push(candidate);
130
100
  }
131
101
  } catch (err) {
@@ -133,23 +103,17 @@ var generateSdpFragment = function generateSdpFragment(offerData, candidates) {
133
103
  } finally {
134
104
  _iterator2.f();
135
105
  }
136
-
137
106
  var frag = 'a=ice-ufrag:' + offerData.iceUfrag + '\r\n' + 'a=ice-pwd:' + offerData.icePwd + '\r\n';
138
107
  var mid = 0;
139
-
140
108
  var _iterator3 = _createForOfIteratorHelper(offerData.medias),
141
- _step3;
142
-
109
+ _step3;
143
110
  try {
144
111
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
145
112
  var media = _step3.value;
146
-
147
113
  if (candidatesByMedia[mid] !== undefined) {
148
114
  frag += 'm=' + media + '\r\n' + 'a=mid:' + mid + '\r\n';
149
-
150
115
  var _iterator4 = _createForOfIteratorHelper(candidatesByMedia[mid]),
151
- _step4;
152
-
116
+ _step4;
153
117
  try {
154
118
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
155
119
  var _candidate = _step4.value;
@@ -161,7 +125,6 @@ var generateSdpFragment = function generateSdpFragment(offerData, candidates) {
161
125
  _iterator4.f();
162
126
  }
163
127
  }
164
-
165
128
  mid++;
166
129
  }
167
130
  } catch (err) {
@@ -169,14 +132,11 @@ var generateSdpFragment = function generateSdpFragment(offerData, candidates) {
169
132
  } finally {
170
133
  _iterator3.f();
171
134
  }
172
-
173
135
  return frag;
174
136
  };
175
-
176
137
  var WHEPClient = /*#__PURE__*/function () {
177
138
  function WHEPClient(opt) {
178
139
  _classCallCheck(this, WHEPClient);
179
-
180
140
  this.url = opt.url;
181
141
  this.video = opt.video;
182
142
  this.pc = null;
@@ -185,12 +145,10 @@ var WHEPClient = /*#__PURE__*/function () {
185
145
  this.queuedCandidates = [];
186
146
  this.start();
187
147
  }
188
-
189
148
  _createClass(WHEPClient, [{
190
149
  key: "start",
191
150
  value: function start() {
192
151
  var _this = this;
193
-
194
152
  console.log('requesting ICE servers');
195
153
  fetch(new URL('whep', this.url), {
196
154
  method: 'OPTIONS'
@@ -198,7 +156,6 @@ var WHEPClient = /*#__PURE__*/function () {
198
156
  return _this.onIceServers(res);
199
157
  })["catch"](function (err) {
200
158
  console.log('error: ' + err);
201
-
202
159
  _this.scheduleRestart();
203
160
  });
204
161
  }
@@ -206,7 +163,6 @@ var WHEPClient = /*#__PURE__*/function () {
206
163
  key: "onIceServers",
207
164
  value: function onIceServers(res) {
208
165
  var _this2 = this;
209
-
210
166
  this.pc = new RTCPeerConnection({
211
167
  iceServers: linkToIceServers(res.headers.get('Link'))
212
168
  });
@@ -217,20 +173,16 @@ var WHEPClient = /*#__PURE__*/function () {
217
173
  this.pc.addTransceiver('audio', {
218
174
  direction: direction
219
175
  });
220
-
221
176
  this.pc.onicecandidate = function (evt) {
222
177
  return _this2.onLocalCandidate(evt);
223
178
  };
224
-
225
179
  this.pc.oniceconnectionstatechange = function () {
226
180
  return _this2.onConnectionState();
227
181
  };
228
-
229
182
  this.pc.ontrack = function (evt) {
230
183
  console.log('new track:', evt.track.kind);
231
184
  _this2.video.srcObject = evt.streams[0];
232
185
  };
233
-
234
186
  this.pc.createOffer().then(function (offer) {
235
187
  return _this2.onLocalOffer(offer);
236
188
  });
@@ -239,7 +191,6 @@ var WHEPClient = /*#__PURE__*/function () {
239
191
  key: "onLocalOffer",
240
192
  value: function onLocalOffer(offer) {
241
193
  var _this3 = this;
242
-
243
194
  editOffer(offer);
244
195
  this.offerData = parseOffer(offer.sdp);
245
196
  this.pc.setLocalDescription(offer);
@@ -254,7 +205,6 @@ var WHEPClient = /*#__PURE__*/function () {
254
205
  if (res.status !== 201) {
255
206
  throw new Error('bad status code');
256
207
  }
257
-
258
208
  _this3.sessionUrl = new URL(res.headers.get('location'), _this3.url).toString();
259
209
  return res.text();
260
210
  }).then(function (sdp) {
@@ -264,7 +214,6 @@ var WHEPClient = /*#__PURE__*/function () {
264
214
  }));
265
215
  })["catch"](function (err) {
266
216
  console.log('error: ' + err);
267
-
268
217
  _this3.scheduleRestart();
269
218
  });
270
219
  }
@@ -274,9 +223,7 @@ var WHEPClient = /*#__PURE__*/function () {
274
223
  if (this.restartTimeout !== null) {
275
224
  return;
276
225
  }
277
-
278
226
  console.log('peer connection state:', this.pc.iceConnectionState);
279
-
280
227
  switch (this.pc.iceConnectionState) {
281
228
  case 'disconnected':
282
229
  this.scheduleRestart();
@@ -288,9 +235,7 @@ var WHEPClient = /*#__PURE__*/function () {
288
235
  if (this.restartTimeout !== null) {
289
236
  return;
290
237
  }
291
-
292
238
  this.pc.setRemoteDescription(answer);
293
-
294
239
  if (this.queuedCandidates.length !== 0) {
295
240
  this.sendLocalCandidates(this.queuedCandidates);
296
241
  this.queuedCandidates = [];
@@ -302,7 +247,6 @@ var WHEPClient = /*#__PURE__*/function () {
302
247
  if (this.restartTimeout !== null) {
303
248
  return;
304
249
  }
305
-
306
250
  if (evt.candidate !== null) {
307
251
  if (this.sessionUrl === '') {
308
252
  this.queuedCandidates.push(evt.candidate);
@@ -315,7 +259,6 @@ var WHEPClient = /*#__PURE__*/function () {
315
259
  key: "sendLocalCandidates",
316
260
  value: function sendLocalCandidates(candidates) {
317
261
  var _this4 = this;
318
-
319
262
  fetch(this.sessionUrl + window.location.search, {
320
263
  method: 'PATCH',
321
264
  headers: {
@@ -329,7 +272,6 @@ var WHEPClient = /*#__PURE__*/function () {
329
272
  }
330
273
  })["catch"](function (err) {
331
274
  console.log('error: ' + err);
332
-
333
275
  _this4.scheduleRestart();
334
276
  });
335
277
  }
@@ -337,22 +279,17 @@ var WHEPClient = /*#__PURE__*/function () {
337
279
  key: "scheduleRestart",
338
280
  value: function scheduleRestart() {
339
281
  var _this5 = this;
340
-
341
282
  if (this.restartTimeout !== null) {
342
283
  return;
343
284
  }
344
-
345
285
  if (this.pc !== null) {
346
286
  this.pc.close();
347
287
  this.pc = null;
348
288
  }
349
-
350
289
  this.restartTimeout = window.setTimeout(function () {
351
290
  _this5.restartTimeout = null;
352
-
353
291
  _this5.start();
354
292
  }, restartPause);
355
-
356
293
  if (this.sessionUrl) {
357
294
  fetch(this.sessionUrl, {
358
295
  method: 'DELETE'
@@ -364,14 +301,11 @@ var WHEPClient = /*#__PURE__*/function () {
364
301
  console.log('delete session error: ' + err);
365
302
  });
366
303
  }
367
-
368
304
  this.sessionUrl = '';
369
305
  this.queuedCandidates = [];
370
306
  }
371
307
  }]);
372
-
373
308
  return WHEPClient;
374
309
  }();
375
-
376
310
  exports["default"] = WHEPClient;
377
311
  //# sourceMappingURL=WhepManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WhepManager.js","names":["restartPause","linkToIceServers","links","split","map","link","m","match","ret","urls","undefined","username","unquoteCredential","credential","credentialType","editOffer","offer","sections","sdp","i","length","section","startsWith","enableStereoOpus","join","opusPayloadFormat","lines","toLowerCase","includes","slice","parseOffer","iceUfrag","icePwd","medias","line","push","generateSdpFragment","offerData","candidates","candidatesByMedia","candidate","mid","sdpMLineIndex","frag","media","WHEPClient","opt","url","video","pc","restartTimeout","sessionUrl","queuedCandidates","start","console","log","fetch","URL","method","then","res","onIceServers","err","scheduleRestart","RTCPeerConnection","iceServers","headers","get","direction","addTransceiver","onicecandidate","evt","onLocalCandidate","oniceconnectionstatechange","onConnectionState","ontrack","track","kind","srcObject","streams","createOffer","onLocalOffer","setLocalDescription","body","status","Error","toString","text","onRemoteAnswer","RTCSessionDescription","type","iceConnectionState","answer","setRemoteDescription","sendLocalCandidates","window","location","search","close","setTimeout"],"sources":["vtxHls/WhepManager.js"],"sourcesContent":["const restartPause = 2000;\nconst linkToIceServers = (links) => links !== null\n ? links.split(', ').map((link) => {\n const m = link.match(/^<(.+?)>; rel=\"ice-server\"(; username=\"(.*?)\"; credential=\"(.*?)\"; credential-type=\"password\")?/i);\n const ret = {\n urls: [m[1]],\n };\n if (m[3] !== undefined) {\n ret.username = unquoteCredential(m[3]);\n ret.credential = unquoteCredential(m[4]);\n ret.credentialType = 'password';\n }\n return ret;\n })\n : [];\nconst editOffer = (offer) => {\n const sections = offer.sdp.split('m=');\n for (let i = 0; i < sections.length; i++) {\n const section = sections[i];\n if (section.startsWith('audio')) {\n sections[i] = enableStereoOpus(section);\n }\n }\n offer.sdp = sections.join('m=');\n};\nconst enableStereoOpus = (section) => {\n let opusPayloadFormat = '';\n let lines = section.split('\\r\\n');\n for (let i = 0; i < lines.length; i++) {\n if (lines[i].startsWith('a=rtpmap:') && lines[i].toLowerCase().includes('opus/')) {\n opusPayloadFormat = lines[i].slice('a=rtpmap:'.length).split(' ')[0];\n break;\n }\n }\n if (opusPayloadFormat === '') {\n return section;\n }\n for (let i = 0; i < lines.length; i++) {\n if (lines[i].startsWith('a=fmtp:' + opusPayloadFormat + ' ')) {\n if (!lines[i].includes('stereo')) {\n lines[i] += ';stereo=1';\n }\n if (!lines[i].includes('sprop-stereo')) {\n lines[i] += ';sprop-stereo=1';\n }\n }\n }\n return lines.join('\\r\\n');\n};\nconst parseOffer = (offer) => {\n const ret = {\n iceUfrag: '',\n icePwd: '',\n medias: [],\n };\n for (const line of offer.split('\\r\\n')) {\n if (line.startsWith('m=')) {\n ret.medias.push(line.slice('m='.length));\n }\n else if (ret.iceUfrag === '' && line.startsWith('a=ice-ufrag:')) {\n ret.iceUfrag = line.slice('a=ice-ufrag:'.length);\n }\n else if (ret.icePwd === '' && line.startsWith('a=ice-pwd:')) {\n ret.icePwd = line.slice('a=ice-pwd:'.length);\n }\n }\n return ret;\n};\nconst generateSdpFragment = (offerData, candidates) => {\n const candidatesByMedia = {};\n for (const candidate of candidates) {\n const mid = candidate.sdpMLineIndex;\n if (candidatesByMedia[mid] === undefined) {\n candidatesByMedia[mid] = [];\n }\n candidatesByMedia[mid].push(candidate);\n }\n let frag = 'a=ice-ufrag:' + offerData.iceUfrag + '\\r\\n' + 'a=ice-pwd:' + offerData.icePwd + '\\r\\n';\n let mid = 0;\n for (const media of offerData.medias) {\n if (candidatesByMedia[mid] !== undefined) {\n frag += 'm=' + media + '\\r\\n' + 'a=mid:' + mid + '\\r\\n';\n for (const candidate of candidatesByMedia[mid]) {\n frag += 'a=' + candidate.candidate + '\\r\\n';\n }\n }\n mid++;\n }\n return frag;\n};\nexport default class WHEPClient {\n constructor(opt) {\n this.url = opt.url;\n this.video = opt.video;\n this.pc = null;\n this.restartTimeout = null;\n this.sessionUrl = '';\n this.queuedCandidates = [];\n this.start();\n }\n start() {\n console.log('requesting ICE servers');\n fetch(new URL('whep', this.url), {\n method: 'OPTIONS',\n })\n .then((res) => this.onIceServers(res))\n .catch((err) => {\n console.log('error: ' + err);\n this.scheduleRestart();\n });\n }\n onIceServers(res) {\n this.pc = new RTCPeerConnection({\n iceServers: linkToIceServers(res.headers.get('Link')),\n });\n const direction = 'sendrecv';\n this.pc.addTransceiver('video', { direction });\n this.pc.addTransceiver('audio', { direction });\n this.pc.onicecandidate = (evt) => this.onLocalCandidate(evt);\n this.pc.oniceconnectionstatechange = () => this.onConnectionState();\n this.pc.ontrack = (evt) => {\n console.log('new track:', evt.track.kind);\n this.video.srcObject = evt.streams[0];\n };\n this.pc.createOffer().then((offer) => this.onLocalOffer(offer));\n }\n onLocalOffer(offer) {\n editOffer(offer);\n this.offerData = parseOffer(offer.sdp);\n this.pc.setLocalDescription(offer);\n console.log('sending offer');\n fetch(new URL('whep', this.url), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/sdp',\n },\n body: offer.sdp,\n })\n .then((res) => {\n if (res.status !== 201) {\n throw new Error('bad status code');\n }\n this.sessionUrl = new URL(res.headers.get('location'), this.url).toString();\n return res.text();\n })\n .then((sdp) => this.onRemoteAnswer(new RTCSessionDescription({\n type: 'answer',\n sdp,\n })))\n .catch((err) => {\n console.log('error: ' + err);\n this.scheduleRestart();\n });\n }\n onConnectionState() {\n if (this.restartTimeout !== null) {\n return;\n }\n console.log('peer connection state:', this.pc.iceConnectionState);\n switch (this.pc.iceConnectionState) {\n case 'disconnected':\n this.scheduleRestart();\n }\n }\n onRemoteAnswer(answer) {\n if (this.restartTimeout !== null) {\n return;\n }\n this.pc.setRemoteDescription(answer);\n if (this.queuedCandidates.length !== 0) {\n this.sendLocalCandidates(this.queuedCandidates);\n this.queuedCandidates = [];\n }\n }\n onLocalCandidate(evt) {\n if (this.restartTimeout !== null) {\n return;\n }\n if (evt.candidate !== null) {\n if (this.sessionUrl === '') {\n this.queuedCandidates.push(evt.candidate);\n }\n else {\n this.sendLocalCandidates([evt.candidate]);\n }\n }\n }\n sendLocalCandidates(candidates) {\n fetch(this.sessionUrl + window.location.search, {\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/trickle-ice-sdpfrag',\n 'If-Match': '*',\n },\n body: generateSdpFragment(this.offerData, candidates),\n })\n .then((res) => {\n if (res.status !== 204) {\n throw new Error('bad status code');\n }\n })\n .catch((err) => {\n console.log('error: ' + err);\n this.scheduleRestart();\n });\n }\n scheduleRestart() {\n if (this.restartTimeout !== null) {\n return;\n }\n if (this.pc !== null) {\n this.pc.close();\n this.pc = null;\n }\n this.restartTimeout = window.setTimeout(() => {\n this.restartTimeout = null;\n this.start();\n }, restartPause);\n if (this.sessionUrl) {\n fetch(this.sessionUrl, {\n method: 'DELETE',\n })\n .then((res) => {\n if (res.status !== 200) {\n throw new Error('bad status code');\n }\n })\n .catch((err) => {\n console.log('delete session error: ' + err);\n });\n }\n this.sessionUrl = '';\n this.queuedCandidates = [];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAMA,YAAY,GAAG,IAArB;;AACA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,KAAD;EAAA,OAAWA,KAAK,KAAK,IAAV,GAC9BA,KAAK,CAACC,KAAN,CAAY,IAAZ,EAAkBC,GAAlB,CAAsB,UAACC,IAAD,EAAU;IAC9B,IAAMC,CAAC,GAAGD,IAAI,CAACE,KAAL,CAAW,kGAAX,CAAV;IACA,IAAMC,GAAG,GAAG;MACRC,IAAI,EAAE,CAACH,CAAC,CAAC,CAAD,CAAF;IADE,CAAZ;;IAGA,IAAIA,CAAC,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B,EAGnBrD,YAHmB,CAAtB;;MAIA,IAAI,KAAKmD,UAAT,EAAqB;QACjBK,KAAK,CAAC,KAAKL,UAAN,EAAkB;UACnBO,MAAM,EAAE;QADW,CAAlB,CAAL,CAGKC,IAHL,CAGU,UAACC,GAAD,EAAS;UACf,IAAIA,GAAG,CAACwB,MAAJ,KAAe,GAAnB,EAAwB;YACpB,MAAM,IAAIC,KAAJ,CAAU,iBAAV,CAAN;UACH;QACJ,CAPD,WAQW,UAACvB,GAAD,EAAS;UAChBR,OAAO,CAACC,GAAR,CAAY,2BAA2BO,GAAvC;QACH,CAVD;MAWH;;MACD,KAAKX,UAAL,GAAkB,EAAlB;MACA,KAAKC,gBAAL,GAAwB,EAAxB;IACH"}
1
+ {"version":3,"file":"WhepManager.js","names":["restartPause","linkToIceServers","links","split","map","link","m","match","ret","urls","undefined","username","unquoteCredential","credential","credentialType","editOffer","offer","sections","sdp","i","length","section","startsWith","enableStereoOpus","join","opusPayloadFormat","lines","toLowerCase","includes","slice","parseOffer","iceUfrag","icePwd","medias","_iterator","_createForOfIteratorHelper","_step","s","n","done","line","value","push","err","e","f","generateSdpFragment","offerData","candidates","candidatesByMedia","_iterator2","_step2","candidate","mid","sdpMLineIndex","frag","_iterator3","_step3","media","_iterator4","_step4","WHEPClient","opt","_classCallCheck","url","video","pc","restartTimeout","sessionUrl","queuedCandidates","start","_createClass","key","_this","console","log","fetch","URL","method","then","res","onIceServers","scheduleRestart","_this2","RTCPeerConnection","iceServers","headers","get","direction","addTransceiver","onicecandidate","evt","onLocalCandidate","oniceconnectionstatechange","onConnectionState","ontrack","track","kind","srcObject","streams","createOffer","onLocalOffer","_this3","setLocalDescription","body","status","Error","toString","text","onRemoteAnswer","RTCSessionDescription","type","iceConnectionState","answer","setRemoteDescription","sendLocalCandidates","_this4","window","location","search","_this5","close","setTimeout","exports"],"sources":["vtxHls/WhepManager.js"],"sourcesContent":["const restartPause = 2000;\nconst linkToIceServers = (links) => links !== null\n ? links.split(', ').map((link) => {\n const m = link.match(/^<(.+?)>; rel=\"ice-server\"(; username=\"(.*?)\"; credential=\"(.*?)\"; credential-type=\"password\")?/i);\n const ret = {\n urls: [m[1]],\n };\n if (m[3] !== undefined) {\n ret.username = unquoteCredential(m[3]);\n ret.credential = unquoteCredential(m[4]);\n ret.credentialType = 'password';\n }\n return ret;\n })\n : [];\nconst editOffer = (offer) => {\n const sections = offer.sdp.split('m=');\n for (let i = 0; i < sections.length; i++) {\n const section = sections[i];\n if (section.startsWith('audio')) {\n sections[i] = enableStereoOpus(section);\n }\n }\n offer.sdp = sections.join('m=');\n};\nconst enableStereoOpus = (section) => {\n let opusPayloadFormat = '';\n let lines = section.split('\\r\\n');\n for (let i = 0; i < lines.length; i++) {\n if (lines[i].startsWith('a=rtpmap:') && lines[i].toLowerCase().includes('opus/')) {\n opusPayloadFormat = lines[i].slice('a=rtpmap:'.length).split(' ')[0];\n break;\n }\n }\n if (opusPayloadFormat === '') {\n return section;\n }\n for (let i = 0; i < lines.length; i++) {\n if (lines[i].startsWith('a=fmtp:' + opusPayloadFormat + ' ')) {\n if (!lines[i].includes('stereo')) {\n lines[i] += ';stereo=1';\n }\n if (!lines[i].includes('sprop-stereo')) {\n lines[i] += ';sprop-stereo=1';\n }\n }\n }\n return lines.join('\\r\\n');\n};\nconst parseOffer = (offer) => {\n const ret = {\n iceUfrag: '',\n icePwd: '',\n medias: [],\n };\n for (const line of offer.split('\\r\\n')) {\n if (line.startsWith('m=')) {\n ret.medias.push(line.slice('m='.length));\n }\n else if (ret.iceUfrag === '' && line.startsWith('a=ice-ufrag:')) {\n ret.iceUfrag = line.slice('a=ice-ufrag:'.length);\n }\n else if (ret.icePwd === '' && line.startsWith('a=ice-pwd:')) {\n ret.icePwd = line.slice('a=ice-pwd:'.length);\n }\n }\n return ret;\n};\nconst generateSdpFragment = (offerData, candidates) => {\n const candidatesByMedia = {};\n for (const candidate of candidates) {\n const mid = candidate.sdpMLineIndex;\n if (candidatesByMedia[mid] === undefined) {\n candidatesByMedia[mid] = [];\n }\n candidatesByMedia[mid].push(candidate);\n }\n let frag = 'a=ice-ufrag:' + offerData.iceUfrag + '\\r\\n' + 'a=ice-pwd:' + offerData.icePwd + '\\r\\n';\n let mid = 0;\n for (const media of offerData.medias) {\n if (candidatesByMedia[mid] !== undefined) {\n frag += 'm=' + media + '\\r\\n' + 'a=mid:' + mid + '\\r\\n';\n for (const candidate of candidatesByMedia[mid]) {\n frag += 'a=' + candidate.candidate + '\\r\\n';\n }\n }\n mid++;\n }\n return frag;\n};\nexport default class WHEPClient {\n constructor(opt) {\n this.url = opt.url;\n this.video = opt.video;\n this.pc = null;\n this.restartTimeout = null;\n this.sessionUrl = '';\n this.queuedCandidates = [];\n this.start();\n }\n start() {\n console.log('requesting ICE servers');\n fetch(new URL('whep', this.url), {\n method: 'OPTIONS',\n })\n .then((res) => this.onIceServers(res))\n .catch((err) => {\n console.log('error: ' + err);\n this.scheduleRestart();\n });\n }\n onIceServers(res) {\n this.pc = new RTCPeerConnection({\n iceServers: linkToIceServers(res.headers.get('Link')),\n });\n const direction = 'sendrecv';\n this.pc.addTransceiver('video', { direction });\n this.pc.addTransceiver('audio', { direction });\n this.pc.onicecandidate = (evt) => this.onLocalCandidate(evt);\n this.pc.oniceconnectionstatechange = () => this.onConnectionState();\n this.pc.ontrack = (evt) => {\n console.log('new track:', evt.track.kind);\n this.video.srcObject = evt.streams[0];\n };\n this.pc.createOffer().then((offer) => this.onLocalOffer(offer));\n }\n onLocalOffer(offer) {\n editOffer(offer);\n this.offerData = parseOffer(offer.sdp);\n this.pc.setLocalDescription(offer);\n console.log('sending offer');\n fetch(new URL('whep', this.url), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/sdp',\n },\n body: offer.sdp,\n })\n .then((res) => {\n if (res.status !== 201) {\n throw new Error('bad status code');\n }\n this.sessionUrl = new URL(res.headers.get('location'), this.url).toString();\n return res.text();\n })\n .then((sdp) => this.onRemoteAnswer(new RTCSessionDescription({\n type: 'answer',\n sdp,\n })))\n .catch((err) => {\n console.log('error: ' + err);\n this.scheduleRestart();\n });\n }\n onConnectionState() {\n if (this.restartTimeout !== null) {\n return;\n }\n console.log('peer connection state:', this.pc.iceConnectionState);\n switch (this.pc.iceConnectionState) {\n case 'disconnected':\n this.scheduleRestart();\n }\n }\n onRemoteAnswer(answer) {\n if (this.restartTimeout !== null) {\n return;\n }\n this.pc.setRemoteDescription(answer);\n if (this.queuedCandidates.length !== 0) {\n this.sendLocalCandidates(this.queuedCandidates);\n this.queuedCandidates = [];\n }\n }\n onLocalCandidate(evt) {\n if (this.restartTimeout !== null) {\n return;\n }\n if (evt.candidate !== null) {\n if (this.sessionUrl === '') {\n this.queuedCandidates.push(evt.candidate);\n }\n else {\n this.sendLocalCandidates([evt.candidate]);\n }\n }\n }\n sendLocalCandidates(candidates) {\n fetch(this.sessionUrl + window.location.search, {\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/trickle-ice-sdpfrag',\n 'If-Match': '*',\n },\n body: generateSdpFragment(this.offerData, candidates),\n })\n .then((res) => {\n if (res.status !== 204) {\n throw new Error('bad status code');\n }\n })\n .catch((err) => {\n console.log('error: ' + err);\n this.scheduleRestart();\n });\n }\n scheduleRestart() {\n if (this.restartTimeout !== null) {\n return;\n }\n if (this.pc !== null) {\n this.pc.close();\n this.pc = null;\n }\n this.restartTimeout = window.setTimeout(() => {\n this.restartTimeout = null;\n this.start();\n }, restartPause);\n if (this.sessionUrl) {\n fetch(this.sessionUrl, {\n method: 'DELETE',\n })\n .then((res) => {\n if (res.status !== 200) {\n throw new Error('bad status code');\n }\n })\n .catch((err) => {\n console.log('delete session error: ' + err);\n });\n }\n this.sessionUrl = '';\n this.queuedCandidates = [];\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAMA,YAAY,GAAG,IAAI;AACzB,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,KAAK;EAAA,OAAKA,KAAK,KAAK,IAAI,GAC5CA,KAAK,CA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B+B,OAAO,CAACC,GAAG,CAAC,SAAS,GAAGhC,GAAG,CAAC;QAC5ByE,MAAI,CAAClC,eAAe,CAAC,CAAC;MAC1B,CAAC,CAAC;IACN;EAAC;IAAAV,GAAA;IAAA/B,KAAA,EACD,SAAAyC,gBAAA,EAAkB;MAAA,IAAAsC,MAAA;MACd,IAAI,IAAI,CAACrD,cAAc,KAAK,IAAI,EAAE;QAC9B;MACJ;MACA,IAAI,IAAI,CAACD,EAAE,KAAK,IAAI,EAAE;QAClB,IAAI,CAACA,EAAE,CAACuD,KAAK,CAAC,CAAC;QACf,IAAI,CAACvD,EAAE,GAAG,IAAI;MAClB;MACA,IAAI,CAACC,cAAc,GAAGkD,MAAM,CAACK,UAAU,CAAC,YAAM;QAC1CF,MAAI,CAACrD,cAAc,GAAG,IAAI;QAC1BqD,MAAI,CAAClD,KAAK,CAAC,CAAC;MAChB,CAAC,EAAEtE,YAAY,CAAC;MAChB,IAAI,IAAI,CAACoE,UAAU,EAAE;QACjBQ,KAAK,CAAC,IAAI,CAACR,UAAU,EAAE;UACnBU,MAAM,EAAE;QACZ,CAAC,CAAC,CACGC,IAAI,CAAC,UAACC,GAAG,EAAK;UACf,IAAIA,GAAG,CAACyB,MAAM,KAAK,GAAG,EAAE;YACpB,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;UACtC;QACJ,CAAC,CAAC,SACQ,CAAC,UAAC/D,GAAG,EAAK;UAChB+B,OAAO,CAACC,GAAG,CAAC,wBAAwB,GAAGhC,GAAG,CAAC;QAC/C,CAAC,CAAC;MACN;MACA,IAAI,CAACyB,UAAU,GAAG,EAAE;MACpB,IAAI,CAACC,gBAAgB,GAAG,EAAE;IAC9B;EAAC;EAAA,OAAAR,UAAA;AAAA;AAAA8D,OAAA,cAAA9D,UAAA","ignoreList":[]}
@@ -4,44 +4,37 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
-
10
8
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
-
12
9
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
-
14
10
  var SrsRtcPlayerConstructor = SrsRtcPlayerAsync;
15
11
  /**
16
12
  * WSPlayer是核心组件
17
13
  * API 封装了接口
18
14
  */
19
-
20
15
  var WebrtcPlayerManager = /*#__PURE__*/function () {
21
16
  function WebrtcPlayerManager(opt) {
22
17
  _classCallCheck(this, WebrtcPlayerManager);
23
-
24
18
  // 播放器所在的容器ID
25
- this.el = opt.el; // 实时预览播放器
26
-
27
- this.realPlayer = null; // 录像回放播放器
28
-
19
+ this.el = opt.el;
20
+ // 实时预览播放器
21
+ this.realPlayer = null;
22
+ // 录像回放播放器
29
23
  this.recordPlayer = null;
30
24
  this.player = null;
31
- this.url = opt.url; // 实时预览还是录像回放播放器
32
-
33
- this.type = opt.type; // 窗口的数量
34
-
35
- this.playNum = 1; // 当前选中的窗口的索引
36
-
37
- this.playIndex = 0; // 当前选中窗口正在播放视频的通道
38
-
39
- this.currentChannelId = ''; // 索引对应窗口,保存当日录像信息
40
-
25
+ this.url = opt.url;
26
+ // 实时预览还是录像回放播放器
27
+ this.type = opt.type;
28
+ // 窗口的数量
29
+ this.playNum = 1;
30
+ // 当前选中的窗口的索引
31
+ this.playIndex = 0;
32
+ // 当前选中窗口正在播放视频的通道
33
+ this.currentChannelId = '';
34
+ // 索引对应窗口,保存当日录像信息
41
35
  this.recordList = [];
42
36
  this.init(opt);
43
37
  }
44
-
45
38
  _createClass(WebrtcPlayerManager, [{
46
39
  key: "init",
47
40
  value: function init(opt) {
@@ -50,19 +43,16 @@ var WebrtcPlayerManager = /*#__PURE__*/function () {
50
43
  /**
51
44
  * 初始化实时预览播放器
52
45
  */
53
-
54
46
  }, {
55
47
  key: "initPlayer",
56
48
  value: function initPlayer(opt) {
57
49
  this.playNum = opt.num;
58
50
  this.realPlayer = new SrsRtcPlayerConstructor();
59
-
60
51
  if (this.type) {
61
52
  $("#".concat(this.el)).prop('srcObject', this.realPlayer.stream);
62
53
  } else {
63
54
  $("#".concat(this.el)).prop('src', this.realPlayer.stream);
64
55
  }
65
-
66
56
  this.realPlayer.play(this.url)["catch"](function (reason) {
67
57
  this.realPlayer.close();
68
58
  console.error(reason);
@@ -73,7 +63,6 @@ var WebrtcPlayerManager = /*#__PURE__*/function () {
73
63
  * 录像暂停
74
64
  * 只有正在播放的录像调用才有效
75
65
  */
76
-
77
66
  }, {
78
67
  key: "pause",
79
68
  value: function pause() {
@@ -83,7 +72,6 @@ var WebrtcPlayerManager = /*#__PURE__*/function () {
83
72
  * 录像暂停后播放
84
73
  * 只有暂停后的录像调用才有效
85
74
  */
86
-
87
75
  }, {
88
76
  key: "play",
89
77
  value: function play() {
@@ -93,7 +81,6 @@ var WebrtcPlayerManager = /*#__PURE__*/function () {
93
81
  * 倍速播放
94
82
  * @param {number} speed 速率 0.125 0.25 0.5 1 2 4 8 共7种速率
95
83
  */
96
-
97
84
  }, {
98
85
  key: "playSpeed",
99
86
  value: function playSpeed(speed) {
@@ -103,7 +90,6 @@ var WebrtcPlayerManager = /*#__PURE__*/function () {
103
90
  * 关闭播放器
104
91
  * @param {number} index 可选,关闭指定索引的窗口的播放器,不传则表示关闭所有播放器
105
92
  */
106
-
107
93
  }, {
108
94
  key: "close",
109
95
  value: function close() {
@@ -112,52 +98,50 @@ var WebrtcPlayerManager = /*#__PURE__*/function () {
112
98
  /**
113
99
  * 设置全屏
114
100
  */
115
-
116
101
  }, {
117
102
  key: "setFullScreen",
118
- value: function setFullScreen() {// this.player.setFullScreen();
103
+ value: function setFullScreen() {
104
+ // this.player.setFullScreen();
119
105
  }
120
106
  /**
121
107
  * 设置窗口自适应还是拉伸
122
108
  * @param {string} playerAdapter selfAdaption 自适应 | stretching 拉伸
123
109
  */
124
-
125
110
  }, {
126
111
  key: "setPlayerAdapter",
127
- value: function setPlayerAdapter(playerAdapter) {// this.player.setPlayerAdapter(playerAdapter);
112
+ value: function setPlayerAdapter(playerAdapter) {
113
+ // this.player.setPlayerAdapter(playerAdapter);
128
114
  }
129
115
  /**
130
116
  * 控制视频播放器显示的路数: 1 4 9 16 25,不会超过最大显示路数
131
117
  * @param {number} number
132
118
  */
133
-
134
119
  }, {
135
120
  key: "setPlayerNum",
136
- value: function setPlayerNum(number) {// this.player.setPlayerNum(number);
121
+ value: function setPlayerNum(number) {
122
+ // this.player.setPlayerNum(number);
137
123
  }
138
124
  /**
139
125
  * 设置选中的播放器的索引
140
126
  * @param {number} index
141
127
  */
142
-
143
128
  }, {
144
129
  key: "setSelectIndex",
145
- value: function setSelectIndex(index) {// this.player.setSelectIndex(index);
130
+ value: function setSelectIndex(index) {
131
+ // this.player.setSelectIndex(index);
146
132
  }
147
133
  /**
148
134
  * 录像跳转播放
149
135
  * @param {string} time HH:mm:ss格式
150
136
  */
151
-
152
137
  }, {
153
138
  key: "jumpPlayByTime",
154
- value: function jumpPlayByTime(time) {// this.player.jumpPlayByTime(time);
139
+ value: function jumpPlayByTime(time) {
140
+ // this.player.jumpPlayByTime(time);
155
141
  }
156
142
  }]);
157
-
158
143
  return WebrtcPlayerManager;
159
144
  }();
160
-
161
145
  var _default = WebrtcPlayerManager;
162
146
  exports["default"] = _default;
163
147
  //# sourceMappingURL=PlayerManager.js.map