给网页插入音视频的简单代码🎬
本文最后更新于:3 个月前
插入音乐
自动播放背景音乐
<iframe width="0" height="0" src="https://lyfclub.herokuapp.com/music/Isabella%20Celander-Stargazing.mp3" frameborder="0" allowfullscreen></iframe>
2020.05.19 更正:
上面这条代码失效, 如果添加到网页, 可能导致打开网页自动下载歌曲文件, 而非自动播放
网易云音乐插件
- 固定大小
<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=740558&auto=0&height=66"></iframe>
auto=0不自动播放,1自动播放。
- 自适应宽度
<iframe frameborder="no" border="1" marginwidth="0" marginheight="0" width=100% height=86 src="//music.163.com/outchain/player?type=2&id=740558&auto=0&height=66"></iframe>
插入视频
YouTube
<iframe width="100%" height="315" src="https://www.youtube.com/embed/rRVLaar8cE4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
网络原因,此处不再做展示。
哔哩哔哩
<iframe src="//player.bilibili.com/player.html?aid=86700769&bvid=BV1X7411p7Cg&cid=148167464&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
改个尺寸:
又太臃肿🙄其它视频直链
超星云盘
直链没挂,但不允许外部引用了😕
OneManager
<video src="https://lyfclub.herokuapp.com/videos/%E5%88%98%E4%BA%A6%E8%8F%B2.mp4" width="50%" height="50%" controls="controls"></video>
第一个链接是在天翼云盘PC网页端在线播放mp4时用鼠标右键获取的,建议选择h.264编码的MP4格式的视频,其它格式可用格式工厂转换。
但愿不会太快失效吧😑行, 不折腾了, 想找个长期有效且国内访问正常的永久视频直链太难, 凑合用YouTube, 直接在其播放页面找到分享-嵌入复制进文章页就成
本站所有文章除特别声明外,均采用 CC BY-SA-NC 4.0 协议 。转载请注明原作者及出处!