Giter Club home page Giter Club logo

Comments (2)

eshaz avatar eshaz commented on September 18, 2024 1

I don't think there is anything in IcecastMetadataPlayer that would cause this. What's probably happening is that each listener's audio is playing at different rates that, while not noticeable to the ear, eventually accumulate to cause significant differences after playing for long durations. IcecastMetadataPlayer has a few different playback methods for compatibility reasons, but they all rely on the client to playback the audio using the interfaces provided in a browser (MediaSource, Web Audio, and HTML5 audio element).

You might try running tests for each playbackMethod
to see if that changes anything. Depending on your browser and OS, one of these web interfaces could be better than the other for playing the audio consistently.

You might also try a test where you play your stream on two different devices that you know have had this issue and record the output. Then you could align these recordings in Audacity and see if there's any consistency to how audio becomes out of sync between devices.

Finally, there is the onCodecUpdate callback that is triggered with codec information parsed from the compressed audio while the stream is playing. The duration fields in there are sample accurate and garenteed to be correct. You can check to see if playback starts to drift over time based on this.

Other that stopping and starting playback in your app when you think the audio is out of sync, at this point I can't think of anything that should be done in IcecastMetadataPlayer to fix the client's audio playback rate, unless you find a bug somewhere in the playback methods that is causing the audio to drift.

from icecast-metadata-js.

jonathandv avatar jonathandv commented on September 18, 2024 1

Thank you for a great answer :) Setting the preferred playback method to 'webaudio' seems to solve the problem. I tested on iOS Safari and Windows Chrome. Previously, in both those browsers 'mediasource' was chosen by default (if no preferred method was provided), but only in Windows Chrome it seems (on my computer) a delay would build up often. Now those browsers will use 'webaudio' and things seem fine in Windows Chrome, but I have to test a bit more to be sure.

It's interesting to learn about these things. The media source documentation says it's experimental technology, so as long as the stream type is supported, it might be best to use webaudio anyway.

I'll keep a resync/restart mechanism in my app, just in case.

I suppose you can close this issue, and keep it around as information, in case someone experiences the same thing.

from icecast-metadata-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.