• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Sound works in Edge and not in Chrome

Participant ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

With this code

<!DOCTYPE html>

<html>

<head>

</head>

<body onload="init()">

<script type="text/javascript" src="soundjs-NEXT.js"></script>

<script>

var src = "fransk1.mp3";  // set up our source

var soundInstance;      // the sound instance we create

function init() {

createjs.Sound.on("fileload", handleLoad, this); // add an event listener for when load is completed

createjs.Sound.registerSound(src);  // register sound, which will preload automatically

}

function handleLoad(evt) {

startPlayback();

}

function startPlayback(evt) {

if (soundInstance) {

return;

}

soundInstance = createjs.Sound.play(src);

}

</script>

</body>

</html>

I'm not getting any sound to boot in the browser Chrome version 71.0.3578.80 but on the other hand, the sound works in the Microsoft Edge browser.

Why is it so wondering I over.

Views

548

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

What is your code?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

open your developers console (ctrl-i) and check.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

LATEST

In browser Chrome developers console so show this soundjs-NEXT.js:7197 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. s._isFileXHRSupported @ soundjs-NEXT.js:7197 soundjs-NEXT.js:7207 Access to XMLHttpRequest at 'file:///C:/Users/%C3%84garen/Documents/HTML5%20canvas/SoundJS-1.0.0/SoundJS-1.0.0/examples/WebAudioPluginTest.fail' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. s._isFileXHRSupported @ soundjs-NEXT.js:7207 soundjs-NEXT.js:7726 Uncaught (in promise) DOMException

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

Here it is:

<!DOCTYPE html>

<html>

<head>

</head>

<body onload="init()">

<script type="text/javascript" src="soundjs-NEXT.js"></script>

<script>

var src = "fransk1.mp3";  // set up our source

var soundInstance;      // the sound instance we create

function init() {

createjs.Sound.on("fileload", handleLoad, this); // add an event listener for when load is completed

createjs.Sound.registerSound(src);  // register sound, which will preload automatically

}

function handleLoad(evt) {

startPlayback();

}

function startPlayback(evt) {

if (soundInstance) {

return;

}

soundInstance = createjs.Sound.play(src);

}

</script>

</body>

</html>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines