@realsee/vreo 2.2.0-alpha.0 → 2.2.0-alpha.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.
@@ -19,7 +19,7 @@ function BgMusic() {
19
19
  React.useEffect(function () {
20
20
  var callback = /*#__PURE__*/function () {
21
21
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(keyframe, currentTime) {
22
- var start, end, _currentTime, audio, cleanAudio;
22
+ var start, end, _currentTime, audio, cleanAudio, play;
23
23
  return _regeneratorRuntime().wrap(function _callee$(_context) {
24
24
  while (1) {
25
25
  switch (_context.prev = _context.next) {
@@ -40,6 +40,7 @@ function BgMusic() {
40
40
  audio.play();
41
41
  cleanAudio = function cleanAudio() {
42
42
  // audio.removeEventListener('canplaythrough', play)
43
+ audio.removeEventListener('pause', play);
43
44
  audio.pause();
44
45
  audio.src = '';
45
46
  // cleanTimeout()
@@ -48,16 +49,17 @@ function BgMusic() {
48
49
  audio.addEventListener('ended', function () {
49
50
  cleanAudio();
50
51
  });
51
- audio.addEventListener('pause', function () {
52
+ play = function play() {
52
53
  if (audio.realSrc === keyframe.data.url) {
53
54
  // 有可能会被其他音轨打断
54
55
  audio.play();
55
56
  }
56
- });
57
+ };
58
+ audio.addEventListener('pause', play);
57
59
  controller.once('paused', function () {
58
60
  cleanAudio();
59
61
  });
60
- case 11:
62
+ case 12:
61
63
  case "end":
62
64
  return _context.stop();
63
65
  }
@@ -1,3 +1,2 @@
1
1
  /// <reference types="react" />
2
- export declare const isWX: boolean;
3
2
  export declare function InfoPanel(): JSX.Element;
@@ -5,16 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.InfoPanel = InfoPanel;
8
- exports.isWX = void 0;
9
8
  var React = _interopRequireWildcard(require("react"));
10
9
  var _VreoUnit = require("../../../../typings/VreoUnit");
11
10
  var _hooks = require("../../../hooks");
12
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
13
  var isWX = navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1;
15
- exports.isWX = isWX;
14
+ var isIOS = navigator.userAgent.toLowerCase().indexOf('iphone') !== -1;
15
+ var isIOSorWX = isIOS || isWX;
16
16
  var videoElement = document.createElement('video');
17
- if (isWX) {
17
+ if (isIOSorWX) {
18
18
  videoElement.playsInline = true;
19
19
  videoElement.classList.add('vreo-infoPanelVideo');
20
20
  document.body.addEventListener('click', function () {
@@ -39,7 +39,7 @@ function InfoPanelVideo(_ref2) {
39
39
  children = _ref2.children;
40
40
  var videoWrapperRef = React.useRef(null);
41
41
  React.useEffect(function () {
42
- if (!isWX) return;
42
+ if (!isIOSorWX) return;
43
43
  if (!videoWrapperRef.current) return;
44
44
  videoElement.src = url;
45
45
  if (!videoWrapperRef.current.contains(videoElement)) {
@@ -54,7 +54,7 @@ function InfoPanelVideo(_ref2) {
54
54
  }, children, /*#__PURE__*/React.createElement("div", {
55
55
  className: "vreo-infoPanel-inner",
56
56
  ref: videoWrapperRef
57
- }, !isWX && /*#__PURE__*/React.createElement("video", {
57
+ }, !isIOSorWX && /*#__PURE__*/React.createElement("video", {
58
58
  playsInline: true,
59
59
  autoPlay: true,
60
60
  src: url
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realsee/vreo",
3
- "version": "2.2.0-alpha.0",
3
+ "version": "2.2.0-alpha.1",
4
4
  "description": "Vreo (VR Video 缩写) 是基于如视三维渲染引擎 Five 和 用户界面构建库 React 实现的如视 3D 空间剧本播放器。",
5
5
  "keywords": [
6
6
  "realsee",