PDA

View Full Version : play music thats on your computer...



queerfm
12-31-2006, 09:49 PM
Hi i would like to let people play the music on there computer on my website.
you see i have finished a site that is very much like windows media center, the only thing it is missing is letting the using watch his or video and listen to there music on there computer. i was wondering if any one would be able to help.

Thanks

mburt
01-02-2007, 06:37 PM
<iframe src="http://mburt.mb.funpic.org/player/media_player.htm" width="450" height="200" scrolling="no" frameborder="0"></iframe>
Tada!
... well sort of. I'm trying to work out the kinks. As of now, it only works for internet explorer :( . Giving <bgsound> an ID tag doesn't want to work in firefox

mburt
01-02-2007, 07:09 PM
Also, if anyone could give me an alternative for the <bgsound> tag for playing music it would be greatly appreciated. Here's the script:


<html>
<head>
<bgsound id="sound">
<script type="text/javascript">
var i = 0
var stringedData = ""
var record = new Array
function add() {
var ext = data.value.substring(data.value.length-4,data.value.length)
if (ext == ".mp3" || ext == ".wav") {
i = i + 1
record.push(data.value)
var space = "<br>"
if (i == 1) {
space = ""
}
else {
space = "<br>"
}
strData()
var html = space+"<a href=\"#\" title=\"play "+stringedData+"\" onclick=\"play(this)\">"+i+". "+stringedData+"</a>"
var store1 = document.getElementById("store")
store1.innerHTML += html
}
else {
alert("Invalid music file. Data may be corrupted.")
}
}
function strData() {
for (x = 0;x < data.value.length;x++) {
if (data.value.charAt(x) == "\\") {
stringedData = data.value.substring(x+1,data.value.length)
}
}
}
function play(id) {
document.getElementById("sound").src = record[id.innerText.substring(0,1)-1]
id.className = "hilite"
id.style.color = "white"
id.onblur = function() {
player.onclick = function() {
id.className = "lolite"
id.style.color = "black"
}
}
showplaying()
}
function stop() {
document.getElementById("sound").src = ""
}
function showplaying() {
nowplaying.innerHTML = "Now Playing: " + stringedData
}
</script>
<style type="text/css">
...
</style>
</head>
<body>
<div id="player">
<img src="header.png" style="float:left"><div style="float:left;font:11px verdana" id="nowplaying"></div>
<br>
<input type="file" id="data">
<input type="button" id="confirm" value="Add to Playlist" onclick="add()">
<div id="store">
<div id="header">playlist</div>
</div>
<div id="outer">
<a href="#" onclick="stop()">[stop]</a>
</div>
</div>
</body>
</html>

Twey
01-02-2007, 07:34 PM
http://www.dynamicdrive.com/forums/showthread.php?t=2789

However, I don't think this is what was being asked. I can't see a way to do that, due to security precautions.

mburt
01-03-2007, 02:05 AM
However, I don't think this is what was being asked.
Ah, sorry about that, I missed read the OP's original question. I thought I was on a roll... lol

queerfm
01-04-2007, 02:52 PM
Mburt,

I like your first script http://mburt.mb.funpic.org/player/media_player.htm however is there anyway it can get any music in a persons computer that is in the my music folder if they are using windows and if it could also get the mac osx music? i don't know what folder that is in.

Also can the script work in firefox

mburt
01-04-2007, 03:04 PM
Not everyone has a "My Music" folder (i do) so I'm not sure if that method is reliable.
I'm trying to work out the bugs for firefox. :)
I'll get back to you as soon as I can.

queerfm
01-04-2007, 03:12 PM
also about your script why not make it play in a embeded player?
I think that way it would be great also if you could get it to scan the computer for songs

mburt
01-04-2007, 03:20 PM
Actually, that's funny, because Im working on an embedded music function now. All that's to it is to get it to switch songs.

Twey
01-04-2007, 03:37 PM
Your whole layout is completely messed up in Konqueror, too.

mburt
01-04-2007, 06:37 PM
Ok. Layout fixed, design fixed. It should work in both IE and FF (the two browsers I have) and it uses <embed> now too. (Same link as above)

mburt
01-04-2007, 07:52 PM
Oh crap... more layout issues! As I said before the same link was used, so I'll keep posting here for updates.

queerfm
01-05-2007, 09:59 PM
where is the script

mburt
01-05-2007, 11:33 PM
The link is dead... Umm... I don't have any more space on my current ftp host. Sorry, but I'll post the code instead.

queerfm
01-06-2007, 05:49 AM
whats the script?