Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page loads in Safari but Music doesn't play #4

Open
sanindya-iiitd opened this issue Oct 20, 2020 · 11 comments
Open

Page loads in Safari but Music doesn't play #4

sanindya-iiitd opened this issue Oct 20, 2020 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@sanindya-iiitd
Copy link

sanindya-iiitd commented Oct 20, 2020

Screenshot 2020-10-20 at 7 14 03 PM

I tried:

  • refreshing the page
  • going to next track
  • toggling pause/play

Safari: Version 14.0 (15610.1.28.1.9, 15610)

@bufgix
Copy link
Contributor

bufgix commented Oct 20, 2020

Unfortunately player implementation does not support Safari browser. Use Firefox or Chrome instead

@orhun
Copy link
Owner

orhun commented Oct 21, 2020

I agree with @bufgix.
Have you tried to play a mod on modarchive.org?

@orhun orhun added the bug Something isn't working label Oct 21, 2020
@sanindya-iiitd
Copy link
Author

sanindya-iiitd commented Oct 21, 2020

I see.
No, the online player on modarchive.org doesn't work in Safari either.
Any idea if this could be due to https://github.com/OpenMPT/openmpt or https://github.com/deskjet/chiptune2.js?

I tried this demo in Safari and it works: https://deskjet.github.io/chiptune2.js/#

@orhun
Copy link
Owner

orhun commented Oct 21, 2020

No, the online player on modarchive.org doesn't work in Safari either.

That's why CMF's player doesn't work as well. The players are identical.

Any idea if this could be due to https://github.com/OpenMPT/openmpt or https://github.com/deskjet/chiptune2.js?

On point. I believe that it's an optimization issue about OpenMPT or the chiptune library. Modarchive.org uses a modified version of chiptune2 afaik.

Also some Android browsers play the track very choppy or don't play it at all.

I tried this demo in Safari and it works: https://deskjet.github.io/chiptune2.js/#

We have to get to the bottom of this. Unfortunately I and @bufgix couldn't have the time to really dive into the OpenMPT and see what's going on under the hood. We're still lack of knowledge and data.

Good thing that somebody pointed this out again :p

@sanindya-iiitd
Copy link
Author

sanindya-iiitd commented Oct 22, 2020

@sanindya-iiitd
Copy link
Author

Screenshot 2020-10-23 at 3 28 51 AM

Can play .s3m files in Safari though. I downloaded a file (shock09.mod) from modarchive and uploaded into https://deskjet.github.io/chiptune2.js/# and it plays fine.

Weird.

@sanindya-iiitd
Copy link
Author

Screenshot 2020-10-23 at 3 31 42 AM

Can surprisingly play mod files too now (in Safari, yes).

Weirder.

@sanindya-iiitd
Copy link
Author

I tried setting up in my local:

npm install
npm run build
npm run start

homepage loads. But, as soon as I click on "randombtn" like "Where the mods at?", it crashes.
Page says:
An unexpected error has occurred.

Console shows this:

framework.e11e4af83f0aa0812396.js:formatted:5405 TypeError: Cannot read property 'replace' of undefined
    at index-c8dde9fa7d0c5cb71134.js:1
    at Ye (index-c8dde9fa7d0c5cb71134.js:1)
    at Je (index-c8dde9fa7d0c5cb71134.js:1)
    at qi (framework.e11e4af83f0aa0812396.js:formatted:4029)
    at yo (framework.e11e4af83f0aa0812396.js:formatted:6800)
    at su (framework.e11e4af83f0aa0812396.js:formatted:6343)
    at uu (framework.e11e4af83f0aa0812396.js:formatted:6336)
    at eu (framework.e11e4af83f0aa0812396.js:formatted:6113)
    at framework.e11e4af83f0aa0812396.js:formatted:3291
    at t.unstable_runWithPriority (framework.e11e4af83f0aa0812396.js:formatted:306)

I have no clue how to deal with this (haven't worked with front-end like ever). Any leads?

Or any tips on how to set this in local?

@orhun
Copy link
Owner

orhun commented Oct 23, 2020

I used yarn for development. So basically run yarn for resolving dependencies and yarn dev for starting the development server.
Only issue is yarn.lock being outdated right now. (We should yarn upgrade and fix errors ASAP @bufgix) But I don't think it will affect you since current state of the repository should build just fine.

Does changing the audio context affect the other platforms and have you had the chance to test them?

And yes, unfortunately different formats behave differently. I'm still sus of OpenMPT about that. I gues we can never know without further testing and a bit of code-diving.

@sanindya-iiitd
Copy link
Author

I used yarn for development. So basically run yarn for resolving dependencies and yarn dev for starting the development server.

Thanks. I was running into issues with markdown-to-jsx (Help.md linked with BackSideContent). I came across the meta, viewport tags issue and followed this fix but in vain. Eventually, I just replaced <BackSide content={backSideContent} /> with <BackSide content="Sample Help." /> and it worked. (It was maybe due to the github credentials used to fetch Help.md.)

Does changing the audio context affect the other platforms and have you had the chance to test them?

  • Only modarchive.com needed the AudioContext change (adding prefix window. or enclosing window[]). CMF and chiptune2-demo already had it.
    • On modarchive.com, I created a local override on chiptune2.js and added the window. prefix. However, it did not help in Safari, so didn't check on other platforms.

Meanwhile, I did (accidentally) find a way to make CMF play audio on Safari:

  1. Launch chiptune2-demo and upload a mod file, it will play. (We may pause it.)
  2. Now, go to CMF, it will work just fine. 😄

And yes, unfortunately different formats behave differently. I'm still sus of OpenMPT about that. I gues we can never know without further testing and a bit of code-diving.

I did some code-diving today. And, the problem seems to be with the createScriptProcessor() method. The returned AudioNode object has different property values:

  • Chrome/Firefox: - numberOfInputs: 1, numberOfOutputs: 1, channelCount: 0, channelCountMode: “explicit”, channelInterpretation: “speakers”
  • Safari: - numberOfInputs: 1, numberOfOutputs: 1, channelCount: 2, channelCountMode: “max”, channelInterpretation: “speakers”

According to W3C Candidate Recommendation and W3C Editor's Draft, we should see the first set.

I noticed, in Safari the onaudioprocess event is never triggered and I think this might be a consequence of the misconfigured AudioNode object.

Another thing I learned, ScriptProcessorNode is to be deprecated in favour of AudioWorkletNode and Safari doesn't support AudioWorkletNode as of now.

Can you suggest how to further investigate why uploading a mod to chiptune demo fixes the playback for CMF? I tried this workaround with local CMF but it didn't work.

@orhun
Copy link
Owner

orhun commented Nov 20, 2020

Hey again,
Sorry for the late reply. Unfortunately we couldn't reproduce the workaround method you mentioned. I personally don't have a proper setup to test the issue but @bufgix checked the audio context and saw the same logs that you referred. At this point I'm not quite sure what else we can do other than re-implementing the chiptune library with the latest version of OpenMPT. I still think we should have to have more knowledge by working on the low-level stuff. Thank you for your efforts regarding to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants