@besovideo/webrtc-player 0.9.8 → 0.9.81

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.
@@ -117,7 +117,7 @@ var bvPlayerCore = (() => {
117
117
  var define_processenv_default;
118
118
  var init_define_processenv = __esm({
119
119
  "<define:processenv>"() {
120
- define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.9.8", PROJECT_NAMESPACE: "bvplayer" };
120
+ define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.9.81", PROJECT_NAMESPACE: "bvplayer" };
121
121
  }
122
122
  });
123
123
 
@@ -14841,9 +14841,10 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
14841
14841
  const clsName = core_default.style.cls(["icon", className]);
14842
14842
  return /* @__PURE__ */ jsx_default.h("span", { className: clsName, style: style2, withNamespace: true }, children);
14843
14843
  };
14844
+ var svgForbidden = /* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16px", height: "16px", viewBox: "0 0 72 72" }, /* @__PURE__ */ jsx_default.h("circle", { cx: "36", cy: "36", r: "26", fill: "#fff" }), /* @__PURE__ */ jsx_default.h("path", { fill: "#ea5a47", d: "M36 7C19.98 7 7 19.98 7 36s12.98 29 29 29s29-12.98 29-29S52.02 7 36 7M10.79 36.27c0-5.075 3.417-12.69 6.202-16.49l35.2 35.27c-3.805 2.784-10.93 5.904-16.01 5.904c-12.7 0-25.39-11.98-25.39-24.68zm44.87 15.18L20.6 16.32c3.805-2.784 10.77-5.441 15.84-5.441c12.7 0 24.68 12.25 24.68 24.95c0 5.075-2.686 11.81-5.47 15.62z" }), /* @__PURE__ */ jsx_default.h("g", { fill: "none", stroke: "#000", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, /* @__PURE__ */ jsx_default.h("circle", { cx: "36", cy: "36", r: "30" }), /* @__PURE__ */ jsx_default.h("path", { d: "M55.66 51.44A24.99 24.99 0 0 0 20.6 16.31zM16.99 19.77a24.99 24.99 0 0 0 35.2 35.27z" })));
14844
14845
  var Cog = ({ filled }) => /* @__PURE__ */ jsx_default.h(Icon, null, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCogFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCog, null));
14845
14846
  var Camera = ({ filled }) => /* @__PURE__ */ jsx_default.h(Icon, null, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCameraFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCamera, null));
14846
- var VideoCamera = ({ filled }) => /* @__PURE__ */ jsx_default.h(Icon, null, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreVideoCameraFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreVideoCamera, null));
14847
+ var VideoCamera = ({ filled, forbidden }) => /* @__PURE__ */ jsx_default.h(Icon, { style: "position: relative" }, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreVideoCameraFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreVideoCamera, null), " ", forbidden ? /* @__PURE__ */ jsx_default.h("span", { style: "position: absolute;left: 5px; top: -2px" }, svgForbidden) : /* @__PURE__ */ jsx_default.h(jsx_default.Fragment, null));
14847
14848
  var Info = ({ filled }) => {
14848
14849
  return /* @__PURE__ */ jsx_default.h(Icon, null, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreInformationCircleFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreInformationCircle, null));
14849
14850
  };
@@ -15392,10 +15393,13 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
15392
15393
  },
