【问题标题】:How does the browser download the source file from a video tag浏览器如何从视频标签中下载源文件
【发布时间】:2016-04-02 23:42:34
【问题描述】:
我正在查看显示视频标签的网站播放 m4a 文件。在 html 中给出了 m4a 文件的源 URL。源url和播放器正在显示的url是一样的。
如果我在浏览器中加载源 URL,它只会加载同一个播放器。我可以通过右键单击 chrome/firefox 并单击将音频/链接另存为来下载 src 文件。
video标签如何从源视频中下载m4a文件?不应该访问 src url 让我以相同的方式获取文件,右键单击播放器并选择将音频另存为?
【问题讨论】:
标签:
html
http
html5-video
【解决方案1】:
只需在锚点中使用视频的网址即可。将其与您的视频元素一起包装在一个块元素中,以使外观和感觉不像下载链接。
片段
figure {
width: 480px;
padding: 10px 5px 15px;
background: #000;
border-radius: 12px;
}
a {
text-decoration: none;
color: #00e;
background: transparent;
border: 1px sold #00e;
border-radius: 10px;
padding: 5px;
text-align: center;
}
a:hover {
color: #0ff;
background: #555;
border: 1px solid #0ff;
}
<figure>
<video src="http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2014/12/html5-video-article-demos/maui-with-words.webm" controls preload="none" width="480"></video>
<figcaption><a href="http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2014/12/html5-video-article-demos/maui-with-words.webm">Download</a>
</figcaption>
</figure>