@realsee/vreo 2.3.1 → 2.3.2
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.
|
@@ -21,15 +21,17 @@ var isWX = navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1;
|
|
|
21
21
|
var isIOS = navigator.userAgent.toLowerCase().indexOf('iphone') !== -1;
|
|
22
22
|
var isIOSorWX = isIOS || isWX;
|
|
23
23
|
var videoElement = document.createElement('video');
|
|
24
|
+
videoElement.setAttribute('playsinline', 'true');
|
|
25
|
+
videoElement.setAttribute('webkit-playsinline', 'true');
|
|
24
26
|
|
|
25
27
|
if (isIOSorWX) {
|
|
26
|
-
videoElement.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
28
|
+
if (videoElement.paused) {
|
|
29
|
+
document.body.addEventListener('click', function () {
|
|
30
|
+
return videoElement.play();
|
|
31
|
+
}, {
|
|
32
|
+
once: true
|
|
33
|
+
});
|
|
34
|
+
}
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
function InfoPanelImg(_ref) {
|
|
@@ -49,7 +51,7 @@ function InfoPanelVideo(_ref2) {
|
|
|
49
51
|
children = _ref2.children;
|
|
50
52
|
var videoWrapperRef = React.useRef(null);
|
|
51
53
|
React.useEffect(function () {
|
|
52
|
-
if (!isIOSorWX) return
|
|
54
|
+
// if (!isIOSorWX) return
|
|
53
55
|
if (!videoWrapperRef.current) return;
|
|
54
56
|
videoElement.src = url;
|
|
55
57
|
|
|
@@ -57,7 +59,26 @@ function InfoPanelVideo(_ref2) {
|
|
|
57
59
|
videoWrapperRef.current.appendChild(videoElement);
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
|
|
62
|
+
var canplaythrough = function canplaythrough() {
|
|
63
|
+
videoElement.removeEventListener('canplaythrough', canplaythrough);
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
videoElement.play();
|
|
67
|
+
} catch (error) {}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
videoElement.addEventListener('canplaythrough', canplaythrough);
|
|
71
|
+
videoElement.load(); // videoElement.play()
|
|
72
|
+
|
|
73
|
+
return function () {
|
|
74
|
+
var _videoWrapperRef$curr;
|
|
75
|
+
|
|
76
|
+
videoElement.pause();
|
|
77
|
+
|
|
78
|
+
if ((_videoWrapperRef$curr = videoWrapperRef.current) !== null && _videoWrapperRef$curr !== void 0 && _videoWrapperRef$curr.contains(videoElement)) {
|
|
79
|
+
videoWrapperRef.current.removeChild(videoElement);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
61
82
|
}, [videoWrapperRef.current]);
|
|
62
83
|
return /*#__PURE__*/React.createElement("div", {
|
|
63
84
|
className: "vreo-infoPanel-container"
|
|
@@ -66,11 +87,7 @@ function InfoPanelVideo(_ref2) {
|
|
|
66
87
|
}, children, /*#__PURE__*/React.createElement("div", {
|
|
67
88
|
className: "vreo-infoPanel-inner",
|
|
68
89
|
ref: videoWrapperRef
|
|
69
|
-
}
|
|
70
|
-
playsInline: true,
|
|
71
|
-
autoPlay: true,
|
|
72
|
-
src: url
|
|
73
|
-
}))));
|
|
90
|
+
})));
|
|
74
91
|
}
|
|
75
92
|
|
|
76
93
|
var Title = function Title(props) {
|
package/package.json
CHANGED
package/stylesheets/default.css
CHANGED
|
@@ -749,6 +749,9 @@
|
|
|
749
749
|
|
|
750
750
|
.vreo-infoPanel-inner {
|
|
751
751
|
position: relative;
|
|
752
|
+
display: flex;
|
|
753
|
+
justify-content: center;
|
|
754
|
+
align-items: center;
|
|
752
755
|
width: 100%;
|
|
753
756
|
height: 100%;
|
|
754
757
|
}
|
|
@@ -756,8 +759,8 @@
|
|
|
756
759
|
.vreo-infoPanel video,
|
|
757
760
|
.vreo-infoPanel img {
|
|
758
761
|
display: block;
|
|
759
|
-
width: 100%;
|
|
760
|
-
height: 100%;
|
|
762
|
+
max-width: 100%;
|
|
763
|
+
max-height: 100%;
|
|
761
764
|
object-fit: contain;
|
|
762
765
|
border-radius: 4px;
|
|
763
766
|
overflow: hidden;
|