tumtumtum / StreamingKit

A fast and extensible gapless AudioPlayer/AudioStreamer for OSX and iOS (iPhone, iPad)
Other
2.42k stars 523 forks source link

Content-Type audio/mp4 crashes StreamingKit #325

Open patrickjquinn opened 7 years ago

patrickjquinn commented 7 years ago

Upon attempting to play an audio/mp4 stream url streamingKit throws an exception (generic, bad exec, debugging simply gives me a memory address) on line 2625 of STKAudioPlayer.m which is status = AudioConverterFillComplexBuffer(audioConverterRef, AudioConverterCallback, (void*)&convertInfo, &framesToDecode, &localPcmBufferList, NULL);

patrickjquinn commented 7 years ago

Okay @tumtumtum I know you're not around much anymore but if you have even 2 minutes I'd really appreciate you taking a look at this with me!

The error is occurring on line 2625 of STKAudioPlayer.m i.e: status = AudioConverterFillComplexBuffer(audioConverterRef, AudioConverterCallback, (void*)&convertInfo, &framesToDecode, &localPcmBufferList, NULL);

Any help on this would be greatly appreciated.

tumtumtum commented 7 years ago

I will try to look at this this week. My Mac is in for repairs :-(

Is it possible the format of the file is incorrect or not encoded for streaming?

patrickjquinn commented 7 years ago

Hey @tumtumtum thank for getting back to me! It is possible that this is the case but it streams fine in VLC and via the browser (i.e its headers accept range, its content type isn't application:stream-octect etc)

But more interestingly it doesn't play once its downloaded locally to the device and fed in as a file path url (This applies to all streams of content type audio/mp4, not just the one above).

I've been seeing complaints generally on iOS that H264 encoded files no longer play properly as of iOS 9+, this could have something to do with it?

patrickjquinn commented 7 years ago

Hey @tumtumtum did you get a chance to look at this yet? I've a brand new shiny app that I'm waiting to push live to the App Store with this as the only blocker (I've at least 4 apps live which use your framework so I'm a diehard supporter of your work) :)

patrickjquinn commented 7 years ago

Alright, i've had to move my project, lock stock, over to https://github.com/StreetVoice/HysteriaPlayer which supports this content type properly(ish)

If ever you fix this i'll migrate back to StreamingKit.

Let me know if I can help when you get around to it.

patrickjquinn commented 7 years ago

Hey @tumtumtum did you ever get your mac back and have a chance to look into this issue? I've zero problems working through this bug with you helping you debug and resolve it!

kiwi07 commented 7 years ago

Hello Patrick,

Have you solved this issue? I have the same problem with that kind of url.

kiwi07 commented 7 years ago

Btw, hysteriaplayer cannot play the url too.

patrickjquinn commented 7 years ago

Hysteria player can in fact handle this data source, I switched everything over to it and it worked fine, I decided to implement my own player using AVPlayer instead of AVQueuePlayer. Core concept is the same.

Am I right in saying that your content is coming from YouTube using the 140 tag?

kiwi07 commented 7 years ago

Hi Patrick,

Yes, you're right, I got the streaming url from youtube like yours. However, Hysteria cannot stream that link. I will send you the log tomorrow, Please tell me in detail how to make it works. Unfortunately, Avplayer takes very long time to start to play the content.

patrickjquinn commented 7 years ago

Yes thats going to be your biggest problem. Like 10-30 second delays in some cases.... If you show me how you're doing it i'll do my best to resolve your problem.

Ideally if someone could find a solution for the issue with StreamingKit i'd switch back to that but until then we will have to compromise.

kiwi07 commented 7 years ago

:D i have the same issue. It delays 10-20 seconds before starting plays a content that has long duration. According to the Hysteria, I just paste the url in the sample code to test this pod.

patrickjquinn commented 7 years ago

Probably best that we continue this over on the Hysteria GitHub repo instead of here, dont want to spam @tumtumtum

kiwi07 commented 7 years ago

Please send me your email. I would like to ask you for detail about hysteria.

kiwi07 commented 7 years ago

Hello Patrick,

I've tested on HysteriaPlayer with the url like this: https://redirector.googlevideo.com/videoplayback?id=f61e2c1fe780f8b5&itag=140&source=youtube&requiressl=yes&initcwndbps=2528750&mm=31&ei=xwYdWYPfHsra-gOewJCoAQ&mv=m&ms=au&pl=20&mn=sn-n4v7sne7&ratebypass=yes&mime=audio/mp4&gir=yes&clen=98697746&lmt=1492920570151300&dur=6214.240&upn=7QyTJ-2gRgU&signature=761F17A80B11380EA7455D7DD6F38A6142915370.94FACF4B67323C8DAE455374E293099494D1329B&mt=1495074384&key=dg_yt0&ip=45.63.90.180&ipbits=0&expire=1495096103&sparams=ip,ipbits,expire,id,itag,source,requiressl,initcwndbps,mm,ei,mv,ms,pl,mn,ratebypass,mime,gir,clen,lmt,dur

it delays about 10s-15s before playing. How can I start streaming immediately?

Thank you for your time.

marf commented 6 years ago

Hello @patrickjquinn and @kiwi07 I have the exact same problem, have you found a solution for it?

Thank you, Marco