Project

General

Profile

Bug #253

Track Play doenst work on Google Chrome

Added by Massimiliano Piscitelli about 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
02/25/2020
Due date:
% Done:

0%

Estimated time:
Affected version:

Description

When i try to Play a Track with "Track Play" command that has been previously loaded correctly from the filesystem with "Track Load" Command it doesnt play anything (no errors happen).
But if i try to execute from the html the file index.html locally trough Internet Explorer or Edge The Music works correctly, otherwise when i try to launch the index.html from Chrome Browser doesnt work.

Example:

Track Load "milky.xm",10
Track Play 10,0
wait key

Suggestion:
in the example of the game BAOX by Baptiste BIDEAUX the Music Track works also in Chrome and inside AOZ Environment.

#1

Updated by Massimiliano Piscitelli about 4 years ago

  • Assignee changed from Francois Lionet to Massimiliano Piscitelli

Solved!!!
The Command TrackLoad needs time to load the music in the bank.

Solution:
Waiting until the Track is loaded into the bank.

Suggestion:
A Function that returns True when the Track is loaded into the bank.
(i checked length(bank) and blength(bank) but bothes return error (bank not reserved).

#2

Updated by Massimiliano Piscitelli about 4 years ago

  • Assignee changed from Massimiliano Piscitelli to Francois Lionet
#3

Updated by Massimiliano Piscitelli about 4 years ago

  • Subject changed from Track Play on AOZ 0.9.5 beta to Track Play
#4

Updated by Massimiliano Piscitelli about 4 years ago

  • Subject changed from Track Play to Track Play doenst work on Google Chrome
#5

Updated by Francois Lionet about 4 years ago

  • Assignee changed from Francois Lionet to Baptiste Bideaux
#6

Updated by Baptiste Bideaux about 4 years ago

Please, could you give us the module file ? To test it.

Thanks

#7

Updated by Anonymous about 4 years ago

It happens With all music modules i tested but if i add a wait key instruction between track load and track Play then it plays correctly in Chrome. With the other browsers work always also without a wait key command.

#8

Updated by Baptiste Bideaux about 4 years ago

Under Chrome there is a Security to play media:
"The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu"

We can't to autoplay sound, music or video without action by the user. It is security imposed by the browser, and we are looking for a reliable way over time to work around this.

#9

Updated by Massimiliano Piscitelli about 4 years ago

Well, at this point it would be useful to have a function to check in which browser we are running our code, in order to ask the user a request to activate all multimedia operations.

#10

Updated by Francois Lionet about 4 years ago

  • Status changed from New to Feedback

... normally, if you have a splash screen AND sounds in the application, the splash screen displays , thus enabling sounds in Chrome.
There is not much I can do, if you remove the splashScreen, you have to know what you do! ;)

#11

Updated by Brian Flanagan over 3 years ago

  • Status changed from Feedback to Resolved
  • Target version set to 0.9.9.4

This works fine in the current version of AOZ (0.9.9.4 rel1). If you just change the order of your code, it will work fine with or without the splash screen in the AOZ Viewer or Browser.

Put the Wait Key just before the Track Play instead of after.
This will give the music time to load, and will provide the user interaction needed by Chrome.

Track Load "milky.xm",10
Print "Press a key to enable music."
Wait Key
Track Play 10,0

If you want to get rid of the splash screen, and detect Chrome, with a conditional message, here's a solution:

#splashScreen: false

Result = 0

Function "isChrome"
{
    result = navigator.userAgent.toLowerCase().indexOf('chrome')  > -1;
}
End Function( { result } )

Track Load "milky.xm",10
    If (isChrome)
        Print "Press any key to enable music."
        Wait Key
    End If
Track Play 10,0
#12

Updated by Brian Flanagan over 3 years ago

Oh, sorry, ignore the "Result = 0" at the top.
I meant to remove that from the code.

#13

Updated by Brian Flanagan over 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF