poxyexams Posted May 9, 2011 Share Posted May 9, 2011 Hey guys I was wondering if anyone here can help me :) Here's the pro-lemo I have a hard drive connected to my router. I can access the files on the drive on any Computer/laptop anywhere on the network (specifically audio .mp3/.wav files) I can choose the song I want and play it straight away. Using the internet (in a friends house) I can dial in my IP address and log into these files. I can see all my audio files. I can download them and play them, however I can not STREAM these files :( I want to be able to have a script/application that allows the user to see all these files and choose the files and stream the audio. For the moment, before I make the applications all cool I need it to simply stream the audio. I was wondering is there anyway I can write some code and embed it on a website that allows the user to stream (not download these files) I began writing some code for this. I can download the files but can't stream them. If I click the URL: http://xx.xxx.xxx.xx/shares/usb/Pete/x/ ... ne_Day.mp3 I get the option to download/play the file. I want to embed this into my website so It can be streamed, Some simple testing using: <embed src="http://xx.xxx.xxx.xx/shares/usb/Pete/x/%26ME_One_Day.mp3" width="140" height="40" autostart="false" loop="FALSE"> </embed> It won't play it. But if I just put a link to the file it's self it will download and play properly. ------------------------ Anyone know what I am doing wrong? Thanks guys! Quote Link to comment Share on other sites More sharing options...
Infiltrator Posted May 9, 2011 Share Posted May 9, 2011 (edited) Try this code! Remember to replace this line MP3_FILE_URL with the link to your MP3 file. <embed type="application/x-shockwave-flash" flashvars="audioUrl=MP3_FILE_URL" src="http://www.google.com/reader/ui/3523697345-audio-player.swf" width="400" height="27" quality="best"></embed> Edited May 9, 2011 by Infiltrator Quote Link to comment Share on other sites More sharing options...
digip Posted May 9, 2011 Share Posted May 9, 2011 Easiest way to embed is using a flash app as the player and point to the mp3. Reasons it doesn't work with embed is you need a default plugin that is associated with embeded mp3's, which is usually something like Quicktime or windows media player, which require slightly different embedding. Media Player will want an object tag around the embed code with the proper data type, then emebed will default to all other players associated with such playing, like Quicktime, but is much better to just use flash, since its cross platform compatible between windows, mac, and linux so long as they have flash installed and the OS itself can play MP3's. Have a look at something like : http://www.longtailvideo.com/players/jw-flv-player/ or for really stylish stuff, http://activeden.net/searches?term=mp3+player&type=files&categories%5Bflash%5D=1&categories%5Bflex%5D=1&categories%5Bunity-3d%5D=1 Many of the things on ActiveDen show you demos, which if your savvy enough to know where to look, can pull down half the demo files and re-purpose them on your own site since the play lists are usually XML, and the players have no restrictions so long as everything it is fed is coded correctly. Quote Link to comment Share on other sites More sharing options...
Dark Jester Posted May 9, 2011 Share Posted May 9, 2011 I'd look at S08E03 and watch the segment on Ampache or S07E26 on the python streaming solution. I've personally set up the python script one, but plan on trying out Ampache. These should be a good building block to at least get you started. Quote Link to comment Share on other sites More sharing options...
poxyexams Posted May 10, 2011 Author Share Posted May 10, 2011 @Infiltrator, thanks that works now and streams the music :) I'm gonna look into adding a play list to that player. embed type="application/x-shockwave-flash" flashvars="audioUrl=MP3_FILE_URL" src="http://www.google.com/reader/ui/3523697345-audio-player.swf" width="400" height="27" quality="best"></embed> Just doing some testing at the moment, have some php code to take input from the user and stores this input as variable 'url' think the code I used is something along the lines of this: $url = $_POST['songurl'] I want to add the php (form input) $url to the html code above flashvars="audioUrl=ADD PHP VARIABLE HERE" I have hit a brick wall here, can't get the input from the form box into the above html player What am I missing, Thanks for the suggestions guys, really appreciate it :) Quote Link to comment Share on other sites More sharing options...
digip Posted May 10, 2011 Share Posted May 10, 2011 try flashvars="audioUrl=<?php ehco $url; ?>" Quote Link to comment Share on other sites More sharing options...
poxyexams Posted May 10, 2011 Author Share Posted May 10, 2011 try flashvars="audioUrl=<?php ehco $url; ?>" I tried that but didn't work, tried it again and works :) must of been a small typo by me... I have to player working so they enter the url of the mp3 they want to play, it then plays it in the player. Going to try add it to the player play list instead of playing it straight away. Thanks guys Quote Link to comment Share on other sites More sharing options...
poxyexams Posted May 10, 2011 Author Share Posted May 10, 2011 Two small problems, nearly 100% working .USER logs on to secure page. .Input text field called 'audiourl' and submit button .Music Player .Loads html from another page and shows all audio files on the drive Page has simple INPUT text box that prompts the user to enter an audio file URL and stores the input in a php variable called $url When submit is clicked, the variable $url (audio file) is added to the audio player ------------------------------------- I want to add a second audio player & a second audio url text box. I did it and I can get the audio to play in each player. However every time submit is hit for each player it reloads the page (stopping the current playing audio player) Is it possible to to have one audio player playing music and when the user enters a second url it just goes into the player number 2 without loading the entire page (and stopping the current playing track) --------------------------------------- Just a small problem here; I get this error message on the page: Notice: Undefined index: songurl in /var/www/player.php on line 11 --------------------------------------- Thanks guys, and here is the CODE to the actual page: <html> <head><title>myStreamZ</title></head> <body> <form method='POST'> Player 1: <input type='text'value='Song URL' name='songurl'><br/> <input type='submit' value='Add Track To Player 1'><br/> <br/> <?php $url=$_POST['songurl']; ?> <br/> <center>Player 1<br/><embed type="application/x-shockwave-flash" flashvars="audioUrl=<?php echo $url; ?>" src="http://www.google.com/reader/ui/3523697345-audio-player.swf" width="400" height="27" quality="best"></embed> <br/> <br/> <br/> <object data=http://xx.xxx.xxx.xxx/???/???/???/?/ width="1000" height="300"> <embed src=http://xx.xxx.xxx.xxx/???/???/???/?/ width="600" height="400"> </embed> Error: Embedded data could not be displayed. </object> </body> </html> --------------------- Thanks guys, once I get this I will be very happy :D Quote Link to comment Share on other sites More sharing options...
digip Posted May 10, 2011 Share Posted May 10, 2011 (edited) The other option is to have either a drop down of all songs, or maybe list them all with check boxes, then combine selected songs into a play-list to queue them up. There is actual software for this for streaming music such as MP3's via web pages, but I can't remember the name of it nor if it was free. Its a php driven backed that works kind of like a media center in your browser, indexes all your music for you when put in the media folder, and you can use it on web sites and intranets and have user accounts created for saved playlists, etc. I don't know the name but if I can find the link again, I'll post it. edit: Found something similar but not the one I was looking for. Check out http://musicbrowser.sourceforge.net/ Not the prettiest thing out there, but I guess you could customize all of it to your needs and use it as a base. Edited May 10, 2011 by digip Quote Link to comment Share on other sites More sharing options...
Infiltrator Posted May 10, 2011 Share Posted May 10, 2011 I personally use http://www.vibestreamer.com/, to stream mp3 off my computer to the web. It has its own web-interface where you can view all artists as as well as select which songs you want to play. Quote Link to comment Share on other sites More sharing options...
poxyexams Posted May 10, 2011 Author Share Posted May 10, 2011 Going to check these out later guys, only thing is my website is on a server online. My music is on the external hard drive connected to the router. Will these applications/programs only scan the music in your web server folder? /var/wwww/etc.... I need it to scan xx.xxx.xxx/shares/usb/x/ Wonder can I have the application running on the server online and scan music on that external usb. Quote Link to comment Share on other sites More sharing options...
Infiltrator Posted May 11, 2011 Share Posted May 11, 2011 (edited) Going to check these out later guys, only thing is my website is on a server online. My music is on the external hard drive connected to the router. Will these applications/programs only scan the music in your web server folder? /var/wwww/etc.... I need it to scan xx.xxx.xxx/shares/usb/x/ Wonder can I have the application running on the server online and scan music on that external usb. It shouldn't be a problem, what you need to do is on the server map a network drive pointing to the external hard drive. For example, say your router ip address is 10.0.0.1 and your share name is "share". So to map the network drive, all you need to do is connect to \\10.0.0.1\<share name>, once connected it should look just like a normal drive on your server, C:\ or D:\. Edited May 11, 2011 by Infiltrator Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.