@x-edu/live-player 0.0.16 → 0.0.17
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/dist/XEduLivePlayer.common.js +702 -683
- package/dist/XEduLivePlayerPre.common.js +197 -214
- package/package.json +1 -1
- package/src/detail/LiveStatus/AnchorOnTheWay.jsx +18 -8
- package/src/detail/LiveStatus/index.jsx +50 -34
- package/src/detail/LiveVideo/index.jsx +2 -0
- package/src/detail/RecordVideo/index.jsx +150 -148
- package/src/detail/hook/usePullSource.js +56 -24
- package/src/detail/index.jsx +13 -32
- package/src/util/object.js +1 -1
package/src/detail/index.jsx
CHANGED
|
@@ -11,10 +11,9 @@ import {
|
|
|
11
11
|
import { getIMLiveInfo, getGuestIMLiveInfo } from '@/service/imBroadcasts'
|
|
12
12
|
import Loading from '@/component/status/Loading'
|
|
13
13
|
import {
|
|
14
|
-
PUBLIC_LIVE_STATUS, PUBLIC_LIVE_MODE,
|
|
14
|
+
PUBLIC_LIVE_STATUS, PUBLIC_LIVE_MODE, SUB_TYPE
|
|
15
15
|
} from '@/config/publicLive'
|
|
16
16
|
import { getUrlQuery } from '@/util/url'
|
|
17
|
-
import ImPush from '@/util/push'
|
|
18
17
|
import { getRecordLiveStatus } from '@/util/live'
|
|
19
18
|
import { isEmpty } from '@/util/object'
|
|
20
19
|
// import IMChatroom from '@/component/IMChatroom'
|
|
@@ -79,7 +78,6 @@ export default function PublicLiveDetail({
|
|
|
79
78
|
const isLiveToReplay = !replay
|
|
80
79
|
const isStreamLive = liveInfo
|
|
81
80
|
&& liveInfo.type === PUBLIC_LIVE_MODE.LIVING
|
|
82
|
-
&& (liveInfo.sub_type === SUB_TYPE.OUTSIDE || liveInfo.sub_type === SUB_TYPE.REBROADCAST)
|
|
83
81
|
|
|
84
82
|
const handleStatusChange = async (status) => {
|
|
85
83
|
const newLiveInfo = {
|
|
@@ -90,7 +88,11 @@ export default function PublicLiveDetail({
|
|
|
90
88
|
onStateChange(newLiveInfo)
|
|
91
89
|
const isRecordLive = liveInfo.type === PUBLIC_LIVE_MODE.RECORDED
|
|
92
90
|
if (!isRecordLive
|
|
93
|
-
&&
|
|
91
|
+
&& [
|
|
92
|
+
PUBLIC_LIVE_STATUS.NOSTARTED,
|
|
93
|
+
PUBLIC_LIVE_STATUS.LIVEING,
|
|
94
|
+
PUBLIC_LIVE_STATUS.PASUED
|
|
95
|
+
].includes(status)
|
|
94
96
|
&& isEmpty(liveInfo.imInfo)
|
|
95
97
|
) {
|
|
96
98
|
const {
|
|
@@ -153,6 +155,9 @@ export default function PublicLiveDetail({
|
|
|
153
155
|
return
|
|
154
156
|
}
|
|
155
157
|
|
|
158
|
+
// 调试代码 模拟直播倒计时结束
|
|
159
|
+
// data.status = PUBLIC_LIVE_STATUS.NOSTARTED
|
|
160
|
+
|
|
156
161
|
const isRecordLive = data.type === PUBLIC_LIVE_MODE.RECORDED
|
|
157
162
|
const isNoStarted = data.status === PUBLIC_LIVE_STATUS.NOSTARTED
|
|
158
163
|
const isCompleted = data.status === PUBLIC_LIVE_STATUS.COMPLETEED
|
|
@@ -197,12 +202,6 @@ export default function PublicLiveDetail({
|
|
|
197
202
|
}
|
|
198
203
|
data.imInfo = imLiveInfoResp
|
|
199
204
|
}
|
|
200
|
-
// 推流直播不加载im push
|
|
201
|
-
if (data.type === PUBLIC_LIVE_MODE.LIVING && data.sub_type === SUB_TYPE.OUTSIDE) {
|
|
202
|
-
// nothing
|
|
203
|
-
} else {
|
|
204
|
-
await ImPush.init()
|
|
205
|
-
}
|
|
206
205
|
// 如果是转播或者是推流 直接播放(用于调试模式)
|
|
207
206
|
const { preview } = getUrlQuery() // 后台点预览会加这个参数
|
|
208
207
|
const generateInfo = preview ? Object.assign(data, {
|
|
@@ -213,27 +212,6 @@ export default function PublicLiveDetail({
|
|
|
213
212
|
init()
|
|
214
213
|
}, [])
|
|
215
214
|
|
|
216
|
-
useEffect(() => {
|
|
217
|
-
if (!liveInfo || liveInfo.sub_type === SUB_TYPE.OUTSIDE) {
|
|
218
|
-
return
|
|
219
|
-
}
|
|
220
|
-
const handler = (data) => {
|
|
221
|
-
const { extraFields = {} } = data
|
|
222
|
-
console.log('public Live:', data)
|
|
223
|
-
if (extraFields.event === PUBLIC_LIVE_PUSH_EVENT.STATUS_CHANGE && extraFields.liveId === liveId) {
|
|
224
|
-
console.log(`public Live: receive push status ${parseInt(extraFields.status, 10)}`)
|
|
225
|
-
handleStatusChange(parseInt(extraFields.status, 10))
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
ImPush.addTopicListener(`${PUBLIC_LIVE_PUSH_TOPIC}_${liveId}`, handler)
|
|
229
|
-
return () => {
|
|
230
|
-
if (!liveInfo || liveInfo.sub_type === SUB_TYPE.OUTSIDE) {
|
|
231
|
-
return
|
|
232
|
-
}
|
|
233
|
-
ImPush.removeTopicListener(`${PUBLIC_LIVE_PUSH_TOPIC}_${liveId}`, handler)
|
|
234
|
-
}
|
|
235
|
-
}, [!!liveInfo])
|
|
236
|
-
|
|
237
215
|
useEffect(() => {
|
|
238
216
|
if (userInfo) {
|
|
239
217
|
onReportProgress()
|
|
@@ -410,6 +388,7 @@ export default function PublicLiveDetail({
|
|
|
410
388
|
: isRecordLive
|
|
411
389
|
? (
|
|
412
390
|
<RecordVideo
|
|
391
|
+
isStreamLive={isStreamLive}
|
|
413
392
|
userInfo={userInfo}
|
|
414
393
|
liveInfo={liveInfo}
|
|
415
394
|
visitTime={visitTime}
|
|
@@ -426,6 +405,7 @@ export default function PublicLiveDetail({
|
|
|
426
405
|
)
|
|
427
406
|
: (
|
|
428
407
|
<LiveVideo
|
|
408
|
+
isStreamLive={isStreamLive}
|
|
429
409
|
handleLogin={handleLogin}
|
|
430
410
|
userInfo={userInfo}
|
|
431
411
|
liveInfo={liveInfo}
|
|
@@ -470,7 +450,8 @@ export default function PublicLiveDetail({
|
|
|
470
450
|
} */}
|
|
471
451
|
</div>
|
|
472
452
|
{
|
|
473
|
-
!isReplayMode && !isRecordLive
|
|
453
|
+
!isReplayMode && !isRecordLive
|
|
454
|
+
&& liveInfo.sub_type !== SUB_TYPE.NET_DRAGON
|
|
474
455
|
&& liveInfo.status !== PUBLIC_LIVE_STATUS.COMPLETEED
|
|
475
456
|
&& (
|
|
476
457
|
<LineSwitch
|
package/src/util/object.js
CHANGED