未执行 amp-video 组件后备占位符和后备 - E...</desc> <question vote="0"> <p>放大器视频后备功能对我不起作用。在此代码中:</p> <pre><code><!doctype html> <html ⚡> <head> <meta charset="utf-8"> <title>Placeholders &amp; fallbacks - Example 3</title> <script async src="https://cdn.ampproject.org/v0.js"></script> <script async custom-element="amp-video" src="https://cdn.ampproject.org/v0/amp-video-0.1.js"></script> <link rel="canonical" href="https://preview.amp.dev/documentation/guides-and-tutorials/develop/style_and_layout/placeholders.example.3.html"> <meta name="viewport" content="width=device-width"> <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> </head> <body> <amp-img width="550" height="368" layout="responsive" src="non_existent_image.jpg"> <div fallback> <p>Image not found</p> </div> </amp-img> <amp-video width="640" height="358" src="non_existent_video.mp4"> <div fallback> <p>Video not found</p> </div> </amp-video> </body> </html> </code></pre> <p>代码可以在<a href="https://playground.amp.dev/?_gl=1*14hl1ox*_ga*YW1wLVJpMFc0Z3FCVlBXRXFyS3FoQV9GOGc.*_ga_TYM9BH1XCX*MTcxNjU5NTAwNy4xMi4xLjE3MTY1OTUwMDcuMC4wLjA.#share=PCFkb2N0eXBlIGh0bWw+CjxodG1sIOKaoT4KPGhlYWQ+CiAgPG1ldGEgY2hhcnNldD0idXRmLTgiPgogIDx0aXRsZT5QbGFjZWhvbGRlcnMgJmFtcDsgZmFs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2libGV9fUAtbXMta2V5ZnJhbWVzIC1hbXAtc3RhcnR7ZnJvbXt2aXNpYmlsaXR5OmhpZGRlbn10b3t2aXNpYmlsaXR5OnZpc2libGV9fUAtby1rZXlmcmFtZXMgLWFtcC1zdGFydHtmcm9te3Zpc2liaWxpdHk6aGlkZGVufXRve3Zpc2liaWxpdHk6dmlzaWJsZX19QGtleWZyYW1lcyAtYW1wLXN0YXJ0e2Zyb217dmlzaWJpbGl0eTpoaWRkZW59dG97dmlzaWJpbGl0eTp2aXNpYmxlfX08L3N0eWxlPjxub3NjcmlwdD48c3R5bGUgYW1wLWJvaWxlcnBsYXRlPmJvZHl7LXdlYmtpdC1hbmltYXRpb246bm9uZTstbW96LWFuaW1hdGlvbjpub25lOy1tcy1hbmltYXRpb246bm9uZTthbmltYXRpb246bm9uZX08L3N0eWxlPjwvbm9zY3JpcHQ+CjwvaGVhZD4KPGJvZHk+CjxhbXAtaW1nCiAgd2lkdGg9IjU1MCIKICBoZWlnaHQ9IjM2OCIKICBsYXlvdXQ9InJlc3BvbnNpdmUiCiAgc3JjPSJub25fZXhpc3RlbnRfaW1hZ2UuanBnIj4KICA8ZGl2IGZhbGxiYWNrPgogICAgPHA+SW1hZ2Ugbm90IGZvdW5kPC9wPiAgICAKICA8L2Rpdj4KPC9hbXAtaW1nPgogIAo8YW1wLXZpZGVvCiAgICB3aWR0aD0iNjQwIgogICAgaGVpZ2h0PSIzNTgiCiAgICBzcmM9Im5vbl9leGlzdGVudF92aWRlby5tcDQiPgogIDxkaXYgZmFsbGJhY2s+CiAgICA8cD5WaWRlbyBub3QgZm91bmQ8L3A+ICAgIAogIDwvZGl2Pgo8L2FtcC12aWRlbz4gCjwvYm9keT4KPC9odG1sPg==" rel="nofollow noreferrer">AMP Playground</a></p>中访问 <p>丢失图像的后备正确显示消息“找不到图像”,但不显示丢失视频的后备。</p> <p>上面的代码有什么问题?</p> </question> <answer tick="false" vote="0"> <p>虽然代码是按照文档写的,但是不起作用。不过,经过一段时间的尝试,这个修改成功了:</p> <pre><code><amp-video width="640" height="358" src="non_existent_video.mp4"> <div> <p>Video not found</p> </div> </amp-video> </code></pre> <p>我从 中删除了 <pre><code>fallback</code></pre> 属性,当播放器不工作时会出现该消息。</p> </answer> </body></html>

问题描述 投票:0回答:0
image video error-handling html5-video amp-html
© www.soinside.com 2019 - 2024. All rights reserved.