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.
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>'; })();
Helpful? Donate. Thanks!
Fast VPS Host for vBulletin:
A2 Hosting & 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.Helpful? Donate. Thanks!
Fast VPS Host for vBulletin:
A2 Hosting & IONOS
- Top
- Translate
- Bottom
Comment
-
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>
Helpful? Donate. Thanks!
Fast VPS Host for vBulletin:
A2 Hosting & 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.
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:
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>
Helpful? Donate. Thanks!
Fast VPS Host for vBulletin:
A2 Hosting & 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 luckyHelpful? Donate. Thanks!
Fast VPS Host for vBulletin:
A2 Hosting & 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.
Helpful? Donate. Thanks!
Fast VPS Host for vBulletin:
A2 Hosting & IONOS
- Top
- Translate
- Bottom
Comment
Users Viewing This Page
Collapse
There is 1 user viewing this forum topic.
- Guest
Latest Posts
Collapse
-
Reply to Topic Starter Ribbon for vBCloudby MitchGood Day Glenn!! I implemented the above hook #1-#10. My font style and size changed when typing a reply to a post. Not sure if it also changed in other...Today, 03:25 AM
-
Reply to Topic Starter Ribbon for vBCloudby glennrocksvbMitch I've added the fix for this mod. Please refer to the "Fix for vB 6.0.4 and later" section in the updated first post....Yesterday, 10:26 PM
Comment