Hi all.
First post on a great forum. Unfortunately it’s a shout out for help please.
I have a blogger blog and have tried to put in an auto play audio tag into the main forum landing page.
As the landing page isn’t a post, I have put the audio tag html in the theme html in the body.
When you navigate to the page from the website address or a browser, the audio doesn’t play, but if you open a post then use the back button to go back to the landing page, the audio then plays fine.
Can anyone advise why this is happening?
Initially the audio had no visual but I added the controls attribute and it looks like the auto play attribute isn’t initially kicking in, but does kick in when you hit the back button back to Landing page.
Hi and welcome!
Hard to say without seeing the page. Could it be that the audio simply haven't had time to load?
In theory a javascript on the page may only start the player if there's a Referer header (or even a cookie set on the other pages), but that sounds farfetched (also I can't remember if using the Back button sends a Referer header).
Many users may also disable autoplay in their own browser settings, but then it should never work of course.
Hi.
Thanks for the reply!
The website is a blogspot blog and my audio playing code inserted into the body of the page is this:
<b:if cond='data:blog.url == "https://mr-flibbles-lair.blogspot.com/"'>
<audio autoplay='1' controls='1' id='myaudio' loop='1'>
<source src='https://andy-lawson.uk/Mr Flibbles Lair/Red Dwarf - Series 7/Music Cues/8 Rimmer Munchkin Song.mp3' type='audio/mpg'/>
</audio>
</b:if>
I made the control panel temporarily visible so that I could see that the link to the audio file was being picked up, and that the <b:if> tag was activating correctly for that URL only.
Everything looks good so I am assuming that on first landing that the autoplay is blocked, but still cant figure why going back to the page allows it to play.
I don't know blogger lingo, but I doubt the quotes here should be escaped.
Hi there Retrotechy,
further to testing your code with @pandy's suggestion...CODE
src="https://andy-lawson.uk/Mr%20Flibbles%20Lair/Red Dwarf%20-%20Series%207/Music%20Cues/8%20Rimmer%20Munchkin%20Song.mp3"
...I found that in all my test browsers the audio still failed to play.
The problem turned out to be caused by this...CODE
type="audio/mpg"
It required...CODE
type="audio/mpeg"
...to workCODE
<audio controls autoplay loop muted>
<source
src="https://andy-lawson.uk/Mr%20Flibbles%20Lair/Red Dwarf%20-%20Series%207/Music%20Cues/8%20Rimmer%20Munchkin%20Song.mp3"
type="audio/mpeg">
</audio>
Online it was audio/mp3. I never checked if that's kosher, but I did change to audio/mpeg and it still didn't work for me.
My tests were with windows 10 and Linux Mint 20.3
In Firefox, using the code which I posted, the audio auto-started and looped but required manual volume
In Chrome, the audio required manual controls.
Your...CODE
type="audio/mp3"
...also worked OK for me.
Hi there pandy,
here is an interesting article with regard to mp3/mpeg usage...
http://www.differencebetween.net/technology/protocols-formats/difference-between-mpeg-and-mp3/
Hi,
Many thanks for all of the responses and info.
I have removed / adjusted spaces in the mp3 URL and also corrected the type to mpeg but still no joy.
I am guessing that the autoplay prohibited unless muted function is the reason it wont play.
Many thanks for all of the comments and advice.
Are you certain that the code that you are using for your test(s) is not faulty?
Check out my test code here...
https://www.mediafire.com/file/s18rk721vuq242n/munchkin-song.zip/file
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)