Old User Old User - 7 days ago 7
PHP Question

mp3 playing services or server(link ending with .mp3)

In my app I need to play online mp3 which I am successfully playing using MediaPlayer in android using this link

http://www.virginmegastore.me/Library/Music/CD_001214/Tracks/Track1.mp3

I have many mp3's that that I need to upload on server which provide the services as the above link mentioned.

I have tried to upload them on Google Drive, Also tried soundcloud but their behaviour was different.

I need the same service like this link http://www.virginmegastore.me/Library/Music/CD_001214/Tracks/Track1.mp3 provides.

Anyone know any website having this behaviour ?

Thanks in advance

UPDATE after -ve downvotes(showing what I tried)

I used picosong.com which produces this link http://picosong.com/5Nt9 , The above link does not ends with ****.mp3 & to make this desired link I perhaps need a php server !

I searched on net & found these websites



Generated by AudioPlay Online Generator (http://www.strangecube.com/audioplay/)

<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="30" height="30">
<PARAM NAME=movie VALUE="http://www.strangecube.com/audioplay/online/audioplay.swf?file=http://picosong.com/5Nt9&auto=yes&sendstop=no&repeat=1&buttondir=http://www.strangecube.com/audioplay/online/alpha_buttons/classic&bgcolor=0x000000&mode=playpause">
<PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=transparent>
<embed src="http://www.strangecube.com/audioplay/online/audioplay.swf?file=http://picosong.com/5Nt9&auto=yes&sendstop=no&repeat=1&buttondir=http://www.strangecube.com/audioplay/online/alpha_buttons/classic&bgcolor=0x000000&mode=playpause" quality=high wmode=transparent width="30" height="30" align="" TYPE="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
</object>
</div><!-- End of generated code -->


I tried it running in the localhost xampp which does not show anything, no errors but not running

What am I doing wrong ?

All I just want is the .mp3 ending link having exact the same visibility as this link http://www.virginmegastore.me/Library/Music/CD_001214/Tracks/Track1.mp3
because only this type of link can be streamed live in android.

Help !!

Answer

The link you provided to the MP3 file was just... a link to an MP3 file. Every client will interpret it differently.

So you can:

  1. Store the file in the server and provide a link to the file - no PHP involved.
  2. Deliver using PHP

    header('Content-type: audio/mpeg');
    readfile($mp3_filepath);
    
  3. You mentioned Google Drive. You can deliver the file directly by:

    1. Putting the files in a folder and make the folder public. Not "anyone with the link" - public.
    2. Redirecting the user to https://googledrive.com/host/[FOLDER_ID]/[MP3_FILE].mp3

Have fun.