PHP how to stream a mp3 stream again

前端 未结 1 1583
走了就别回头了
走了就别回头了 2021-01-22 13:05

I´m trying to get data from a radio stream (MP3) from http and want to stream it out in https. this is what I tried:



        
相关标签:
1条回答
  • 2021-01-22 13:26

    For your stream, using PHP's readfile(); is enough. It achieves same result as putting the radio link directly in an <audio> tag.

    PHP code (save as testproxy.php) :

    <?php
    
    $file = "http://mp3channels.webradio.antenne.de/antenne";
    readfile($file);
    
    ?>
    

    HTML (use the above PHP file as source of some <audio> tag) :

    <!DOCTYPE html>
    <html>
    <body>
    
    <audio id="audio" controls>
      <source crossorigin="anonymous" src="testproxy.php" type="audio/mpeg">
      Your browser does not support the audio element.
    </audio>
    
    </body>
    </html>
    
    0 讨论(0)
提交回复
热议问题