codealchemist / youtube-audio-server

Easily stream and download audio from YouTube.
74 stars 32 forks source link

iOS stream loops #8

Open seizu opened 6 years ago

seizu commented 6 years ago

Hello!

I've tested YAS on Win7/Firefox and macOS Sierra/Safari, no issue, works great. I'm facing issues when I'm trying to playback the same/any stream on iOS11,iOS9 with Safari/Firefox. The stream always starts from the beginning after a maximum playback duration of about 3 minutes. WIFI or LTE makes no difference. Any idea what could cause such behavior?

Br

codealchemist commented 6 years ago

Wow, really interesting problem! I'll need to look into it, no idea! Thanks for reporting!

codealchemist commented 6 years ago

So far I'm able to reproduce on Safari on iOS. I'm not able to get errors from the HTML5 audio element, damn. Will come back to this later. Cheers!

seizu commented 5 years ago

I think the stream output chunk size needs to be smaller and has to be timed. See the source code from Tano Toll. PHP MP3 streaming http://wiki.secondlife.com/wiki/Stream_Music_In_PHP Works on iOS without problems. You can test it here: http://radio.wartris.com

codealchemist commented 5 years ago

Hi @seizu! Would you be able to run some tests using the new endpoints added on #17?

seizu commented 5 years ago

Hi! I've tested the new endpoints /chunk/id on iOS. The loading symbol appears but the stream has not been played.

codealchemist commented 5 years ago

I'll need to do some debugging on iOS. Thanks man!

Adminius commented 5 years ago

Hey, i have simmilar problem with 24/ live stream Videos. this streams repeats each 30 seconds... 8XjDmVzqVUc tPE4wv7ob8Q

this streams are without troubles: oUExWNtesDQ Oqpf-qbslzk

Tested under Win10, Chrome 70.0

seizu commented 5 years ago

What I have found out is that iOS reads from the stream as long as the server provides streaming data and the internal iOS streaming buffer is not full. When the streaming buffer gets full (which should never happened) , iOS interrupts the stream. The above PHP source code pushes only one MP3 frame (1 chunk about 418 bytes @128k bitrate) and pauses the stream between each frame. The pause time depends on bitrate or playback time for one frame. This technique prevents the iOS buffer from overflowing and interrupting the stream.