F
F
Finch_852019-02-20 16:52:56
JavaScript
Finch_85, 2019-02-20 16:52:56

Why is audio not playing through the Web Audio API?

Hello. Understanding Web Audio. I took an example from MDN, but for some reason the sound is not reproduced. Chrome swears that you need to make playback on the button - did it. But still doesn't work.
Example - https://codepen.io/MisterFOX/pen/ErJyXv
In the "Network" tab, you can see that the request is coming, everything is fine, but there is no sound. I understand that I missed something simple, but I just can not understand what's wrong

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
frees2, 2019-02-20
@frees2

Did you play another mp3? Does he play there? If it plays, then you need CURLOPT_SSL

$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $fff);
 curl_setopt($ch, CURLOPT_USERAGENT, 'PHP Bot');
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_exec($ch);

D
Dmitry Belyaev, 2019-02-20
@bingo347

You are expected to fully download the file before giving it for playback, the file is very large for mp3 and is given at a very low speed (in 6 minutes I downloaded 2.8MB on the Internet 100mb / s and the file did not end there).
In general, there is a feeling that there is a stream, and not just a file, then you will wait forever for playback.
You need to take the data in parts, in small portions and give each portion to the sourceBuffer, but not before the decoding of the previous part is completed (queues for help)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question