简体   繁体   English

如何使用 将上传到 OneDrive 的音频直接嵌入 HTML<audio> 元素?

[英]How can I directly embed audio that I have uploaded to OneDrive into HTML using the <audio> element?

I would like to know how I can directly embed an audio file that I have uploaded to OneDrive in HTML using the <audio> element.我想知道如何使用<audio>元素在 HTML 中直接嵌入我上传到 OneDrive 的音频文件。

  • I know there's always an Embed button in OneDrive, but I don't want that.我知道 OneDrive 中总是有一个“ Embed按钮,但我不想要那个。 That really only provides a big rectangle-shaped thing with a music icon and the filename, and when I click that, I'm still redirected to OneDrive.这实际上只提供了一个带有音乐图标和文件名的大矩形东西,当我点击它时,我仍然被重定向到 OneDrive。 How can I really embed this using the HTML <audio> element?我怎样才能真正使用 HTML <audio>元素嵌入它?
  • I actually already tried the Copy Audio Location menu item from Firefox's context menu.我实际上已经从 Firefox 的上下文菜单中尝试了Copy Audio Location菜单项。 It gave me a link that worked in the Dreamweaver's Live Preview (in the split view), but it didn't work in any other browser, including Firefox and Chrome.它给了我一个在 Dreamweaver 的实时预览(在拆分视图中)中有效的链接,但它在任何其他浏览器中都不起作用,包括 Firefox 和 Chrome。
  • I would like to use pure HTML to do this, ie no JavaScript.我想使用纯 HTML 来做到这一点,即没有 JavaScript。

Does anyone know how to do this?有谁知道如何做到这一点? Thanks!谢谢!

You can probably do it this way:你可能可以这样做:

  1. Get the direct link to the file:获取文件的直接链接:

    • how to do it :怎么做

    • Open OneDrive and Copy Embed Code打开 OneDrive 并复制嵌入代码在此处输入图片说明

    • Paste the Embed Code and Modify: Now paste the embed code you copied in a notepad or a text editor.粘贴嵌入代码并修改:现在粘贴您在记事本或文本编辑器中复制的嵌入代码。 This code looks like this one – <iframe src="https://onedrive.live.com/embed?cid=FA476CAFF1A7E75C&resid=FA476CAFF1A7E75C%21122&authkey=AN_axXpcOy7Zfl8" width="98" height="120" frameborder="0" scrolling="no"></iframe> .这段代码看起来像这样 - <iframe src="https://onedrive.live.com/embed?cid=FA476CAFF1A7E75C&resid=FA476CAFF1A7E75C%21122&authkey=AN_axXpcOy7Zfl8" width="98" height="120" frameborder="0" scrolling="no"></iframe> You have to modify this code, remove everything except source URL of the file https://onedrive.live.com/embed?cid=FA476CAFF1A7E75C&resid=FA476CAFF1A7E75C%21122&authkey=AN_axXpcOy7Zfl8 and then just replace embed with download to get direct/permanent link.您必须修改此代码,删除除文件源 URL 之外的所有内容https://onedrive.live.com/embed?cid=FA476CAFF1A7E75C&resid=FA476CAFF1A7E75C%21122&authkey=AN_axXpcOy7Zfl8然后只需将 embed 替换为下载即可获得直接/perman After this modification, the link should look like this – https://onedrive.live.com/download?cid=FA476CAFF1A7E75C&resid=FA476CAFF1A7E75C%21122&authkey=AN_axXpcOy7Zfl8修改后,链接应如下所示 – https://onedrive.live.com/download?cid=FA476CAFF1A7E75C&resid=FA476CAFF1A7E75C%21122&authkey=AN_axXpcOy7Zfl8

    • That's the OneDrive direct or native link这是 OneDrive 直接或本机链接

  2. Use this link in the audio tag:在音频标签中使用此链接:

<audio src="https://onedrive.live.com/download?cid=FA476CAFF1A7E75C&resid=FA476CAFF1A7E75C%21122&authkey=AN_axXpcOy7Zfl8"></audio>

I mean provide into src the link you get from OneDrive.我的意思是在 src 中提供您从 OneDrive 获得的链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM