I am using audio tag in my html code for playing the audio in my webpage ,i have one doubt without passing directly audio to the audio tag i want to use google drive link(link contains one audio).please help me to acheive this ...
<audio controls autoplay>
<source src="https://drive.google.com/file/d/11wfYWiukbIZJQnDL385jQs2SGQA5ESbL/view?usp=drivesdk"></audio>
CodePudding user response:
What you are doing is correct only one problem you cant use the google drive link directly.
1.You should go to google drive and choose share file you will get something like the following link: https://drive.google.com/file/d/11wfYWiukbIZJQnDL385jQs2SGQA5ESbL/view?usp=sharing
Extract the id from URL 11wfYWiukbIZJQnDL385jQs2SGQA5ESbL
URL for playing the audio file https://docs.google.com/uc?export=download&id=11wfYWiukbIZJQnDL385jQs2SGQA5ESbL
URL for downloading the audio file https://drive.google.com/uc?authuser=0&id=11wfYWiukbIZJQnDL385jQs2SGQA5ESbL&export=download
your final code will be something like the following:
for playing:
<audio controls autoplay>
<source src="https://docs.google.com/uc?export=download&id=11wfYWiukbIZJQnDL385jQs2SGQA5ESbL">
</audio>
for downloading:
<a href="https://drive.google.com/uc?authuser=0&id=11wfYWiukbIZJQnDL385jQs2SGQA5ESbL&export=download"/>Download</a>
note: The auto play will not work on iPhone devices if saving power is enabled which is by default