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

fix videoPlayer defer loading #72

Merged
merged 1 commit into from Jan 6, 2020
Merged

Conversation

PPpro
Copy link
Collaborator

@PPpro PPpro commented Jan 3, 2020

Re: cocos/2d-tasks#2259

changeLog:

  • 修复场景延时加载时,videoplayer 无法播放的问题
  • 优化 videoplayer READY_TO_PLAY 事件的监听

@PPpro PPpro requested a review from holycanvas Jan 3, 2020
@PPpro
Copy link
Collaborator Author

@PPpro PPpro commented Jan 6, 2020

优化 videoplayer READY_TO_PLAY 事件的监听

之前是通过 setInterval 来重复播放 video,直到 onPlay 则视为加载结束,这样会导致一个问题,播放太多次,微信开发者工具就卡死了

所以直接通过设置 autoPlay 来让视屏加载完自动播放,onPlay 监听加载完成事件

微信本身没有提供 onCanPlay 接口

@holycanvas
Copy link
Contributor

@holycanvas holycanvas commented Jan 6, 2020

之前是通过 setInterval 来重复播放 video,直到 onPlay 则视为加载结束

之前这么做是因为没有接口能够判断是否加载完成么

@PPpro
Copy link
Collaborator Author

@PPpro PPpro commented Jan 6, 2020

现在也没有的,只是用 autoplay 会比较好,而不是让他重复播放

测试过 autoplay 在安卓 iOS 上都没有问题

@PPpro PPpro merged commit 9e88de4 into cocos-creator-packages:v2.3.0 Jan 6, 2020
@holycanvas
Copy link
Contributor

@holycanvas holycanvas commented Jan 6, 2020

哦,对了,这个地方是不是得考虑md5存在的时候,nativeUrl不一定对
image

@PPpro
Copy link
Collaborator Author

@PPpro PPpro commented Jan 6, 2020

nativeUrl 是没有 md5 的,加载之后的 nativeAsset 会附上 md5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants