Open joebcvan90 opened 3 years ago
I've been experiencing this since about a week ago as well. This has been a topic of discussion in youtube-dl for a while, and it seems like YouTube sometimes randomly throttles the download speed for a URL to about 50~70kb. If you retry by getting a new URL (by executing a new XCDYoutubeKit request) a couple of times it eventually will get a URL that is capable of a normal download speed, but this can sometimes take up to 10 tries and is not exactly a pretty solution.
There seems to be a specific parameter (n) in the mp4 URL that is encrypted, and if this encryption is solved you will be able to get a steady URL every time, but this encryption method seems to vary depending on the video and I have not found a way to solve it on iOS. According to the youtube-dl discussion, this has been solved in another python library called yt-dlp, where I guess they have managed to crack the encryption.
If anyone has a solution I would be thrilled to hear about it.
I have been experiencing this issue. It takes 30-60s to play a video.
Facing with the same issue, but time is MUCH longer. To play the 5-6 minutes video it takes up to 7 minutes to load it... Awful. The WebView approach works better, but the configuration much worse. But nothing have to do, except switch to WebView solution
Thanks for the suggestion @fightveryexplosion
I applied some changes from ytdlp which seem to fix the slowdown. Feel free to try it out in https://github.com/0xced/XCDYouTubeKit/pull/552
Edit: I didn't do anything encryption related, it's just a different API and some parameter tweaks.
@kbex-dev I tried your code, but I see it still slow to load a video.
@huynguyencong That's disappointing. We haven't noticed any throttled videos in our testing (20+ videos) whereas we encountered it almost every time before.
Do you have a video link I can try on my end?
@kbex-dev For example this one: https://www.youtube.com/watch?v=t4H_Zoh7G5A . It take more than 20s but can't play.
This is the pod in my Pod file:
pod 'XCDYouTubeKit', :git => 'https://github.com/kbex-dev/XCDYouTubeKit.git'
@huynguyencong That's disappointing. We haven't noticed any throttled videos in our testing (20+ videos) whereas we encountered it almost every time before.
Do you have a video link I can try on my end?
often buffing at 50-70 kb/s
I did some testing on VPN (until I ran out of free data). It seemed to work better on US and EU regions than Asia. Where are you connecting from @frozenthrone? I won't be able to spend more time on this, since it seems to work for our target regions.
It may be worth testing what APIs yt-dlp uses and what speed you get with it? Perhaps they do something different depending on region.
pod 'XCDYouTubeKit', :git => 'https://github.com/kbex-dev/XCDYouTubeKit.git'
This worked for me, thanks allot @kbex-dev
The package has been pretty unreliable over the last few months :-1:
The same for me. The caching takes up several minutes.
On some days, the video would load very quickly and play right away, but on some days, the video takes more than 15 seconds to load. Tested this under both WIFI and cellular, but I had the same results. It's the same video performing differently on a daily basis. I tried looking everywhere, but couldn't figure out where the problem is coming from.
Can anyone help with this issue? Many thanks in advance.