Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何异步加载弹幕 #1478

Open
gkj17 opened this issue Jun 2, 2024 · 1 comment
Open

如何异步加载弹幕 #1478

gkj17 opened this issue Jun 2, 2024 · 1 comment
Labels
danmaku danmu

Comments

@gkj17
Copy link

gkj17 commented Jun 2, 2024

您使用的西瓜播放器版本是多少? What version of xgplayer are you using?
3.0.15

您使用的操作系统和浏览器分别是? What OS and browser are you using?
感觉和环境无关系

如何复现问题? How to reproduce the problem?
弹幕数据有十几万条,第一次同步去请求弹幕然后再播放视频的话,会有点久,想的是先播放视频,然后异步加载弹幕(但不是一直掉调用sendDanmu....),有什么方法吗?

您期望的播放器正常行为是? What did you expect to happen?

实际播放器的表现是? What actually happened?

可填写您所在的公司和相关产品业务,方便我们提供更好的技术支持 You can write your company and product which uses xgplayer, for helping us provide better technical support.

@gemxx
Copy link
Collaborator

gemxx commented Jun 11, 2024

@gkj17 目前弹幕SDK共有两个接口可以为其提供,sendDanmu & updateComments。我想你是想问有没有可以批量更新数据的接口
单条:sendDanmu,适合用户主动发布弹幕场景
批量:updateComments,适合通过数据源,批量设置给弹幕SDK

// 批量更新弹幕数据,适合在从接口中获取到批量数据时调用
danmu.updateComments([
  {
    duration: 15000,
    id: 'id',
    start: 3000, //不提供该项则立即发送
    txt: '弹幕内容',
  },
  ...
])

@gemxx gemxx added the danmaku danmu label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
danmaku danmu
Projects
None yet
Development

No branches or pull requests

2 participants