Giter Club home page Giter Club logo

Comments (12)

W3AXL avatar W3AXL commented on August 16, 2024 1

I'm actually already using ISOBMFF for Firefox support and it works great - I credit your demo example for figuring that out with minimal hassle.

I created a basic Safari test page that creates a new IcecastMetadataReader instance, and it seems to instantiate just fine. I don't do anything with it yet, but that's a good sign at least. No errors in the console so far.

As far as a stack trace goes, I'll see what I can do. This remote debugging setup is a bit of a hack in the first place, and it leaves a bit to be desired in terms of verbosity.

from icecast-metadata-js.

W3AXL avatar W3AXL commented on August 16, 2024 1

Evening update:

The original issue with IcecastReadableStream failing to instantiate seems to be fixed. The stream object plays and fetches metadata without any issues.

Now I'm just fighting a lack of audio output. I had to do a little adjusting of my audio processing code to get Safari to decode the mp3 chunks properly. While I'm no longer getting any decoding errors, I can't get any actual audio out of the phone's speakers. Will be doing some more investigation, but unfortunately this isn't exactly a super common thing to be trying to do.

We can probably close this issue, as the IcecastReadableStream object does indeed work in safari. Getting the audio chunks from the stream to actually play, however, will likely be another story entirely. We could keep this ticket open to track that if desired.

from icecast-metadata-js.

eshaz avatar eshaz commented on August 16, 2024

I don't own any Apple devices, and I've never tested the library in iOS Safari. I'm definitely interested in getting it to work though, if possible, but you might have to direct users to install Chrome if they are in an iPhone, especially if Safari doesn't have MSE support.

Which version of Safari / iOS are you running? Do you have a stack trace, or any more information on the error? It looks like the IcecastReadableStream failed to instantiate due to some other issue, and this error is because the icecast variable was never assigned an instance. It's probably some syntax in the library that's not supported yet in Safari. Could you try using the IcecastMetadataReader class and see if that instantiates properly? Also, one final thing, could you try running this code in Safari: console.log(typeof Symbol.asyncIterator) and see if it outputs symbol. Looking at MDN, the asyncIterator symbol isn't supported in Safari but it's used in IcecastReadableStream.

If you are able to get the WebAudio API working to play back the MP3 in the stream, I would be very interested in seeing how you accomplish it. I tried a while back to use BaseAudioContext.decodeAudioData() with the MP3 data, but this didn't work, and actually can't work from what I understand because MP3 uses a bit reservoir that can span multiple frames and has to be decoded as a continuous stream.

from icecast-metadata-js.

W3AXL avatar W3AXL commented on August 16, 2024

Wilco on all of the above. Debugging on Safari is annoying, especially since I don't have an apple desktop device of any kind. I have to run through the iOS webkit adapter and it's less than stellar when it comes to javascript console output. I'll see what I can piece together.

Interestingly I can't get the stream to load in Chrome for iOS either. No errors in the (less than stellar mobile) console, although it does indicate that it doesn't support MSE either, just like Safari.

from icecast-metadata-js.

W3AXL avatar W3AXL commented on August 16, 2024

Running typeof Symbol.asyncIterator via the remote console yields the following:

> typeof Symbol.asyncIterator
> "symbol"

from icecast-metadata-js.

eshaz avatar eshaz commented on August 16, 2024

Running typeof Symbol.asyncIterator via the remote console yields the following:

> typeof Symbol.asyncIterator
> "symbol"

Ok, that's probably not the issue then. Probably the next step would be to see the stack trace so we can see where the error originates from.

For MSE, support can be a little spotty if you are piping in the audio/mpeg data in directly to the SourceBuffer. I have another library, https://github.com/eshaz/isobmff-audio/, that I wrote for better MSE compatibility. It wraps the MP3 data in a MP4 container, which is more widely supported than just audio/mpeg data. The icecast-metadata-player uses this library, and you can look at that for an example.

You can check out this website to see if MP3 is supported in a MP4 container on your platform. https://cconcolato.github.io/media-mime-support/#audio/mp4;%20codecs=%22mp3%22

You can also run MediaSource.isTypeSupported('audio/mp4;codecs="mp3"') and see if that returns true.

from icecast-metadata-js.

W3AXL avatar W3AXL commented on August 16, 2024

It doesn't appear that it's possible to get full stack traces via the ios-webkit-adapter, so it may be necessary to add some additional debug prints inside the icecast-metadata-js code to figure out what's going on.

from icecast-metadata-js.

eshaz avatar eshaz commented on August 16, 2024

You can clone down the repo and then replace the dependency line in your package.json with "icecast-metadata-js": "file:../path/to/icecast-metadata-js". Then you can add debug code anywhere in the repo and those changes will be reflected in your bundle. Let me know what you find, or if you want to submit a PR that fixes this, that would be much appreciated!

from icecast-metadata-js.

zanarduz avatar zanarduz commented on August 16, 2024

This would save my life, developed nearly all my home project for my streaming radios to find out that doesn't work on iOS (first target platform, didn't try it sooner because I assumed 2021 code would work).

Keep up the great work and let us know if you find a solution!

from icecast-metadata-js.

eshaz avatar eshaz commented on August 16, 2024

An update on this:

I just released icecast-metadata-js/0.5.0 that adds support for Safari 13 desktop. I don't have an iOS device to test on, but I think it's likely that this release will fix the original issue in IcecastReadableStream.

I also released icecast-metadata-player/0.3.0 to support MP3 and AAC streams in Safari desktop. Safari desktop doesn't support playback for FLAC, Opus, or Vorbis. Unfortunately, all the information that I can find about iOS and MediaSource api support indicates there is no support at all for the MediaSource api in iOS, with the only exception being Safari 13 on the iPad.

The demos are up to date and I am curious to know if it works for you! I also added better logging and an events framework for any errors that should help with debugging.

from icecast-metadata-js.

W3AXL avatar W3AXL commented on August 16, 2024

I'm finally circling back around to this and I'll be trying out the new library tonight. Hopefully it'll be relatively easy to get everything up and working on iOS.

from icecast-metadata-js.

eshaz avatar eshaz commented on August 16, 2024

That's great to hear the original issue is fixed.

Are you are using decodeAudioData() to decode the results of the stream? Decoding independent chunks of MP3 is unlikely to work. MP3 uses a "bit reservoir" that encodes audio across frame boundaries. MP3 has to be decoded as a continuous stream of data so that the bit reservoir can be properly decoded. See "4. Why cant MP3 files be seamlessly spliced together?".

Fortunately, the Media Source Extensions API solves this problem by allowing audio data to be appended to a source buffer as it comes in, and the browser can decode it as a stream, which is how icecast-metadata-player works.

Unfortunately, iOS / webkit is one of the only modern browsers that doesn't support Media Source Extensions. MSE has been widely supported in browsers for over 5 years now, except in iOS webkit.

I'll close this issue, but also open a new one for iOS support for metadata / playback. There may be a few ways to accomplish synced metadata without using MSE.

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.