[Firefox] Restart Music when reloading a layout

Get help using Construct 2

Post » Sun Feb 12, 2017 8:20 am

Hello,

I have a strange behaviour on Firefox. What I want to do :
* start a music at the start of a layout,
* stop it at the end
* and restart it when I restart the layout.

It work well on all the browsers I tried except on Firefox (which is my favourite browser :( ).

Here's the capx :
https://drive.google.com/open?id=0B-CQs9SaQCHFb2RsUGhxZENTRjg

Did someone have an idea to make it work on Firefox ?

Thank you for your help
B
14
S
4
Posts: 22
Reputation: 946

Post » Sun Feb 12, 2017 9:18 am

Hey claurent9, :)

I spent some time trying to figure out what was going on, and to summarize my findings, you can drag the music files from the "Music" folder, into the "Sounds" folder, and that should solve the Firefox issue.


What I tried
I tried running your project in Chrome, Opera, IE, Iron, NWjs, and Firefox, and only Firefox seemed to fail to restart the music correctly.

I added a hotkey to restart the music without restarting the layout, and that also failed to restart the music in Firefox, so the problem seems to be independent of the layout restart.

I ran the project in debug mode, and inspected the "Audio" object.
When the music plays for the first time, the "Currently playing" debug field reports the audio as playing, and shows the play progress in seconds for the audio file.
If the music is restarted, the "Currently playing" debug field reports the file as playing and shows the realtime progress just as before, but no audio plays.
So the Audio object thinks it is playing the audio file, but Firefox isn't creating any sound.

To use debug mode
1. Choose the "Home" tab on the ribbon, and click the "Debug layout" button.
When your project starts up there will be a debug panel in the bottom of the window.)
2. On the debug panel, on the bar, at the very right, click the diagonal arrow button "⇗" , to break the debug panel into it's own window.
The debug panel acts like an x-ray view into the insides of all the objects in your game.


Finally, I noticed that the music files were in the "Music" folder, instead of the "Sounds" folder.
I moved the files to the "Sounds" folder (you can just drag and drop from one to the other), in case the issue was streaming related, and afterwards the music restarted in Firefox, without a problem.


Possible cause
If I recall, the difference between the "Sounds" folder and the "Music" folder is only how Construct plays them. For files in "Music", Construct tries to stream them, whereas files in "Sounds" will be fully downloaded and played directly.
It seems like Firefox may handle streaming audio in a way that breaks when you restart it, at least in this case.
B
27
S
18
G
8
Posts: 328
Reputation: 6,158

Post » Sun Feb 12, 2017 11:32 am

@fisholith Thank you for solving my problem and for the detailed explanation !

Have a nice day
B
14
S
4
Posts: 22
Reputation: 946

Post » Sun Feb 12, 2017 1:27 pm

No problem, glad it worked out. :)
B
27
S
18
G
8
Posts: 328
Reputation: 6,158


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 32 guests