Results 1 to 6 of 6

Thread: player mp3 on this link.

  1. #1
    Join Date
    Apr 2008
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default player mp3 on this link.

    1) Script Title: player mp3 on this link.

    2) Script URL (on DD): http://www.dynamicdrive.com/forums/n...=newthread&f=2
    3) Describe problem: hi, please help me how to make .js. i want playing mp3 on this link
    Code:
    <a href="song.mp3">song</a>
    .... it same here.
    Thanks a lot

  2. #2
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    Are you saying you want the same effect as that site? All they did was link to the file so that, when a user clicks the link, the file opens in a player (such as windows media player). In other words, they did what you did with that link. The method usually works just fine.

    If you want to actually embed a player in a webpage, that's a little different. The easiest way would be to have a popup window open onclick. The new window would have a player inside, and can use the URL or a cookie to figure out what song to play. You might look at this tutorial.
    Or this script.

    Or are you talking about music in the background of the webpage?
    Last edited by Jas; 04-03-2008 at 05:40 PM.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  3. The Following User Says Thank You to Jas For This Useful Post:

    kenphan19 (04-03-2008)

  4. #3
    Join Date
    Apr 2008
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    thanks so much.

  5. #4
    Join Date
    Apr 2008
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    this code below playing mp3 when in HTML source have code href="htttp://....song.mp3" ... however i want update it playing .wma ... please help me how to edit this script to playing wma.
    Thanks so much.
    Click here to see it run.
    if(typeof(p) == 'undefined') p = {}
    p.m = {
    x: null,
    y: null,
    g: function() {
    var all = document.getElementsByTagName('a')
    for (var i = 0, o; o = all[i]; i++) {
    if(o.href.match(/\.mp3$/i)) {
    var r = document.createElement('img')
    r.src = 'http://localhost/test/php/player/play.gif'; r.title = 'Play'
    r.height = 19
    r.width = 59
    r.style.padding= '0px 5px 0px 2px'
    r.style.display = 'block'
    r.style.marginLeft = '0'
    r.style.cursor = 'pointer'
    r.style.verticalAlign = 'middle'
    r.style.border = '0'
    r.onclick = p.m.makeToggle(r, o.href)
    o.parentNode.insertBefore(r, o)
    }}},
    toggle: function(r, u) {
    if (p.m.x == r) p.m.destroy()
    else {
    if (p.m.x) p.m.destroy()
    var a = r.nextSibling, c=''
    if (document.defaultView && document.defaultView.getComputedStyle) c = document.defaultView.getComputedStyle(a,null).getPropertyValue('color')
    else if (a.currentStyle) c = a.currentStyle['color']
    c = c.replace(/^rgb|[ ()]/g, '')
    var hex = c.match(/^#?([a-f0-9]{6})$/), hexSm = c.match(/^#?([a-f0-9]{3})$/), rgb = c.match(/^([0-9]+),([0-9]+),([0-9]+)$/)
    if (rgb) { var c16 = "0123456789abcdef", c=''; for(var i=1,d;d=rgb[i];i++) { var j=d%16; c=c+c16.charAt((d-j)/16)+c16.charAt(j) } }
    else if (hex) c = hex[1]
    else if (hexSm) c = hexSm[1].charAt(0) + hexSm[1].charAt(0) + hexSm[1].charAt(1) + hexSm[1].charAt(1) + hexSm[1].charAt(2) + hexSm[1].charAt(2)
    else c = "000000"

    r.src = 'http://localhost/test/php/player/stop.gif'; r.title = 'Stop playing'; p.m.x = r;
    p.m.y = document.createElement('span')
    p.m.y.innerHTML = '<object style="vertical-align:bottom; margin-top:2px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' +
    'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"' +
    'width="50" height="14" id="y" align="middle">' +
    '<param name="wmode" value="transparent" />' +
    '<param name="allowScriptAccess" value="sameDomain" />' +
    '<param name="flashVars" value="theLink='+u+'&amp;fontColor='+c+'" />' +
    '<param name="movie" value="http://localhost/test/php/player/mp3.swf" /><param name="quality" value="high" />' +
    '<embed style="vertical-align:bottom; margin-top:5px;" src="http://localhost/test/php/player/mp3.swf" flashVars="theLink='+u+'&amp;fontColor='+c+'"'+
    'quality="high" wmode="transparent" width="50" height="14" name="y"' +
    'align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"' +
    ' pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>'
    r.parentNode.insertBefore(p.m.y, r.nextSibling)
    }},
    destroy: function() {
    p.m.x.src = 'http://localhost/test/php/player/finish.gif'; p.m.x = null
    p.m.y.removeChild(p.m.y.firstChild); p.m.y.parentNode.removeChild(p.m.y); p.m.y = null
    },
    makeToggle: function(r, u) { return function(){ p.m.toggle(r, u) }}
    }

    p.addLoadEvent = function(f) { var old = window.onload
    if (typeof old != 'function') window.onload = f
    else { window.onload = function() { old(); f() }}
    }

    p.addLoadEvent(p.m.g)
    Last edited by kenphan19; 04-09-2008 at 03:12 PM.

  6. #5
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    I don't think I understand the question. Can you explain more?
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  7. #6
    Join Date
    Apr 2008
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    i want edit this script, it will play .wma, Click here to see it run.

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
  •