@x-edu/live-player 0.0.2 → 0.0.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@x-edu/live-player",
3
- "version": "0.0.2",
4
- "main": "dist/cjs/XEduLivePlayer.umd.min.js",
3
+ "version": "0.0.3",
4
+ "main": "dist/XEduLivePlayer.common.js",
5
5
  "scripts": {
6
6
  "start": "cross-env SDP_ENV=local gms dev",
7
7
  "start:test": "cross-env SDP_ENV=test gms dev",
package/src/App.jsx CHANGED
@@ -7,6 +7,7 @@ import isSameOrBefore from 'dayjs/plugin/isSameOrBefore'
7
7
  import { parseAdapter } from '@/util/date'
8
8
 
9
9
  import PublicLiveDetail from './detail'
10
+ import { getLiveOnlineCount } from './lib/getLiveOnlineCount'
10
11
 
11
12
  Icon.url = '/fish/icon/umd-4.1.2.js'
12
13
 
@@ -15,4 +16,7 @@ dayjs.extend(isSameOrBefore)
15
16
  dayjs.extend(parseAdapter)
16
17
  dayjs.locale('zh-cn')
17
18
 
18
- export default PublicLiveDetail
19
+ export default {
20
+ PublicLiveDetail,
21
+ getLiveOnlineCount
22
+ }
@@ -50,10 +50,7 @@ export default function PublicLiveDetail({
50
50
  onStateChange = () => {},
51
51
  onReportProgress = () => {},
52
52
  onReportTeacherTrain = () => {},
53
- onSensorsPublicLiveDetailFullscreenClick = () => {},
54
- onSensorsPublicLiveDetailPage = () => {},
55
- onSensorsPublicLiveDetailPlayClick = () => {},
56
- onSensorsPublicLiveDetailReplayClick = () => {}
53
+ onSendSensors = () => {}
57
54
  }) {
58
55
  setUC(uc, loginInfo?.userInfo)
59
56
  if (propSdpAppId) {
@@ -243,7 +240,7 @@ export default function PublicLiveDetail({
243
240
 
244
241
  useEffect(() => {
245
242
  if (loginStatus !== LOGIN_STATUS.WAIT && liveInfo) {
246
- onSensorsPublicLiveDetailPage({
243
+ onSendSensors({
247
244
  pageName: TrackPageName,
248
245
  eventName: 'TCH_webPlatform_publiclive_detail_page',
249
246
  params: {
@@ -274,7 +271,7 @@ export default function PublicLiveDetail({
274
271
 
275
272
  const handlePlayReplay = (needReport) => {
276
273
  if (needReport) {
277
- onSensorsPublicLiveDetailReplayClick({
274
+ onSendSensors({
278
275
  pageName: TrackPageName,
279
276
  eventName: 'TCH_webPlatform_publiclive_detail_replay_click',
280
277
  params: {
@@ -290,7 +287,7 @@ export default function PublicLiveDetail({
290
287
  }
291
288
 
292
289
  const handleRequestFullScreen = () => {
293
- onSensorsPublicLiveDetailFullscreenClick({
290
+ onSendSensors({
294
291
  pageName: TrackPageName,
295
292
  eventName: 'TCH_webPlatform_publiclive_detail_fullscreen_click'
296
293
  })
@@ -298,7 +295,7 @@ export default function PublicLiveDetail({
298
295
 
299
296
  const handleVideoPlay = (needReport) => {
300
297
  if (needReport) {
301
- onSensorsPublicLiveDetailPlayClick({
298
+ onSendSensors({
302
299
  pageName: TrackPageName,
303
300
  eventName: 'TCH_webPlatform_publiclive_detail_play_click',
304
301
  params: {
@@ -0,0 +1,10 @@
1
+ import { getResourceLikesForLive } from '@/service/like'
2
+
3
+ const ResourceType = 'open_live'
4
+
5
+ export async function getLiveOnlineCount(liveId) {
6
+ const likesData = await getResourceLikesForLive(liveId, ResourceType)
7
+ const count = likesData?.open_live_count || 0
8
+ const currentCount = count === 0 ? 1 : count
9
+ return currentCount
10
+ }