Reputation: 179
I want to integrate an mp3 audio file with a size of 20MB into my website (PHP 7, Apache webserver).
<audio id="myaudio" src="./assets/myaudio.mp3" preload=„none" controls></audio>
Does anyone have an idea how I can achieve all this?
Upvotes: 2
Views: 4486
Reputation: 194
Streaming MP3 by Toby Mack
To stream MP3's on a page you will need to have an MP3 player like WinAmp, Windows Media Player, or Real Audio Player. The MP3 will stream as it loads on the page and will allow for longer larger sound files to be played.
Save your MP3 file to the same directory where you will be playing the sound from, or a sound directory which you know the URL for already,
Open up a notepad by clicking Start => Programs => Accessories => Notepad
Type in only the exact Address or URL of your MP3 file.
Type it in as simple as this: http://example.com/sound/music.mp3
where the domain is your domain, the sound folder is where you placed your MP3, and the music.mp3 is your mp3 file.
Save this file as music.m3u . Upload this file into the directory where you will place your sound.
Open your page up in an editor such as Notepad that will allow you to edit the code on the page.
Insert the following code into the HTML code of your page for a clickable link to stream by using this:
Clickable player and doawnload this file by right clicking it and save to yur directory:
<a href="music.m3u"><img border="0" src= "mp3.gif" width="41" height="25"></a>
Or you can embed with this:
<EMBED src="music.m3u" autostart=true hidden=true>
Or you can embed for both IE and Netscape with this:
<!This code for IE>
<EMBED SRC="http://example.com/sound/music.m3u" HIDDEN="true" AUTOSTART="true" width="128" height="128">
<!This code for Netscape>
<OBJECT ID="MediaPlayer"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"
standby="Loading Microsoft Windows Media Player components..."
TYPE="application/x-oleobject" width="239" height="179">
<PARAM NAME="FileName" VALUE="http://server/path/your-file.asx">
<PARAM NAME="AnimationatStart" VALUE="false">
<PARAM NAME="TransparentatStart" VALUE="true">
<PARAM NAME="AutoStart" VALUE="true">
<PARAM NAME="ShowControls" VALUE="0">
<Embed TYPE="application/x-mplayer2"
pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&"
SRC="http://example.com/sound/music.m3u"
Name=MediaPlayer
ShowControls=0
Width=2
Height=2
</embed>
</OBJECT>
Upvotes: 1