Is there a way to have a short 5 second or so sound bite when entering a certain forum??
Announcement
Collapse
No announcement yet.
Forum sound
Collapse
X
-
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.
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:<audio src="path-to-the-audio/forum.mp3" autoplay></audio>
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>'; })();

My Amazon Affiliate Link
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
- Likes 1
-
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>'; })();
- Top
- Translate
- Bottom
Comment
-
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.
My Amazon Affiliate Link
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
Comment
-
Try this:
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.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>
My Amazon Affiliate Link
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
Comment
-
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>
- Top
- Translate
- Bottom
Comment
-
I checked and extracted this mp3 out of that google drive url.
Use that URL in the code.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
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:
If not the same, then use this updated code: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>
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>
My Amazon Affiliate Link
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
Comment
-
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
- Top
- Translate
- Bottom
Comment
-
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
- Top
- Translate
- Bottom
Comment
-
Originally posted by Mitch View PostGlenn 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

My Amazon Affiliate Link
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
Comment
-
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
- Top
- Translate
- Bottom
Comment
-
That could be related to these:
We have an MP4 video on our site; it plays fine in IE9+, Firefox, Chrome, and Chrome on mac. However, on Safari, the video doesn't play at all - it does trigger a "stalled" event and then nothing l...
Conceptual information and techniques on creating effective web content for Safari and WebKit using HTML, JavaScript, and CSS.
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.

My Amazon Affiliate Link
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
Comment
Latest Posts
Collapse
-
Reply to some ideas for new modsin Chit Chatby desmomax
I finally created a mod that allows you to add an icon to each post with options for sharing on other platforms. I honestly thought it was absurd that...
Today, 03:59 AM -
by flohseHi Glenn, what do you think about adding "Like Counts" similar to "Like Counts on Postbit and Profile" (when this mod is in use) in...Yesterday, 11:28 PM
-
Get Affordable and Fast VPS for vBulletin -
Reply to push notification prompt?by desmomaxhy glenn
have you thought about this?Yesterday, 05:44 AM

Comment