Results 1 to 4 of 4

Thread: Background music code

  1. #1
    Join Date
    Oct 2013
    Posts
    59
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Background music code

    I've did a search here and came across several old background music javascript codes but really didn't like any of them. What I would really like is a very simple code that allows me to put it on my forum/s in the main header that will play the music I select on all categories or boards or if I choose to do so just put it in a single board header or footer.

    I don't want a pause, stop, play or any other button, and it can be made to just play one link that I choose such as a wav or mp3 link. If I want to change the music I can simply change the link.

    Can someone point me in the right direction here?

    Thanks

  2. #2
    Join Date
    Jan 2009
    Location
    NH
    Posts
    339
    Thanks
    47
    Thanked 8 Times in 8 Posts

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,192 Times in 3,155 Posts
    Blog Entries
    12

    Default

    I would add that you might not want any buttons, but I can guarantee that your users will want a stop button.

    See also:

    http://www.dynamicdrive.com/dynamici...udioplayer.htm
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Oct 2013
    Posts
    59
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Love the Jplayer but a little confused as to how to make it work? Tried putting it in just a footer of a test forum with no luck. Also John this music will be a isolated background music sound and not for the general public of the forum in general so again I want no buttons.


    So this is the Jplayer code:

    Code:
     <html>
    <head>
      <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
      <script type="text/javascript" src="/js/jquery.jplayer.min.js"></script>
      <script type="text/javascript">
        $(document).ready(function(){
          $("#jquery_jplayer_1").jPlayer({
            ready: function() {
              $(this).jPlayer("setMedia", {
                mp3: "http://www.jplayer.org/audio/mp3/Miaow-snip-Stirring-of-a-fool.mp3"
              }).jPlayer("play");
              var click = document.ontouchstart === undefined ? 'click' : 'touchstart';
              var kickoff = function () {
                $("#jquery_jplayer_1").jPlayer("play");
                document.documentElement.removeEventListener(click, kickoff, true);
              };
              document.documentElement.addEventListener(click, kickoff, true);
            },
            loop: true,
            swfPath: "/js"
          });
        });
      </script>
    </head>
    <body>
      <div id="jquery_jplayer_1"></div>
    </body>
    </html>
    Now I don't think I need the <head> and <body> tags for a header or footer code? An example, here is a javascript code I use for a blinking text name in the mini profile of members:

    Code:
    <script type="text/javascript">
      function blink() {
        var blinks = document.getElementsByTagName('blink');
        for (var i = blinks.length - 1; i >= 0; i--) {
          var s = blinks[i];
          s.style.visibility = (s.style.visibility === 'visible') ? 'hidden' : 'visible';
        }
        window.setTimeout(blink, 1000);
      }
      if (document.addEventListener) document.addEventListener("DOMContentLoaded", blink, false);
      else if (window.addEventListener) window.addEventListener("load", blink, false);
      else if (window.attachEvent) window.attachEvent("onload", blink);
      else window.onload = blink;
    </script>
    That goes in my global footer and then I put this in the mini profile templates to make it work in that area:

    Code:
    {if $[user.is_online]}<br /><span class="italic"><blink>Member is Online</blink>{/if}
    So is this Jplayer code similar? If not what do I do to make it work?

Similar Threads

  1. background music problem
    By drosster in forum PHP
    Replies: 15
    Last Post: 12-31-2011, 06:13 PM
  2. background music problem
    By drosster in forum HTML
    Replies: 2
    Last Post: 12-14-2011, 01:05 AM
  3. Need Background music carosal or playlist code
    By hrfassoc in forum Looking for such a script or service
    Replies: 3
    Last Post: 11-29-2011, 03:14 PM
  4. Need help adding background music
    By Dakaa in forum HTML
    Replies: 3
    Last Post: 12-22-2006, 03:13 PM
  5. I Need Help With My Background Music
    By thesent in forum CSS
    Replies: 4
    Last Post: 03-28-2006, 06:23 AM

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
  •