Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: play music thats on your computer...

  1. #1
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default play music thats on your computer...

    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
    The web in one word.

  2. #2
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Code:
    <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
    - Mike

  3. #3
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Also, if anyone could give me an alternative for the <bgsound> tag for playing music it would be greatly appreciated. Here's the script:

    Code:
    <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>
    - Mike

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    http://www.dynamicdrive.com/forums/s...ead.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.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Quote Originally Posted by Twey
    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
    - Mike

  6. #6
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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
    The web in one word.

  7. #7
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    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.
    - Mike

  8. #8
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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
    The web in one word.

  9. #9
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    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.
    - Mike

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Your whole layout is completely messed up in Konqueror, too.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •