Sign in to follow this  
Kapricioza

Play custom music using CEF

Recommended Posts

Hello, I'm trying to play custom music in game using CEF, but It only works when audio is very short (less then 10s). 

I'm using .ogg format and this code:

function playAudio() {
	let myAudio = new Audio("sampel.ogg");
	myAudio.play();
	myAudio.volume = 0.1;
}

Is there any limit to using custom songs?

Share this post


Link to post
Share on other sites

Hello Kapricioza

11 minutes ago, Kapricioza said:

Hello, I'm trying to play custom music in game using CEF, but It only works when audio is very short (less then 10s). 

I'm using .ogg format and this code:

function playAudio() {
	let myAudio = new Audio("sampel.ogg");
	myAudio.play();
	myAudio.volume = 0.1;
}

Is there any limit to using custom songs?

Have you try to use 

myAudio.load();

before play?

I already warn you that I'm not sure if still gonna work cuz chrome had some policy changes with audio. 

https://developers.google.com/web/updates/2017/09/autoplay-policy-changes

Edited by Robson

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.