Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为了正确播放 html5 中的视频,我在捕获加载的元数据事件时保存了视频的 videoWidth 和 videoHeight 值。令我惊讶的是,在我的 android 浏览器上这两个值都是 100,而在我的 iphone safari 上是 480*640,这是真正的大小。为了找到原因,我尝试了其他浏览器,例如chrome,uc。我惊讶地发现videoWidth和videoHeight的值在各种android浏览器下都是错误的。为什么?谁能帮忙!
看来问题在于元数据加载,当您过早查询大小时,您会得到默认的 100x100。如果您在 durationchange 事件显示持续时间大于 1 秒后进行特定检查,那么您将看到 videoWidth 和 videoHeight 的正确值(我发现 Android 中的 HTML5 视频依赖于持续时间显示大于初始默认值之前的任何内容1s 有问题)