¿Cómo proporcionar el atributo src en html para reproducir audio almacenado en la computadora?

I want to play the audio in browser using html; and how to play the audio/video that is stored in our computer/laptop in html

I have tried below code...

<!DOCTYPE html>

<audio controls>
  <source src="C:\Users\abc\Desktop\song.ogg" type="audio/ogg">
  <source src="C:\Users\abc\Desktop\song.mp3" type="audio/mpeg">
Your browser does not support the audio element.


Esto no está funcionando...

preguntado el 27 de noviembre de 13 a las 07:11

posible duplicado de Reproducción de audio en HTML -

There is nothing wrong in your code,may be your browser is not supporting or make sure the file is present -

Browsers tend to be very strict about allowing access to local computer's resources. Where do you have that html file? If it's on a server somewhere, you're simply stuck. If the browsers allowed this, it could potentially be used to infringe on users privacy, or be a security hole of some other kind. -

1 Respuestas

There many different tags you can use to play audio using HTML for example you could use the <object> tag:

<object height="50" width="100" data="Example.mp3"></object>

O la <embed> tag:

<embed height="50" width="100" src="Example.mp3">

But the best solution is to use these lines of code:

<audio controls>
  <source src="example.mp3" type="audio/mpeg">
  <source src="example.ogg" type="audio/ogg">
  <embed height="50" width="100" src="Example.mp3">

Your code is also correct but your browser may not be supporting. Thanks for listening and if you need more information please visit www.w3schools.com

Respondido 04 Feb 14, 08:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.