Answer the question
In order to leave comments, you need to log in
Instead of a link to an audio player?
Good afternoon, there are audio comments on the site, when you add it, the path to the audio comment appears in the form
[audio records/1517754431.wav]
how can I make the player show instead of text?
please help folks
Answer the question
In order to leave comments, you need to log in
For example:
<?php
function parseAudio($message) {
$matches = [];
$s = preg_match('/\[audio (.*?)\]/', $message, $matches);
return str_replace($matches[0], "<audio controls><source src=\"{$matches[1]}\" type=\"audio/wav\"></audio>", $message);
}
echo parseAudio("Message with audio\n[audio records/1517754431.wav]");
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question