Third-party audio stream through a function in PHP laravel

I need a function that can transmit audio from a third-party site.

Let's pretend that.

controller

function getStreamAudio($id){ $audioDetails = Audio::find($id); //Get audio details $audio_full_url = $audioDetails->audio_path; //www.otherdomain.com/abc/xyz.mp3 //here i need to strem audio through id } 

I have the same playlist as below HTML

 <audio src="www.mydomain.com/stream_audio/1"></audio> // src tags are excute the above function <audio src="www.mydomain.com/stream_audio/2"></audio> // src tags are excute the above function <audio src="www.mydomain.com/stream_audio/3"></audio> // src tags are excute the above function 

I have a playlist of songs for streaming audio. But the goal is to protect the source URL of the source audio.

I tried Defa Protector to encrypt the audio url. Below is the URL

https://sites.google.com/site/defaprotectorhelp/

It works, but when I add 4 or more songs to the playlist. This shows me the error below.

Unprepared (in promise) DOMException: the play () request was aborted by a call to pause ().

For this error, I also tried to use this https://stackoverflow.com/a/3/960/649/ solution. But still the error is the same.

When I use the original audio path. It works great.

+5
source share

Source: https://habr.com/ru/post/1261759/


All Articles