muhku / FreeStreamer

A low-memory footprint streaming audio player for iOS and OS X
http://muhku.github.io/FreeStreamer/
Other
2.11k stars 435 forks source link

FreeStreamer fails to detect unsupported codecs? #184

Open soundspectrum opened 9 years ago

soundspectrum commented 9 years ago

Hi muhku!

Firstly, many thanks for your work on FreeStreamer! We plan to release our product soon to the iOS store and we're looking forward to offering some compensation your way!

Issue: FS does not error out on unsupported/unknown codecs (specifically Flash)

Many of the streams on SoundCloud are mp3 and of course play find under FS. However, some URLs send audio data that FS does not recognize and FS keeps retrying. I realize that some codecs can't be supported, but I think it would be very beneficial if FS can detect codecs it does not support.

FS plays mp3 streams fine: https://api.soundcloud.com/tracks/198574150/stream?client_id=96b0b55477b1ac33821e13d98a08d6ba

FS hangs on: https://api.soundcloud.com/tracks/195708659/stream?client_id=96b0b55477b1ac33821e13d98a08d6ba

If you like, kindly find me on Skype (andyomeara) and we can talk more there! :)

Many thanks, Drew

muhku commented 9 years ago

Have you checked if enabling strict content type checking helps?

Http://freestreamer.io/api/Classes/FSAudioStream.html#//api/name/strictContentTypeChecking

soundspectrum commented 9 years ago

Hi muhku, thanks for getting back!

After some research and testing I'm more informed and I'll share my findings!

For some SoundCloud (and likely other services) playable items, they link to a m3u/m3u8 text response (http live streaming / HLS). This format basically contains a sequence of URLs to be played gaplessly (a typical track is broken up into 10 second sequential pieces). So I am currently figuring out the best way to get gapless playback with FS. Is this possible? It would be perfect to understand how to get FS to not close audio playback and begin concatenating from the next URL. Is this possible? If not, I would be happy to add this feature or extend FS so that it can play continuously in this way.

Best, Drew

muhku commented 9 years ago

Yes, FSAudioController plays 'gaplessly', which is called preloading. Either let FSAudioController load a playlist automatically or supply the playlist items by yourself to the controller. The next playlist items are automatically preloaded.

soundspectrum commented 9 years ago

Hi!

Yes, I saw that, but based on your code, "gapless" is just that it plays the next preloaded item at around the same time as the previous URL finishes (via onCompletion()). Since a typical HLS playlist breaks a single song up into little pieces (5-10 seconds), there can be a very slight audible gap between streams, no? In contrast, I was looking at making a layer/abstraction that fills a buffer in parts from multiple URL preloaded buffers and sends that to the converter for output. This would also do away with some of the "churn" from FSAudioController since playing a URL sequence could have settings such as crossfade, true gapless, or X second delay/pause.

Also, adding a this layer/abstraction allows permits seek as with any other stream, which is rather important. Having good, reliable seek functionality is so valuable as I'm sure many users of FS would agree.

Hopefully I'm explaining all this ok. :D

Best, Drew

soundspectrum commented 9 years ago

Find me on skype andyomeara if you like or google me -- Andy O'Meara. It would be my pleasure to send you copies of our software, tell you about what we're making now, and see if you're interested in getting paid to develop specific features for FS (and continue to strengthen it).

soundspectrum commented 9 years ago

After some meditation on this, I'm looking at extending FS to play an external/alternate abstract stream (in that it gets its data abstractly from FS, allowing any data source). This will let me do a true gapless fill using a track's HLS playlist and then feed it to FS abstractly. True gapless playback is something we need, so I have to make this happen one way or another. Muhku, let me know if you have any input -- of course I'd like to put this new functionality into the trunk after your review.

Drew

muhku commented 9 years ago

I think improving the input stream layer sounds good in principle. I'll be on vacation / under quite heavy travel for the next two weeks, so I cannot give a lot of input during this period, but I'll get back to this after I am back.

soundspectrum commented 9 years ago

Have a nice holiday and talk to you when you're back!

syrakozz commented 9 years ago

have a nice holiday

— Sent from Mailbox

On Sun, May 3, 2015 at 6:46 PM, Matias Muhonen notifications@github.com wrote:

I think improving the input stream layer sounds good in principle. I'll be on vacation / under quite heavy travel for the next two weeks, so I cannot give a lot of input during this period, but I'll get back to this after I am back.

Reply to this email directly or view it on GitHub: https://github.com/muhku/FreeStreamer/issues/184#issuecomment-98496510

davidhlee commented 9 years ago

+1, true gapless would be crucial. @soundspectrum do you still plan on working on this feature?

soundspectrum commented 9 years ago

Already in progress @davidhlee

levibostian commented 8 years ago

@soundspectrum, I am currently working on playing a SoundCloud HLS stream. Did you get FreeStreamer to do this for you? Did you use another library? Did you get it to work?

levibostian commented 8 years ago

I am getting it to work now, just some more work to do to finish up. AVPlayer plays HLS streams out of the box and it is working well so far.

jainanshul commented 8 years ago

@soundspectrum did you finish your work on making AudioController gapless?