@x-edu/live-player 0.0.10 → 0.0.12

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 CHANGED
@@ -3,6 +3,7 @@
3
3
  初版,API可能后续会大幅调整
4
4
 
5
5
  ## Demo
6
+ ### PublicLiveDetail 直播详情页
6
7
 
7
8
  ```jsx
8
9
  import { PublicLiveDetail, getLiveOnlineCount } from '@x-edu/live-player'
@@ -96,11 +97,50 @@ export default function LiveTest() {
96
97
  }
97
98
  ```
98
99
 
100
+ ### 直播列表页
101
+ ```jsx
102
+ import { PublicLiveList } from '@x-edu/live-player'
103
+ import React, { useContext } from 'react'
104
+ import style from './style.module.less'
105
+ import { getLoginUrl, uc } from '@/util/auth/func'
106
+ import UserContext from '@/component/Login/UserContext'
107
+
108
+ export default function LiveTest() {
109
+ const loginInfo = useContext(UserContext)
110
+
111
+ // 部分直播需要登录后才可以播放,这是要求登录的回调
112
+ const handleLogin = (item) => {
113
+ // 处理必须登陆的情况
114
+ window.location.href = getLoginUrl()
115
+ }
116
+
117
+ const handleDetailClick = (item) => {
118
+ // 根据 item 决定怎么跳转详情页
119
+ // 默认跳转中小学直播详情 window.open(`https://basic.smartedu.cn/publicLive/${liveId}}`)
120
+ }
121
+
122
+ return (
123
+ <div>
124
+ <PublicLiveList
125
+ scopeType='e_teacher_studio' // 适用范围,如名师工作室:e_teacher_studio 机构工作室:e_inst_studio 专家工作室:e_expert_studio 精准匹配
126
+ scopeId='xxx' // 适用id,如专家工作室id 精准匹配,必须有scope_type才生效
127
+ containerClassName={style.container} // 容器样式
128
+ uc={uc} // 登陆状态下必填
129
+ loginInfo={loginInfo} // 登陆状态下必填,特别的里面的 userInfo
130
+ handleLogin={handleLogin} // 用于需要强制登陆的回调,会传传入当前直播作为参数
131
+ onDetailClick={handleDetailClick}
132
+ />
133
+ </div>
134
+ )
135
+ }
136
+ ```
137
+
99
138
  ## 预生产
100
139
 
101
140
  ```js
102
141
  import {
103
142
  PublicLiveDetail,
104
- getLiveOnlineCount
143
+ getLiveOnlineCount
144
+ PublicLiveList
105
145
  } from '@x-edu/live-player/dist/XEduLivePlayerPre.common'
106
146
  ```