15393
15394
  record: () => {
15394
15395
  const RecordButton = new button_default(
15395
- /* @__PURE__ */ jsx_default.h(icons_default.VideoCamera, null),
15396
+ /* @__PURE__ */ jsx_default.h(icons_default.VideoCamera, { forbidden: !HTMLMediaElement.prototype.captureStream }),
15396
15397
  "record"
15397
15398
  );
15398
15399
  const recordStart = () => {
15400
+ if (!HTMLMediaElement.prototype.captureStream) {
15401
+ return;
15402
+ }
15399
15403
  this.dispatch("recordStart");
15400
15404
  RecordButton.Children = /* @__PURE__ */ jsx_default.h(icons_default.Stop, null);
15401
15405
  RecordButton.color = "#ed3838";
@@ -16029,8 +16033,31 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
16029
16033
  } else if (!(`requestFullscreen` in DOC_EL)) {
16030
16034
  console.assert(false, `\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301Fullscreen API !`);
16031
16035
  }
16032
- function beFull(el = DOC_EL, options) {
16033
- return el[RFC_METHOD_NAME](options);
16036
+ function beFullCapIOSOnIphone() {
16037
+ return __async(this, arguments, function* (el = DOC_EL) {
16038
+ const videoEles = el.getElementsByTagName("video");
16039
+ if (videoEles.length) {
16040
+ const fullscreen2 = videoEles[0];
16041
+ const iIntervalToken = setInterval(() => {
16042
+ if (!fullscreen2.webkitDisplayingFullscreen) {
16043
+ clearInterval(iIntervalToken);
16044
+ setTimeout(() => {
16045
+ fullscreen2.play();
16046
+ }, 500);
16047
+ }
16048
+ }, 1e3);
16049
+ return fullscreen2["webkitEnterFullscreen"]();
16050
+ }
16051
+ });
16052
+ }
16053
+ function beFull() {
16054
+ return __async(this, arguments, function* (el = DOC_EL, options) {
16055
+ if (!el[RFC_METHOD_NAME]) {
16056
+ return yield beFullCapIOSOnIphone(el);
16057
+ } else {
16058
+ return el[RFC_METHOD_NAME](options);
16059
+ }
16060
+ });
16034
16061
  }
16035
16062
  function exitFull() {
16036
16063
  return document[EFS_METHOD_NAME]();
@@ -20117,6 +20144,9 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
20117
20144
  }
20118
20145
  recordStart() {
20119
20146
  var _a, _b;
20147
+ if (!HTMLMediaElement.prototype.captureStream) {
20148
+ return;
20149
+ }
20120
20150
  if (!this._recordState.BRecording()) {
20121
20151
  if ((_a = this._panel) == null ? void 0 : _a.controller.RecordButton) {
20122
20152
  (_b = this._panel) == null ? void 0 : _b.controller.RecordButton.dispatch("click");
@@ -20129,6 +20159,9 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
20129
20159
  }
20130
20160
  recordStop() {
20131
20161
  var _a, _b;
20162
+ if (!HTMLMediaElement.prototype.captureStream) {
20163
+ return;
20164
+ }
20132
20165
  if (this._recordState.BRecording()) {
20133
20166
  if ((_a = this._panel) == null ? void 0 : _a.controller.RecordButton) {
20134
20167
  (_b = this._panel) == null ? void 0 : _b.controller.RecordButton.dispatch("click");
@@ -22508,6 +22541,13 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
22508
22541
  getRemoteSdpParam,
22509
22542
  apiPrefix
22510
22543
  );
22544
+ let localStreamRelease = void 0;
22545
+ const releaseLocalStream = () => {
22546
+ if (localStreamRelease) {
22547
+ localStreamRelease();
22548
+ localStreamRelease = void 0;
22549
+ }
22550
+ };
22511
22551
  const { instance: bvWebrtcComponentInstance, element } = bvWebrtc_default({
22512
22552
  container,
22513
22553
  sdpFetcher,
@@ -22518,13 +22558,26 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
22518
22558
  muted: false,
22519
22559
  autoPlay: true,
22520
22560
  onConnected,
22521
- onClose,
22522
- onDestroy: onDestroy2,
22523
- onDisConnected,
22561
+ onClose: () => {
22562
+ releaseLocalStream();
22563
+ onClose == null ? void 0 : onClose();
22564
+ },
22565
+ onDestroy: () => {
22566
+ releaseLocalStream();
22567
+ onDestroy2 == null ? void 0 : onDestroy2();
22568
+ },
22569
+ onDisConnected: () => {
22570
+ releaseLocalStream();
22571
+ onDisConnected == null ? void 0 : onDisConnected();
22572
+ },
22524
22573
  onPcEventAdded: (pc) => __async(void 0, null, function* () {
22525
22574
  try {
22526
22575
  const localStream = yield getUserMedia();
22527
22576
  localStream.getTracks().forEach((track) => pc.addTrack(track, localStream));
22577
+ releaseLocalStream();
22578
+ localStreamRelease = () => {
22579
+ localStream.getTracks().forEach((t2) => t2.stop());
22580
+ };
22528
22581
  } catch (e) {
22529
22582
  onGetUserMediaFailed && onGetUserMediaFailed();
22530
22583
  }
package/dist/main.es.js CHANGED
@@ -111,7 +111,7 @@ var __async = (__this, __arguments, generator) => {
111
111
  var define_processenv_default;
112
112
  var init_define_processenv = __esm({
113
113
  "<define:processenv>"() {
114
- define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.9.8", PROJECT_NAMESPACE: "bvplayer" };
114
+ define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.9.81", PROJECT_NAMESPACE: "bvplayer" };
115
115
  }
116
116
  });
117
117
 
@@ -14825,9 +14825,10 @@ var Icon = ({ children, className, style: style2 }) => {
14825
14825
  const clsName = core_default.style.cls(["icon", className]);
14826
14826
  return /* @__PURE__ */ jsx_default.h("span", { className: clsName, style: style2, withNamespace: true }, children);
14827
14827
  };
14828
+ var svgForbidden = /* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16px", height: "16px", viewBox: "0 0 72 72" }, /* @__PURE__ */ jsx_default.h("circle", { cx: "36", cy: "36", r: "26", fill: "#fff" }), /* @__PURE__ */ jsx_default.h("path", { fill: "#ea5a47", d: "M36 7C19.98 7 7 19.98 7 36s12.98 29 29 29s29-12.98 29-29S52.02 7 36 7M10.79 36.27c0-5.075 3.417-12.69 6.202-16.49l35.2 35.27c-3.805 2.784-10.93 5.904-16.01 5.904c-12.7 0-25.39-11.98-25.39-24.68zm44.87 15.18L20.6 16.32c3.805-2.784 10.77-5.441 15.84-5.441c12.7 0 24.68 12.25 24.68 24.95c0 5.075-2.686 11.81-5.47 15.62z" }), /* @__PURE__ */ jsx_default.h("g", { fill: "none", stroke: "#000", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, /* @__PURE__ */ jsx_default.h("circle", { cx: "36", cy: "36", r: "30" }), /* @__PURE__ */ jsx_default.h("path", { d: "M55.66 51.44A24.99 24.99 0 0 0 20.6 16.31zM16.99 19.77a24.99 24.99 0 0 0 35.2 35.27z" })));
14828
14829
  var Cog = ({ filled }) => /* @__PURE__ */ jsx_default.h(Icon, null, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCogFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCog, null));
14829
14830
  var Camera = ({ filled }) => /* @__PURE__ */ jsx_default.h(Icon, null, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCameraFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCamera, null));
14830
- var VideoCamera = ({ filled }) => /* @__PURE__ */ jsx_default.h(Icon, null, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreVideoCameraFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreVideoCamera, null));
14831
+ var VideoCamera = ({ filled, forbidden }) => /* @__PURE__ */ jsx_default.h(Icon, { style: "position: relative" }, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreVideoCameraFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreVideoCamera, null), " ", forbidden ? /* @__PURE__ */ jsx_default.h("span", { style: "position: absolute;left: 5px; top: -2px" }, svgForbidden) : /* @__PURE__ */ jsx_default.h(jsx_default.Fragment, null));
14831
14832
  var Info = ({ filled }) => {
14832
14833
  return /* @__PURE__ */ jsx_default.h(Icon, null, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreInformationCircleFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreInformationCircle, null));
14833
14834
  };
@@ -15376,10 +15377,13 @@ var ControllerPluginBase = class extends Plugin {
15376
15377
  },
15377
15378
  record: () => {
15378
15379
  const RecordButton = new button_default(
15379
- /* @__PURE__ */ jsx_default.h(icons_default.VideoCamera, null),
15380
+ /* @__PURE__ */ jsx_default.h(icons_default.VideoCamera, { forbidden: !HTMLMediaElement.prototype.captureStream }),
15380
15381
  "record"
15381
15382
  );
15382
15383
  const recordStart = () => {
15384
+ if (!HTMLMediaElement.prototype.captureStream) {
15385
+ return;
15386
+ }
15383
15387
  this.dispatch("recordStart");
15384
15388
  RecordButton.Children = /* @__PURE__ */ jsx_default.h(icons_default.Stop, null);
15385
15389
  RecordButton.color = "#ed3838";
@@ -16013,8 +16017,31 @@ if (`webkitRequestFullScreen` in DOC_EL) {
16013
16017
  } else if (!(`requestFullscreen` in DOC_EL)) {
16014
16018
  console.assert(false, `\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301Fullscreen API !`);
16015
16019
  }
16016
- function beFull(el = DOC_EL, options) {
16017
- return el[RFC_METHOD_NAME](options);
16020
+ function beFullCapIOSOnIphone() {
16021
+ return __async(this, arguments, function* (el = DOC_EL) {
16022
+ const videoEles = el.getElementsByTagName("video");
16023
+ if (videoEles.length) {
16024
+ const fullscreen2 = videoEles[0];
16025
+ const iIntervalToken = setInterval(() => {
16026
+ if (!fullscreen2.webkitDisplayingFullscreen) {
16027
+ clearInterval(iIntervalToken);
16028
+ setTimeout(() => {
16029
+ fullscreen2.play();
16030
+ }, 500);
16031
+ }
16032
+ }, 1e3);
16033
+ return fullscreen2["webkitEnterFullscreen"]();
16034
+ }
16035
+ });
16036
+ }
16037
+ function beFull() {
16038
+ return __async(this, arguments, function* (el = DOC_EL, options) {
16039
+ if (!el[RFC_METHOD_NAME]) {
16040
+ return yield beFullCapIOSOnIphone(el);
16041
+ } else {
16042
+ return el[RFC_METHOD_NAME](options);
16043
+ }
16044
+ });
16018
16045
  }
16019
16046
  function exitFull() {
16020
16047
  return document[EFS_METHOD_NAME]();
@@ -20101,6 +20128,9 @@ var PlayerPlugin = class extends Plugin {
20101
20128
  }
20102
20129
  recordStart() {
20103
20130
  var _a, _b;
20131
+ if (!HTMLMediaElement.prototype.captureStream) {
20132
+ return;
20133
+ }
20104
20134
  if (!this._recordState.BRecording()) {
20105
20135
  if ((_a = this._panel) == null ? void 0 : _a.controller.RecordButton) {
20106
20136
  (_b = this._panel) == null ? void 0 : _b.controller.RecordButton.dispatch("click");
@@ -20113,6 +20143,9 @@ var PlayerPlugin = class extends Plugin {
20113
20143
  }
20114
20144
  recordStop() {
20115
20145
  var _a, _b;
20146
+ if (!HTMLMediaElement.prototype.captureStream) {
20147
+ return;
20148
+ }
20116
20149
  if (this._recordState.BRecording()) {
20117
20150
  if ((_a = this._panel) == null ? void 0 : _a.controller.RecordButton) {
20118
20151
  (_b = this._panel) == null ? void 0 : _b.controller.RecordButton.dispatch("click");
@@ -22492,6 +22525,13 @@ var AudioPlayer = (props) => {
22492
22525
  getRemoteSdpParam,
22493
22526
  apiPrefix
22494
22527
  );
22528
+ let localStreamRelease = void 0;
22529
+ const releaseLocalStream = () => {
22530
+ if (localStreamRelease) {
22531
+ localStreamRelease();
22532
+ localStreamRelease = void 0;
22533
+ }
22534
+ };
22495
22535
  const { instance: bvWebrtcComponentInstance, element } = bvWebrtc_default({
22496
22536
  container,
22497
22537
  sdpFetcher,
@@ -22502,13 +22542,26 @@ var AudioPlayer = (props) => {
22502
22542
  muted: false,
22503
22543
  autoPlay: true,
22504
22544
  onConnected,
22505
- onClose,
22506
- onDestroy: onDestroy2,
22507
- onDisConnected,
22545
+ onClose: () => {
22546
+ releaseLocalStream();
22547
+ onClose == null ? void 0 : onClose();
22548
+ },
22549
+ onDestroy: () => {
22550
+ releaseLocalStream();
22551
+ onDestroy2 == null ? void 0 : onDestroy2();
22552
+ },
22553
+ onDisConnected: () => {
22554
+ releaseLocalStream();
22555
+ onDisConnected == null ? void 0 : onDisConnected();
22556
+ },
22508
22557
  onPcEventAdded: (pc) => __async(void 0, null, function* () {
22509
22558
  try {
22510
22559
  const localStream = yield getUserMedia();
22511
22560
  localStream.getTracks().forEach((track) => pc.addTrack(track, localStream));
22561
+ releaseLocalStream();
22562
+ localStreamRelease = () => {
22563
+ localStream.getTracks().forEach((t2) => t2.stop());
22564
+ };
22512
22565
  } catch (e) {
22513
22566
  onGetUserMediaFailed && onGetUserMediaFailed();
22514
22567
  }
@@ -3,6 +3,7 @@ interface IIconsProps {
3
3
  filled?: boolean;
4
4
  circle?: boolean;
5
5
  off?: boolean;
6
+ forbidden?: boolean;
6
7
  }
7
8
  export declare type IDirections = "lb" | "bottom" | "rb" | "left" | "right" | "lt" | "top" | "rt";
8
9
  interface IDirectionIconProps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@besovideo/webrtc-player",
3
- "version": "0.9.8",
3
+ "version": "0.9.81",
4
4
  "description": "@besovideo/webrtc-player desc",
5
5
  "type": "module",
6
6
  "types": "./dist/types/main.d.ts",