保利威文档中心

幫助中心

升級遷移

更新時間:2025-03-21 14:06:01

一、1.x 升級至 2.x

1.1 模組重新命名

需要將 watchCore.subtitles 全部改成 watchCore.subtitle

1.2 API 變更

聊天室模組(chat)拆分出表情模組(emotion),需要更改原本對應的 API,具體如下

watchCore.chat.getEmotionFaceDomList => watchCore.emotion.getEmotionFaceDomList
watchCore.chat.getEmotionFaceClickTarget => watchCore.emotion.getEmotionFaceClickTarget
watchCore.chat.getEmotionImages => watchCore.emotion.getEmotionImages

同時,拆分表情模組後,需要外部手動呼叫 watchCore.emotion.setupEmotionParser 來載入表情解析器

提問模組獲取聊天歷史的 API 也做了變化

watchCore.ask.getAskHistory => watchCore.ask.getAskHistoryByUserId

1.3 API 廢棄

以下的 API 在 1.x 和 0.x 版本雖然廢棄,但還保留功能,但 2.x 已將對應的功能移除,請更改推薦變更的方法

watchCore.ask.sendQuestion => watchCore.ask.sendAskSpeak
watchCore.chat.getOnlineUserList => watchCore.chat.getOnlineUserListNew
watchCore.chat.setChatMsgReplayPlaybackTarget => watchCore.playback.setCurrentPlaybackTarget

另外,還有部分身份認證 API 在 2.0 版本廢棄,後續也不再支援,如需使用使用者系統,請聯繫保利威技術人員,接入統一授權 SDK

  • watchCore.identity.checkIdentityWxAuth
  • watchCore.identity.checkIdentityInfoLogin

1.4 業務影響

需要注意,2.0 版本增加了卡片推送重播,且預設開啟,但會影響 currentPlaybackTarget.chatReplayEnabled 判斷。如果您直接在 V1 版本配套的 UI 層升級,請改成 currentPlaybackTarget.chatMsgReplayEnabled

1.5 CDN 外鏈引入變更

1.x 外鏈引入時,需要使用以下的引入方式

<!-- 通过1.x版本号引入 -->
<script src="https://websdk.videocc.net/live-watch-sdk/{version}/lib/polyv-live-watch.umd.js"></script>

2.x 外鏈引入時,則需要使用以下的引入方式

<!-- 通过2.x版本号引入 -->
<script src="https://websdk.videocc.net/live-watch-sdk/{version}/lib/polyv-live-watch-sdk.umd.js"></script>

1.6 配套專案升級指南

  • 如果您用的是 直播觀看頁開源專案 v1.11.0,那可以參考這條開源專案倉庫裡的這條 ui-1.x-with-sdk-2.x 分支,該分支提供了开源项目 v1.11.0 接入 逻辑层SDK v2.0.0 的範例,能夠正常運行。但不再使用保利威使用者體系
  • 如果您用的是更早之前的開源專案版本,請先升級至 v1.11.0
联系客服,在线咨询