如何使用 html 音频标签播放 google drive mp3 文件? [英] How to play google drive mp3 file using html audio tag?

查看:19
本文介绍了如何使用 html 音频标签播放 google drive mp3 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是从谷歌驱动器播放 mp3 文件.我正在使用插件 MediaElement js.我得到的参考是 https://www.portalzine.de/dev/html5/hosting-mp3-files-on-google-drive-html5-audio-player/这适用于 chrome、Mozilla firefox,但不适用于 IE-11、safari 和 opera.我希望它可以在所有浏览器中播放.请给我建议....

My aim is to play the mp3 file from the google drive. I am using the plugin MediaElement js. The reference I got is https://www.portalzine.de/dev/html5/hosting-mp3-files-on-google-drive-html5-audio-player/ This is working in chrome, Mozilla firefox but not in IE-11, safari and opera. I want this to be play in all browsers. Please give me the suggestions....

推荐答案

1.音频文件的 URL(任何人都可以查看)

https://drive.google.com/file/d/1nQklEicsMeGBnuk0vv6zkHtXtyGy10S-/view?usp=sharing

<强>2.从 URL 中提取 id

1nQklEicsMeGBnuk0vv6zkHtXtyGy10S-

3.播放音频文件的 URL

https://docs.google.com/uc?export=download&id={id}

示例:

https://docs.google.com/uc?export=下载&id=1nQklEicsMeGBnuk0vv6zkHtXtyGy10S-

4.音频文件下载地址

https://drive.google.com/uc?authuser=0&id={id}&export=download

示例:

https://drive.google.com/uc?authuser=0&id=1nQklEicsMeGBnuk0vv6zkHtXtyGy10S-&export=download

5.用于播放音频的 HTML:

<audio controls="controls">
    <source src="https://docs.google.com/uc?export=download&id={id}">
</audio>

示例:

<audio controls="controls">
  <source src="https://docs.google.com/uc?export=download&id=1nQklEicsMeGBnuk0vv6zkHtXtyGy10S-">
</audio>

6.用于下载音频的 HTML:

<a href="https://drive.google.com/uc?authuser=0&id={id}&export=download"/>Download

示例:

<a href="https://drive.google.com/uc?authuser=0&id=1nQklEicsMeGBnuk0vv6zkHtXtyGyO9S-&export=download"/>Download

这篇关于如何使用 html 音频标签播放 google drive mp3 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