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 replaying other videos, video width and height not updated #5736

Merged
merged 1 commit into from Nov 15, 2019

Conversation

@knoxHuang
Copy link
Contributor

knoxHuang commented Nov 14, 2019

Re: cocos-creator/2d-tasks#2080 cocos-creator/2d-tasks#2084 cocos-creator/2d-tasks#2093

Changes:

  • 修复当播放其他 video 时,video 宽高无法及时更新
@holycanvas

This comment has been minimized.

Copy link
Contributor

holycanvas commented Nov 14, 2019

麻烦说明一下,之前把 forceUpdate 给删除了,现在又给加了回来,看起来forceUpdate的作用是在加载新视频或者webview的时候强制更新布局,@2youyou2 之前移除的原因是什么,@umbrellaPP 你之前同步的pr也可能需要改回来。

我们在删除之前要多想一下呀!看起来当时还是没有刨根问底

@holycanvas holycanvas requested review from 2youyou2 and umbrellaPP Nov 14, 2019
@knoxHuang

This comment has been minimized.

Copy link
Contributor Author

knoxHuang commented Nov 14, 2019

之前使用 _forceUpdate 的办法有问题,只在隐藏的时候才会关闭,导致 updateMatrix 会一直去计算宽高,同时看了代码发现如果只在隐藏跟显示中才去改变 _forceUpdate 的话,这个变量就没必要了,才进行删除。

后续加回来的原因是因为发现还是需要在每次加载 video ro webview 的时候重新计算一下宽高才行,否则在重新加载其他 video ro webview 时是不会重新计算宽高的,从而导致出现显示错误

@umbrellaPP

This comment has been minimized.

Copy link
Contributor

umbrellaPP commented Nov 14, 2019

经过测试,微信上不需要 forceUpdate
jsb-adapter 里 videoPlayer 需要在 设置完 url 后,再次 forceUpdate。webView 不需要
cocos-creator-packages/jsb-adapter#205

@holycanvas

This comment has been minimized.

Copy link
Contributor

holycanvas commented Nov 14, 2019

微信上不需要 forceUpdate

为什么不需要呢?

@umbrellaPP

This comment has been minimized.

Copy link
Contributor

umbrellaPP commented Nov 14, 2019

为什么不需要呢?

他们的底层实现没有这个问题

@2youyou2

This comment has been minimized.

Copy link
Contributor

2youyou2 commented Nov 14, 2019

之前去掉是因为 _forceUpdate 跟 _visible 设置的时机是完全一样的,用 _visible 就好了,现在加回来是加到了 loadedmetadata 里,之前是没有的。

是这样吧,@knoxHuang

@holycanvas

This comment has been minimized.

Copy link
Contributor

holycanvas commented Nov 14, 2019

他们的底层实现没有这个问题

微信下切换video会自动更新布局?

@knoxHuang

This comment has been minimized.

Copy link
Contributor Author

knoxHuang commented Nov 15, 2019

对,现在是要加载需要重新计算一下宽高

@umbrellaPP

This comment has been minimized.

Copy link
Contributor

umbrellaPP commented Nov 15, 2019

微信下切换video会自动更新布局?

微信不会,web 跟 原生平台,切换视频源,会刷新 video framesize, 需要重新适配到 node 的尺寸

@holycanvas holycanvas merged commit 60f98a4 into cocos-creator:v2.2.1-release Nov 15, 2019
1 check passed
1 check passed
ci/circleci: test Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.