Announcement

Collapse
No announcement yet.

Forum sound

Collapse
X
Collapse
First Prev Next Last
  • Filter
  • Time
  • Show
Clear All
new posts

    Forum sound

    Is there a way to have a short 5 second or so sound bite when entering a certain forum??

    #2
    If the audio clip is the same for all forums, then use the below audio tag in a hidden (uncheck all 3 checkboxes for "Show module at these screen sizes" module option) Static HTML module you add on the forum page. Update the URL path of the audio file accordingly.
    HTML Code:
    <audio src="path-to-the-audio/forum.mp3" autoplay></audio>
    If using different audio clip for each forum, then name the mp3 audio file with the corresponding forum channel id. For example, "forum-1.mp3" where 1 is the forum channel id. This way, there is a mapping of the audio file with the forum channels. Use the Javascript code below in the same hidden Static HTML module to dynamically generate the <audio> tag with the corresponding mp3 file associated with the forum being loaded on the page. Update the URL path of the audio file accordingly.
    HTML Code:
    <div id="audioContainer"></div>
    <script>
    (function() {
        var container = document.getElementById('audioContainer');
        container.innerHTML = '<audio src="path-to-the-audio/forum-' + pageData.channelid + '.mp3" autoplay></audio>';
    })();

    Comment


      #3
      Glenn

      If the sound path is

      https://soundcloud.com/mitch-auto/al...fe-1-mp3cutnet

      And the forum channel node ID is

      90805

      How would this full code look that gets placed into the HTML box?



      Originally posted by glennrocksvb View Post
      <div id="audioContainer"></div> <script> (function() { var container = document.getElementById('audioContainer'); container.innerHTML = '<audio src="path-to-the-audio/forum-' + pageData.channelid + '.mp3" autoplay></audio>'; })();

      Comment


        #4
        I'll do the code when I get to my laptop.

        Btw, if you want to play the audio in the background without the user seeing the audio controls, then you need use the url of the mp3 file itself. You provided a url to a web page with the audio in it. You need the audio file by itself.

        Comment


          #5
          Yes I would rather not show the audio controls. I have the file saved on my computer too as an MP3 in my downloads.


          Comment


            #6
            Any luck yet?

            Comment


              #7
              Try this:

              Code:
              <div id="audioContainer"></div>
              <script>
              (function() {
                  var forumMp3Files = {
                      1: 'http://example.com/path/to/the/audio.mp3',
                      2: 'http://example.com/path/to/the/audio2.mp3',
                      3: 'http://example.com/path/to/the/audio3.mp3' //no trailing comma at the last item
                  };
                  var container = document.getElementById('audioContainer');
                  container.innerHTML = '<audio src="' + forumMp3Files[pageData.channelid] + '" autoplay></audio>';
              })();
              </script>
              Replace 1, 2 and 3 with the corresponding forum channel node id. Specify the corresponding MP3 URL for each forum channel. Add/remove entries as needed.

              Comment


              #8
              Sorry Glenn but I'm not sure how to get a mp3 file URL. I put it on my google drive and got this share code but it didn't work.

              It seems to be linked but it is not auto playing?? Am I heading in the right direction?

              Code:
              <div id="audioContainer"></div>
              <script>
              (function() {
                  var forumMp3Files = {
                      90805: 'https://drive.google.com/file/d/1in69wM_LQvjkqVOVcjbGGz6fiXkPGbui/view?usp=sharing',
                      91558: 'https://drive.google.com/file/d/1in69wM_LQvjkqVOVcjbGGz6fiXkPGbui/view?usp=sharing',
                      90806: 'https://drive.google.com/file/d/1in69wM_LQvjkqVOVcjbGGz6fiXkPGbui/view?usp=sharing' //no trailing comma at the last item
                  };
                  var container = document.getElementById('audioContainer');
                  container.innerHTML = '<audio src="' + forumMp3Files[pageData.channelid] + '" autoplay></audio>';
              })();
              </script>
              Last edited by glennrocksvb; Yesterday, 04:42 PM. Reason: Enclosed code in [code] tags.

              Comment


                #9
                I checked and extracted this mp3 out of that google drive url.

                Code:
                https://doc-0c-7k-docs.googleusercontent.com/docs/securesc/bl5u2ha0unv4va9ol7st3mdvap8350d1/qkanhk76j73bale1ti7tl56gffi7qgn9/1537315200000/16621386461846305732/12521920234599129277/1in69wM_LQvjkqVOVcjbGGz6fiXkPGbui?e=download&nonce=l3vr7qu8bv8jq&user=12521920234599129277&hash=ts0hv05khqfkobsu6v2lvehnt3iqq1j4
                Use that URL in the code.

                Btw, I noticed that you're using the same url for each forum. If it's the same for all channels, then you can simplify the code to this:
                Code:
                <div id="audioContainer"></div>
                <script>
                (function() {
                    var channelsWithAudio = [90805, 91558, 90806];
                    var mp3 = "https://doc-0c-7k-docs.googleusercontent.com/docs/securesc/bl5u2ha0unv4va9ol7st3mdvap8350d1/qkanhk76j73bale1ti7tl56gffi7qgn9/1537315200000/16621386461846305732/12521920234599129277/1in69wM_LQvjkqVOVcjbGGz6fiXkPGbui?e=download&nonce=l3vr7qu8bv8jq&user=12521920234599129277&hash=ts0hv05khqfkobsu6v2lvehnt3iqq1j4";
                    if (channelsWithAudio.indexOf(Number(pageData.channelid)) !== -1) {
                        var container = document.getElementById('audioContainer');
                        container.innerHTML = '<audio src="' + mp3 + '" autoplay></audio>';
                    }
                })();
                </script>
                If not the same, then use this updated code:
                Code:
                <div id="audioContainer"></div>
                <script>
                (function() {
                    var forumMp3Files = {
                        1: 'http://example.com/path/to/the/audio.mp3',
                        2: 'http://example.com/path/to/the/audio2.mp3',
                        3: 'http://example.com/path/to/the/audio3.mp3' //no trailing comma at the last item
                    };
                    if (forumMp3Files[pageData.channelid]) {
                        var container = document.getElementById('audioContainer');
                        container.innerHTML = '<audio src="' + forumMp3Files[pageData.channelid] + '" autoplay></audio>';
                    }
                })();
                </script>

                Comment


                  #10
                  Code:
                  <div id="audioContainer"></div>
                  <script>
                  (function() {
                      var channelsWithAudio = [90805, 91558, 90806];
                      var mp3 = "https://doc-0c-7k-docs.googleusercontent.com/docs/securesc/bl5u2ha0unv4va9ol7st3mdvap8350d1/qkanhk76j73bale1ti7tl56gffi7qgn9/1537315200000/16621386461846305732/12521920234599129277/1in69wM_LQvjkqVOVcjbGGz6fiXkPGbui?e=download&nonce =l3vr7qu8bv8jq&user=12521920234599129277&hash=ts0h v05khqfkobsu6v2lvehnt3iqq1j4";
                      if (channelsWithAudio.indexOf(Number(pageData.channel id)) !== -1) {
                          var container = document.getElementById('audioContainer');
                          container.innerHTML = '<audio src="' + mp3 + '" autoplay></audio>';
                      }
                  })();
                  </script>

                  I put this in and still nada?

                  HTML module, all 3 boxes unchecked
                  Last edited by glennrocksvb; Yesterday, 04:41 PM. Reason: Enclosed code in [code] tags.

                  Comment


                  • glennrocksvb
                    glennrocksvb commented
                    Editing a comment
                    I checked your "Early Modified" forum page and I hear the audio clip on page load in Chrome browser. You should see a speaker icon in the browser tab while the audio is playing.

                  #11
                  Glenn I tried it with the "google direct link generator" and this code came out

                  https://drive.google.com/uc?export=d...VOVcjbGGz6fiXk PGbui

                  Replaced the code above and it worked... I guess I got lucky

                  Comment


                    #12
                    Originally posted by Mitch View Post
                    Glenn I tried it with the "google direct link generator" and this code came out

                    https://drive.google.com/uc?export=d...VOVcjbGGz6fiXk PGbui

                    Replaced the code above and it worked... I guess I got lucky
                    awesome old school GIF

                    Comment


                      #13
                      HaHa

                      Now if you can figure out how to make these Gif's easy links work on the cloud I would buy a weeks worth of coffee

                      dexters laboratory laughing GIF

                      Comment


                      • glennrocksvb
                        glennrocksvb commented
                        Editing a comment
                        Unfortunately, this mod cannot be done on vBCloud due to its restrictions

                      #14

                      I don't hear it on my Ipad or iphone?!!

                      Could that be a code issue?

                      Comment


                        #15
                        That could be related to these:

                        https://stackoverflow.com/questions/...99252#36299252
                        https://developer.apple.com/library/...TP40006514-SW6

                        Apple has special server requirements for iOS to play audio/video. This is a server configuration and/or code issue, in your case, Google Drive's.

                        This also affects vBulletin if you upload an audio or video file to vBulletin. I created a bug ticket for this and vB is working on it.

                        https://tracker.vbulletin.com/vbulle...sues/VBV-18743

                        Comment


                        • Mitch
                          Mitch commented
                          Editing a comment
                          Gottchya,, Thank you for all your help on this
                      Working...
                      X