howler.js icon indicating copy to clipboard operation
howler.js copied to clipboard

onplayerror not firing (2.1.2)

Open indexofrefraction opened this issue 5 years ago • 5 comments

using the code from the documentation i can not get onplayerror to fire

with example below / on safari and chrome desktop: audio play is denied, but onplayerror does not fire the sound then plays with the first touch/click (onplay is fired)

var sound = new Howl({
	src: ['blank.webm', 'blank.mp3'],
	onplay: function() {
		console.log('audio playing!');
	},
	onplayerror: function() {
		console.log('audio play denied!');
		sound.once('unlock', function() {
			console.log('audio play unlocked!');
		});
	}
});
sound.play();

ps. as playing limitations affect all mayor browsers now, maybe the error messages could be updated (line 898 and 917)

indexofrefraction avatar May 04 '19 21:05 indexofrefraction