Html5 Audio issue with Chrome.

Monkey Forums/Monkey Bug Reports/Html5 Audio issue with Chrome.

Paul - Taiphoz(Posted 2014) [#1]
I initially thought this might be an issue with Diddy but now I think it might be a bug with monkey, I know html5 has patchy results with playing sound so I tested with all three formats and the results the same.

This code builds and runs fine in flash, and probably all the other targets providing you un-comment the right media file format for compatibility.

However when building to html5, chrome will not play the music, IE and FireFox will play the music..


Import mojo

Class Bug Extends App
	

	Method OnCreate:Int()
		SetUpdateRate(60)
		Return 0
	End
	
	Method OnUpdate:Int()
		If Not MusicState() Then PlayMusic("music/somber.mp3",1) 'fails in chrome
		'If Not MusicState() Then PlayMusic("music/somber.wav",1) 'fails in chrome
		'If Not MusicState() Then PlayMusic("music/somber.ogg",1) 'fails in chrome
		Return 0
	End
	
	Method OnRender:Int()
		Cls()

		Return 0
	End
	
End

Function Main:Int()
	New Bug()
	Return 0
End



dawlane(Posted 2014) [#2]
I would have a look at what audio formats are supported by each of those browsers. Not all browsers support all audio formats due to license issues.


Paul - Taiphoz(Posted 2014) [#3]
That was the first thing I did, also why the above test has three audio formats in it, chrome supports mp3,ogg and wav..

Audio Formats and Browser Support
Browser				MP3	Wav	Ogg
Internet Explorer		YES	NO	NO
Chrome				YES	YES	YES
Firefox				YES	YES	YES
Safari				YES	YES	NO
Opera				NO	YES	YES



SLotman(Posted 2014) [#4]
Here Chrome plays mp3 fine - with Monkey v77b - I'm not using Diddy. Are you sure music is being copied to <app>/data/music folder?

Maybe you could try without MusicState? I don't use it, maybe that's the problem?
Edit: Nope, I ran your sample program above and it worked for me, right of the bat - tested with mp3, chrome version 26.0.1410.64 m.


Paul - Taiphoz(Posted 2014) [#5]
Yeah Ted 1.19 and Monkey 77b here as well.

I might try it on chrome on another PC and see if its possibly my Chrome, if it turns out to be Chrome (mine) tho it is wierd that flash plays fine. in the same browser.


Paul - Taiphoz(Posted 2014) [#6]
OK...

I think, still not 100% sure, but I think its AdBlock a plugin for Chrome thats getting in the way, now I have adblock disabled, and the song wont play the first time but if I hit refresh it then plays, which is odd because nothing changes between the refresh, I have tested on another computer and it works 100% of the time.

So not exactly sure what adBlock is actually doing but its doing something even when its not supposed to be active. so if your having bother with music and html5 and you have adblock then it could be that causing the problem.

Thanks Slotman once I knew it was playing on other PC's with Chrome and the same monkey version I knew it had to be something outside of monkey...