@conecli/cone-render 0.8.19 → 0.8.20-beta.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.
- package/README.md +7 -1
- package/dist/api/index.ts +1 -1
- package/dist/assets/icon_blue_info.svg +1 -0
- package/dist/common/const.ts +1 -1
- package/dist/common/environmentType.ts +1 -0
- package/dist/common/index.h5.ts +1 -1
- package/dist/common/index.jd.ts +1 -1
- package/dist/common/index.ts +1 -1
- package/dist/common/index.weapp.ts +1 -1
- package/dist/common/isvStorage/index.h5.ts +1 -0
- package/dist/common/isvStorage/index.ts +1 -0
- package/dist/common/jdplayerSdk.ts +1 -0
- package/dist/common/jssdk.ts +1 -0
- package/dist/common/pageType.ts +1 -0
- package/dist/common/sgmCustomCode.ts +1 -0
- package/dist/common/token/const.ts +1 -0
- package/dist/common/token/index.h5.ts +1 -0
- package/dist/common/token/index.ts +1 -0
- package/dist/common/token/token.jd.ts +1 -0
- package/dist/common/token/token.ts +1 -0
- package/dist/common/token/token.wxapp.ts +1 -0
- package/dist/common/wxappApi.jd.ts +1 -0
- package/dist/common/wxappApi.ts +1 -1
- package/dist/components/ErrorBoundary.tsx +1 -1
- package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
- package/dist/components/base/CommonFloorHead/index.tsx +1 -1
- package/dist/components/base/CountDown/index.module.scss +49 -44
- package/dist/components/base/CountDown/index.tsx +1 -1
- package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
- package/dist/components/base/CustomScrollView/index.module.scss +7 -0
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/CustomVideo/common.ts +1 -0
- package/dist/components/base/CustomVideo/const.ts +1 -0
- package/dist/components/base/CustomVideo/index.module.scss +40 -64
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +22 -2
- package/dist/components/base/Dialog/index.tsx +1 -1
- package/dist/components/base/Exposure/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/const.ts +1 -0
- package/dist/components/base/ExposureSmart/index.h5.module.scss +30 -6
- package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/index.module.scss +20 -9
- package/dist/components/base/ExposureSmart/index.tsx +1 -1
- package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
- package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
- package/dist/components/base/InViewRender/index.tsx +1 -1
- package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
- package/dist/components/base/ItemViewExposureSmart/index.module.scss +8 -0
- package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -0
- package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
- package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
- package/dist/components/base/LazyLoadImage/const.ts +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.module.scss +24 -20
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
- package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
- package/dist/components/base/NetworkDataError/const.ts +1 -1
- package/dist/components/base/NetworkDataError/index.module.scss +128 -69
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/base/Price/{const.ts → Base/const.ts} +0 -0
- package/dist/components/base/Price/Base/index.module.scss +148 -0
- package/dist/components/base/Price/Base/index.tsx +1 -0
- package/dist/components/base/Price/Double/index.module.scss +190 -0
- package/dist/components/base/Price/Double/index.tsx +1 -0
- package/dist/components/base/Price/index.tsx +1 -1
- package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
- package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
- package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
- package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
- package/dist/components/base/Skeleton/index.tsx +1 -1
- package/dist/components/debug/DebugLayout/index.module.scss +67 -0
- package/dist/components/debug/DebugLayout/index.tsx +1 -0
- package/dist/components/debug/DebugLayout/utils.ts +1 -0
- package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
- package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
- package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
- package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
- package/dist/components/floorItem.jd.tsx +1 -0
- package/dist/components/floorItem.tsx +1 -1
- package/dist/components/floorItem.weapp.tsx +1 -1
- package/dist/components/isv/Floor/index.tsx +1 -1
- package/dist/components/remoteFloorItem.tsx +1 -0
- package/dist/interface/common.ts +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/interface/jumpEventReport.ts +1 -1
- package/dist/interface/service.ts +1 -1
- package/dist/interface/utils.ts +1 -1
- package/dist/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/const.ts +1 -1
- package/dist/jumpEventReport/createReportFloorData.ts +1 -1
- package/dist/jumpEventReport/index.h5.ts +1 -1
- package/dist/jumpEventReport/index.jd.ts +1 -1
- package/dist/jumpEventReport/index.ts +1 -1
- package/dist/jumpEventReport/index.weapp.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/logEventConfig.ts +1 -1
- package/dist/jumpEventReport/web/report.ts +1 -1
- package/dist/jumpEventReport/web.base.ts +1 -1
- package/dist/jumpEventReport/web.jd.ts +1 -1
- package/dist/jumpEventReport/web.jdb.ts +1 -0
- package/dist/jumpEventReport/web.jdjch.ts +1 -0
- package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
- package/dist/jumpEventReport/web.pc.ts +1 -0
- package/dist/jumpEventReport/web.tjapp.ts +1 -0
- package/dist/jumpEventReport/web.tjm.ts +1 -0
- package/dist/jumpEventReport/web.wxapp.ts +1 -1
- package/dist/language/en_US.json +231 -0
- package/dist/language/zh_CN.json +231 -0
- package/dist/language/zh_HK.json +231 -0
- package/dist/libs/taroAppReport.js +2 -2
- package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -27
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/modules/ContainerFloorList/index.tsx +1 -1
- package/dist/open/api/device.ts +1 -1
- package/dist/open/api/environment.ts +1 -1
- package/dist/open/api/index.ts +1 -1
- package/dist/open/api/jump/business.ts +1 -0
- package/dist/open/api/jump/index.ts +1 -0
- package/dist/open/api/jump/minPath.ts +1 -0
- package/dist/open/api/jump/side.ts +1 -0
- package/dist/open/api/jump/webUrl.ts +1 -0
- package/dist/open/api/jump copy.ts +1 -0
- package/dist/open/api/moduleUtil.ts +1 -1
- package/dist/open/api/request.ts +1 -0
- package/dist/open/api/shopMember.ts +1 -0
- package/dist/open/api/track.ts +1 -1
- package/dist/open/api/userToken.ts +1 -0
- package/dist/open/api/util.ts +1 -1
- package/dist/open/components/index.ts +1 -1
- package/dist/sass/app.h5.scss +294 -212
- package/dist/sass/base.scss +195 -137
- package/dist/service/bMallConst.ts +1 -0
- package/dist/service/bMallConst.weapp.ts +1 -0
- package/dist/service/fetchGateway.ts +1 -0
- package/dist/service/fetchGateway.weapp.ts +1 -0
- package/dist/service/fetchJsonp.ts +1 -0
- package/dist/service/http/colorSign.ts +1 -0
- package/dist/service/http/colorSign.weapp.ts +1 -0
- package/dist/service/http/const.ts +1 -0
- package/dist/service/http/h5Http.ts +1 -0
- package/dist/service/http/http.ts +1 -0
- package/dist/service/http/httpInterceptors.jd.ts +1 -0
- package/dist/service/http/httpInterceptors.ts +1 -0
- package/dist/service/http/index.h5.ts +1 -0
- package/dist/service/http/index.ts +1 -0
- package/dist/service/requestServer.h5.ts +1 -0
- package/dist/service/requestServer.ts +1 -0
- package/dist/service/requestServer.weapp.ts +1 -0
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
- package/dist/utils/draExceptionAndProfile.ts +1 -1
- package/dist/utils/h5Utils.ts +1 -1
- package/dist/utils/index.h5.ts +1 -1
- package/dist/utils/index.ts +1 -1
- package/dist/utils/index.weapp.ts +1 -1
- package/dist/utils/intersectionObserver.ts +1 -1
- package/dist/utils/jm-common.js +1 -1
- package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
- package/dist/utils/jumpExtMapUtil.ts +1 -0
- package/dist/utils/priceUtils.js +1 -0
- package/dist/utils/ready.ts +1 -0
- package/dist/utils/sColor.js +1 -0
- package/dist/utils/sgmCodeUtils.ts +1 -0
- package/dist/utils/taroRenderUtil.ts +1 -0
- package/dist/utils/utils.ts +1 -1
- package/dist/wxapp/api/helper.js +1 -0
- package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
- package/dist/wxapp/common/user_info.js +1 -1
- package/dist/wxapp/components/launch-app/index.js +1 -0
- package/dist/wxapp/components/launch-app/index.json +5 -0
- package/dist/wxapp/components/launch-app/index.wxml +0 -0
- package/dist/wxapp/components/launch-app/index.wxss +0 -0
- package/dist/wxapp/components/subscribe-guider/helper.js +1 -0
- package/dist/wxapp/components/subscribe-guider/index.js +1 -0
- package/dist/wxapp/components/subscribe-guider/index.json +5 -0
- package/dist/wxapp/components/subscribe-guider/index.wxml +0 -0
- package/dist/wxapp/components/subscribe-guider/index.wxss +0 -0
- package/package.json +145 -114
- package/dist/components/base/Price/index.module.scss +0 -136
- package/dist/components/base/Skeleton/old.tsx +0 -1
- package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
- package/dist/open/api/jump.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
1
|
if (!isH5 || !ref.current) return
|
|
3
2
|
playVideo()
|
|
4
3
|
manualPauseStateRef.current = false
|
|
5
4
|
}
|
|
6
5
|
if (!isH5 || !ref.current) return
|
|
7
6
|
pauseVideo()
|
|
8
7
|
manualPauseStateRef.current = true
|
|
9
8
|
}
|
|
10
9
|
if (!isH5 || !ref.current) return
|
|
11
10
|
}, [])
|
|
11
|
+
import Taro from '@tarojs/taro';
|
|
12
12
|
isH5,
|
|
13
13
|
addHttps,
|
|
14
14
|
isH5AndJdShopView,
|
|
15
15
|
draBusinessCustomReport,
|
|
16
16
|
isJdAndIosDevice,
|
|
17
17
|
const {
|
|
18
18
|
isSystemVideo,
|
|
19
19
|
floorData,
|
|
20
20
|
style,
|
|
21
21
|
videoStyle,
|
|
22
22
|
src,
|
|
23
23
|
width,
|
|
24
24
|
height,
|
|
25
25
|
controls,
|
|
26
26
|
id,
|
|
27
27
|
poster,
|
|
28
28
|
autoplay: isvAutoplay,
|
|
29
29
|
loop,
|
|
30
30
|
showMuteBtn: isvShowMuteBtn,
|
|
31
31
|
muteButtonPostion,
|
|
32
32
|
showFullscreenBtn,
|
|
33
33
|
muteBtnPicSrcObj,
|
|
34
34
|
muteBtnClassName,
|
|
35
35
|
muteBtnStyle,
|
|
36
36
|
objectFit,
|
|
37
37
|
mockAutoplay,
|
|
38
38
|
threshold = 0.6,
|
|
39
39
|
onPlayCallback,
|
|
40
40
|
onPauseCallback,
|
|
41
41
|
onVideoApiCall,
|
|
42
42
|
inViewCallback,
|
|
43
43
|
outViewCallback,
|
|
44
44
|
} = props;
|
|
45
45
|
const { wifiVideoAutoPlay } = global.info.sysInfo;
|
|
46
46
|
const isFollowAppVideoPlayStatus = global.getDynamicConfig('isFollowAppVideoPlayStatus');
|
|
47
47
|
let showMuteBtn = isvShowMuteBtn;
|
|
48
48
|
let autoplay = isvAutoplay;
|
|
49
49
|
if (isSystemVideo) {
|
|
50
50
|
showMuteBtn = false;
|
|
51
51
|
autoplay = wifiVideoAutoPlay;
|
|
52
52
|
} else {
|
|
53
53
|
if (isvAutoplay && isFollowAppVideoPlayStatus) {
|
|
54
54
|
autoplay = wifiVideoAutoPlay;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
console.log(
|
|
58
58
|
'CustomVideo',
|
|
59
59
|
'isSystemVideo:',
|
|
60
60
|
isSystemVideo,
|
|
61
61
|
'wifiVideoAutoPlay:',
|
|
62
62
|
wifiVideoAutoPlay,
|
|
63
63
|
',isvAutoplay:',
|
|
64
64
|
isvAutoplay,
|
|
65
65
|
',isFollowAppVideoPlayStatus:',
|
|
66
66
|
isFollowAppVideoPlayStatus,
|
|
67
67
|
',autoplay:',
|
|
68
68
|
autoplay,
|
|
69
69
|
',id:',
|
|
70
70
|
id,
|
|
71
71
|
);
|
|
72
72
|
const [videoMutedState, setVideoMutedState] = useState(MUTED);
|
|
73
73
|
const lastPlayStatusRef = useRef(-1);
|
|
74
74
|
const manualPauseStateRef = useRef(false);
|
|
75
75
|
const initPlayStatusRef = useRef(false);
|
|
76
76
|
const isInViewStateRef = useRef(false);
|
|
77
77
|
const disposeRef = useRef<Function | null>();
|
|
78
78
|
const initFloorIndexRef = useRef(-1);
|
|
79
79
|
ref === null && (ref = useRef<HTMLVideoElement | null>());
|
|
80
80
|
|
|
81
81
|
const playVideo = useCallback(() => {
|
|
82
82
|
if (ref && ref.current) {
|
|
83
83
|
console.log(`CustomVideo id:${id} 开始播放视频`);
|
|
84
84
|
const result = ref.current.play();
|
|
85
85
|
result &&
|
|
86
86
|
result
|
|
87
87
|
.then(() => {
|
|
88
88
|
console.log(`播放视频成功`);
|
|
89
89
|
})
|
|
90
90
|
.catch((e) => {
|
|
91
91
|
console.log('CustomVideo playVideo ', e.name, ':', e.message);
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
}, []);
|
|
95
95
|
|
|
96
96
|
const pauseVideo = useCallback(() => {
|
|
97
97
|
if (ref && ref.current) {
|
|
98
98
|
console.log(`CustomVideo id:${id} 暂停视频`);
|
|
99
99
|
ref.current.pause();
|
|
100
100
|
}
|
|
101
101
|
}, []);
|
|
102
102
|
|
|
103
103
|
const handleIosFirstScreenVideoPause = useCallback(() => {
|
|
104
104
|
const floorIndex = initFloorIndexRef.current;
|
|
105
105
|
if (ref.current && floorIndex >= 0 && floorIndex < 4) {
|
|
106
106
|
ref.current.setAttribute('data-init-pause', true);
|
|
107
107
|
if (!ref.current.paused) {
|
|
108
108
|
ref.current.pause();
|
|
109
109
|
} else {
|
|
110
110
|
setTimeout(() => {
|
|
111
111
|
!ref.current.paused && ref.current.pause();
|
|
112
112
|
}, 1500);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}, []);
|
|
116
116
|
|
|
117
117
|
useEffect(() => {
|
|
118
118
|
isJdAndIosDevice &&
|
|
119
119
|
autoplay &&
|
|
120
120
|
mockAutoplay &&
|
|
121
121
|
Taro.eventCenter.on(TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE_INIT_NOW_TIME, (res) => {
|
|
122
122
|
console.log('app初始化可见性变化=>', res, '如果是0,表示不可见');
|
|
123
123
|
res === 0 && handleIosFirstScreenVideoPause();
|
|
124
124
|
});
|
|
125
125
|
}, []);
|
|
126
126
|
|
|
127
127
|
useEffect(() => {
|
|
128
128
|
if (!isH5 || !ref.current) return;
|
|
129
129
|
if (floorData && floorData.hasOwnProperty('containerIndex')) {
|
|
130
130
|
initFloorIndexRef.current = floorData.containerIndex;
|
|
131
131
|
} else {
|
|
132
132
|
const containerNode = ref.current.closest('[data-container-id]');
|
|
133
133
|
if (containerNode) {
|
|
134
134
|
initFloorIndexRef.current = Number(containerNode.getAttribute('data-container-index'));
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
if (autoplay && mockAutoplay) {
|
|
138
138
|
|
|
139
139
|
const callInitAutoplay = () => {
|
|
140
140
|
console.log(`CustomVideo id:${id} 触发初始化autoplay callInitAutoplay`);
|
|
141
141
|
if (
|
|
142
142
|
autoplay &&
|
|
143
143
|
mockAutoplay &&
|
|
144
144
|
!initPlayStatusRef.current &&
|
|
145
145
|
isInViewStateRef.current &&
|
|
146
146
|
ref.current.paused
|
|
147
147
|
) {
|
|
148
148
|
playVideo();
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
const onWeixinJSBridgeReady = (e) => {
|
|
152
152
|
callInitAutoplay();
|
|
153
153
|
};
|
|
154
154
|
const onTouchstart = (e) => {
|
|
155
155
|
callInitAutoplay();
|
|
156
156
|
};
|
|
157
157
|
const onScroll = (e) => {
|
|
158
158
|
callInitAutoplay();
|
|
159
159
|
};
|
|
160
160
|
const onPlay = (e) => {
|
|
161
161
|
if (!initPlayStatusRef.current) {
|
|
162
162
|
const dispose = disposeRef.current;
|
|
163
163
|
dispose && dispose();
|
|
164
164
|
disposeRef.current = null;
|
|
165
165
|
}
|
|
166
166
|
initPlayStatusRef.current = true;
|
|
167
167
|
};
|
|
168
168
|
document?.addEventListener('WeixinJSBridgeReady', onWeixinJSBridgeReady);
|
|
169
169
|
document?.addEventListener('touchstart', onTouchstart);
|
|
170
170
|
document?.addEventListener('scroll', onScroll);
|
|
171
171
|
ref.current.addEventListener('play', onPlay);
|
|
172
172
|
const dispose = () => {
|
|
173
173
|
console.log('调用dispose');
|
|
174
174
|
document?.removeEventListener('WeixinJSBridgeReady', onWeixinJSBridgeReady);
|
|
175
175
|
document?.removeEventListener('touchstart', onTouchstart);
|
|
176
176
|
document?.removeEventListener('scroll', onScroll);
|
|
177
177
|
ref?.current?.removeEventListener('play', onPlay);
|
|
178
178
|
};
|
|
179
179
|
disposeRef.current = dispose;
|
|
180
180
|
}
|
|
181
181
|
const handleVideoPlayApiCall = () => {
|
|
182
182
|
if (!isH5 || !ref.current) return;
|
|
183
183
|
playVideo();
|
|
184
184
|
manualPauseStateRef.current = false;
|
|
185
185
|
};
|
|
186
186
|
const handleVideoPauseApiCall = () => {
|
|
187
187
|
if (!isH5 || !ref.current) return;
|
|
188
188
|
manualPauseStateRef.current = true;
|
|
189
189
|
pauseVideo();
|
|
190
190
|
};
|
|
191
191
|
|
|
192
192
|
const handleVideoSeekApiCall = (position: number) => {
|
|
193
193
|
if (!isH5 || !ref.current) return;
|
|
194
194
|
if (typeof position === 'undefined' || typeof position !== 'number') return;
|
|
195
195
|
ref.current.currentTime = position;
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
if (onVideoApiCall) {
|
|
199
199
|
onVideoApiCall({
|
|
200
200
|
play: handleVideoPlayApiCall,
|
|
201
201
|
pause: handleVideoPauseApiCall,
|
|
202
202
|
seek: handleVideoSeekApiCall,
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
return () => {
|
|
206
206
|
const dispose = disposeRef.current;
|
|
207
207
|
dispose && dispose();
|
|
208
208
|
disposeRef.current = null;
|
|
209
209
|
};
|
|
210
210
|
}, []);
|
|
211
211
|
|
|
212
212
|
const handleMuted = useCallback(() => {
|
|
213
213
|
if (!isH5 || !ref.current) return;
|
|
214
214
|
const handleMutedState = ref.current.muted;
|
|
215
215
|
if (handleMutedState === true) {
|
|
216
216
|
ref.current.muted = false;
|
|
217
217
|
setVideoMutedState(false);
|
|
218
218
|
} else {
|
|
219
219
|
ref.current.muted = true;
|
|
220
220
|
setVideoMutedState(true);
|
|
221
221
|
}
|
|
222
222
|
}, [videoMutedState]);
|
|
223
223
|
|
|
224
224
|
const handleVideoInViewCallback = useCallback(() => {
|
|
225
225
|
if (!isH5 || !ref.current) return;
|
|
226
226
|
console.log(
|
|
227
227
|
`
|
|
228
228
|
)} CustomVideo handleVideoInViewCallback id:${id} 进入可视区域 lastPlayStatusRef.current:${lastPlayStatusRef.current},paused:${ref.current.paused}`,
|
|
229
229
|
);
|
|
230
230
|
isInViewStateRef.current = true;
|
|
231
231
|
if (
|
|
232
232
|
autoplay &&
|
|
233
233
|
((mockAutoplay && !initPlayStatusRef.current) || lastPlayStatusRef.current === -1) &&
|
|
234
234
|
ref.current.paused
|
|
235
235
|
) {
|
|
236
236
|
console.log(`CustomVideo id:${id} 首次进入可视区域`);
|
|
237
237
|
playVideo();
|
|
238
238
|
} else if (lastPlayStatusRef.current === 1 && ref.current.paused) {
|
|
239
239
|
console.log(`CustomVideo id:${id} 非首次进入可视区域`);
|
|
240
240
|
playVideo();
|
|
241
241
|
}
|
|
242
242
|
typeof inViewCallback === 'function' && inViewCallback();
|
|
243
243
|
}, []);
|
|
244
244
|
|
|
245
245
|
const handleVideoOutViewCallback = useCallback(() => {
|
|
246
246
|
if (!isH5 || !ref.current) return;
|
|
247
247
|
isInViewStateRef.current = false;
|
|
248
248
|
console.log(
|
|
249
249
|
`CustomVideo handleVideoOutViewCallback id:${id} 不在可视区域,视频暂停,lastPlayStatusRef:${lastPlayStatusRef.current}`,
|
|
250
250
|
);
|
|
251
251
|
pauseVideo();
|
|
252
252
|
typeof outViewCallback === 'function' && outViewCallback();
|
|
253
253
|
}, []);
|
|
254
254
|
|
|
255
255
|
const getVideoWidthAndHeightStyle = () => {
|
|
256
256
|
const style = {};
|
|
257
257
|
width && (style['width'] = width);
|
|
258
258
|
height && (style['height'] = height);
|
|
259
259
|
return style;
|
|
260
260
|
};
|
|
261
261
|
|
|
262
262
|
const getMuteBtnBackgroundImageStyle = useCallback(() => {
|
|
263
263
|
const isMutedPicSrc = muteBtnPicSrcObj?.IS_MUTED;
|
|
264
264
|
const notMutedPicSrc = muteBtnPicSrcObj?.NOT_MUTED;
|
|
265
265
|
const finalIsMutedPicSrc =
|
|
266
266
|
typeof isMutedPicSrc !== 'undefined' && isMutedPicSrc !== ''
|
|
267
267
|
? isMutedPicSrc
|
|
268
268
|
: DEFAULT_MUTE_BTN_PIC.IS_MUTED;
|
|
269
269
|
const finalNotMutedPicSrc =
|
|
270
270
|
typeof notMutedPicSrc !== 'undefined' && notMutedPicSrc !== ''
|
|
271
271
|
? notMutedPicSrc
|
|
272
272
|
: DEFAULT_MUTE_BTN_PIC.NOT_MUTED;
|
|
273
273
|
return {
|
|
274
274
|
backgroundImage: `url(${videoMutedState ? finalIsMutedPicSrc : finalNotMutedPicSrc})`,
|
|
275
275
|
};
|
|
276
276
|
}, [videoMutedState]);
|
|
277
277
|
return src ? (
|
|
278
278
|
<InOrOutViewObserver
|
|
279
279
|
inViewCallback={handleVideoInViewCallback}
|
|
280
280
|
outViewCallback={handleVideoOutViewCallback}
|
|
281
281
|
threshold={threshold}
|
|
282
282
|
>
|
|
283
283
|
{isH5 ? (
|
|
284
284
|
<View
|
|
285
285
|
className={customVideoStyle['d-video-wrap']}
|
|
286
286
|
style={{ ...style, ...getVideoWidthAndHeightStyle() }}
|
|
287
287
|
>
|
|
288
288
|
<video
|
|
289
289
|
style={{ ...videoStyle }}
|
|
290
290
|
className={classNames(customVideoStyle['d-video-play'], {
|
|
291
291
|
'd-video-forbid-fullscreen-button': isSystemVideo,
|
|
292
292
|
})}
|
|
293
293
|
id={id}
|
|
294
294
|
data-jd-video={true}
|
|
295
295
|
src={src}
|
|
296
296
|
controls={controls}
|
|
297
297
|
poster={poster ? addHttps(poster) : ''}
|
|
298
298
|
ref={ref}
|
|
299
299
|
loop={loop}
|
|
300
300
|
autoPlay={autoplay}
|
|
301
301
|
muted={MUTED}
|
|
302
302
|
x5-playsinline="true"
|
|
303
303
|
playsInline
|
|
304
304
|
webkit-playsinline="true"
|
|
305
305
|
controlsList={isH5AndJdShopView ? 'nodownload nofullscreen noremoteplayback' : ''}
|
|
306
306
|
onError={(e) => {
|
|
307
307
|
const errMsg = formatVedioErrorMsg(e.target?.error);
|
|
308
308
|
const data = {
|
|
309
309
|
type: 'video',
|
|
310
310
|
subType: 'CustomVideo',
|
|
311
311
|
isSystemVideo,
|
|
312
312
|
src,
|
|
313
313
|
autoplay,
|
|
314
314
|
errMsg,
|
|
315
315
|
isH5,
|
|
316
316
|
};
|
|
317
317
|
console.log('CustomVideo error 1:', data);
|
|
318
318
|
draBusinessCustomReport(data);
|
|
319
319
|
}}
|
|
320
320
|
onPlay={(e) => {
|
|
321
321
|
lastPlayStatusRef.current = 1;
|
|
322
322
|
onPlayCallback && onPlayCallback(e);
|
|
323
323
|
}}
|
|
324
324
|
onPause={(e) => {
|
|
325
325
|
if (isInViewStateRef.current) {
|
|
326
326
|
lastPlayStatusRef.current = 0;
|
|
327
327
|
}
|
|
328
328
|
onPauseCallback && onPauseCallback(e);
|
|
329
329
|
}}
|
|
330
330
|
/>
|
|
331
331
|
{!controls && showMuteBtn && (
|
|
332
332
|
<View
|
|
333
333
|
className={classNames(
|
|
334
334
|
customVideoStyle['d-video-mute-btn'],
|
|
335
335
|
customVideoStyle[`d-mute-btn-${muteButtonPostion}`],
|
|
336
336
|
`${muteBtnClassName}`,
|
|
337
337
|
)}
|
|
338
338
|
style={{ ...getMuteBtnBackgroundImageStyle(), ...muteBtnStyle }}
|
|
339
339
|
onClick={handleMuted}
|
|
340
340
|
></View>
|
|
341
341
|
)}
|
|
342
342
|
</View>
|
|
343
343
|
) : (
|
|
344
344
|
<Video
|
|
345
345
|
style={{ ...videoStyle }}
|
|
346
346
|
ref={ref}
|
|
347
347
|
className={customVideoStyle['d-video-play']}
|
|
348
348
|
src={src}
|
|
349
349
|
id={id}
|
|
350
350
|
controls={controls}
|
|
351
351
|
poster={poster ? addHttps(poster) : ''}
|
|
352
352
|
loop={loop}
|
|
353
353
|
data-jd-video={true}
|
|
354
354
|
autoplay={autoplay}
|
|
355
355
|
muted={MUTED}
|
|
356
356
|
showMuteBtn={showMuteBtn}
|
|
357
357
|
showFullscreenBtn={showFullscreenBtn}
|
|
358
358
|
objectFit={objectFit}
|
|
359
359
|
onError={(e) => {
|
|
360
360
|
const errMsg = formatVedioErrorMsg(e.target?.error);
|
|
361
361
|
const data = {
|
|
362
362
|
type: 'video',
|
|
363
363
|
subType: 'CustomVideo',
|
|
364
364
|
isSystemVideo,
|
|
365
365
|
src,
|
|
366
366
|
autoplay,
|
|
367
367
|
errMsg,
|
|
368
368
|
isH5,
|
|
369
369
|
};
|
|
370
370
|
console.log('CustomVideo error 2:', data);
|
|
371
371
|
draBusinessCustomReport(data);
|
|
372
372
|
}}
|
|
373
373
|
onPlay={(e) => {
|
|
374
374
|
lastPlayStatusRef.current = 1;
|
|
375
375
|
onPlayCallback && onPlayCallback(e);
|
|
376
376
|
}}
|
|
377
377
|
onPause={(e) => {
|
|
378
378
|
if (isInViewStateRef.current) {
|
|
379
379
|
lastPlayStatusRef.current = 0;
|
|
380
380
|
}
|
|
381
381
|
onPauseCallback && onPauseCallback(e);
|
|
382
382
|
}}
|
|
383
383
|
/>
|
|
384
384
|
)}
|
|
385
385
|
</InOrOutViewObserver>
|
|
386
386
|
) : null;
|
|
387
387
|
return process.env.BUILD_TYPE !== BUILD_TYPE.DECORATE;
|
|
388
388
|
isSystemVideo: false,
|
|
389
389
|
id: '',
|
|
390
390
|
style: {},
|
|
391
391
|
videoStyle: {},
|
|
392
392
|
className: '',
|
|
393
393
|
src: '',
|
|
394
394
|
width: '100%',
|
|
395
395
|
height: '100%',
|
|
396
396
|
controls: false,
|
|
397
397
|
poster: '',
|
|
398
398
|
autoplay: true,
|
|
399
399
|
mockAutoplay: getDefaultMockAutoplay(),
|
|
400
400
|
loop: true,
|
|
401
401
|
showMuteBtn: true,
|
|
402
402
|
muteButtonPostion: 'topLeft',
|
|
403
403
|
muteBtnPicSrcObj: DEFAULT_MUTE_BTN_PIC,
|
|
404
404
|
muteBtnClassName: '',
|
|
405
405
|
muteBtnStyle: {},
|
|
406
406
|
showFullscreenBtn: false,
|
|
407
407
|
objectFit: 'cover',
|
|
408
408
|
threshold: 0.6,
|
|
@@ -8,12 +8,17 @@
|
|
|
8
8
|
background: rgba(0, 0, 0, 0.5);
|
|
9
9
|
z-index: 222;
|
|
10
10
|
.d-dialog-wrap {
|
|
11
|
+
position: relative;
|
|
11
12
|
width: 100%;
|
|
12
13
|
height: 100%;
|
|
13
14
|
opacity: 0.01;
|
|
14
15
|
transform: scale(0);
|
|
15
16
|
animation: zoomIn 300ms;
|
|
16
17
|
animation-fill-mode: forwards;
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
&.d-dialog-jdapp-wrap{
|
|
20
|
+
padding-bottom: 80px;
|
|
21
|
+
}
|
|
17
22
|
}
|
|
18
23
|
.d-dialog-content {
|
|
19
24
|
padding-top: 30px;
|
|
@@ -40,6 +45,7 @@
|
|
|
40
45
|
.d-dialog-footer {
|
|
41
46
|
.d-dialog-btn {
|
|
42
47
|
position: relative;
|
|
48
|
+
margin: 0;
|
|
43
49
|
display: block;
|
|
44
50
|
height: 88px;
|
|
45
51
|
line-height: 88px;
|
|
@@ -50,6 +56,8 @@
|
|
|
50
56
|
text-overflow: ellipsis;
|
|
51
57
|
white-space: nowrap;
|
|
52
58
|
box-sizing: border-box;
|
|
59
|
+
background-color: #fff;
|
|
60
|
+
border-radius: 0;
|
|
53
61
|
&:after {
|
|
54
62
|
content: '';
|
|
55
63
|
display: block;
|
|
@@ -62,6 +70,8 @@
|
|
|
62
70
|
-ms-transform: scaleX(0.5);
|
|
63
71
|
transform: scaleY(0.5);
|
|
64
72
|
pointer-events: none;
|
|
73
|
+
border: none;
|
|
74
|
+
border-radius: 0;
|
|
65
75
|
}
|
|
66
76
|
}
|
|
67
77
|
.d-dialog-ensure-btn {
|
|
@@ -81,8 +91,7 @@
|
|
|
81
91
|
}
|
|
82
92
|
}
|
|
83
93
|
.d-dialog-cancel-btn {
|
|
84
|
-
|
|
85
|
-
color: #000000;
|
|
94
|
+
color: #000;
|
|
86
95
|
}
|
|
87
96
|
}
|
|
88
97
|
}
|
|
@@ -110,3 +119,14 @@
|
|
|
110
119
|
transform: scale3d(1, 1, 1);
|
|
111
120
|
}
|
|
112
121
|
}
|
|
122
|
+
:global{
|
|
123
|
+
.d-shop-pad{
|
|
124
|
+
:local{
|
|
125
|
+
|
|
126
|
+
.d-dialog-content{
|
|
127
|
+
max-width: 520PX;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
}
|