Comments (11)
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.
from xcdyoutubekit.
Thanks for the suggestion @fightveryexplosion
I applied some changes from ytdlp which seem to fix the slowdown. Feel free to try it out in #552
Edit: I didn't do anything encryption related, it's just a different API and some parameter tweaks.
from xcdyoutubekit.
I have been experiencing this issue. It takes 30-60s to play a video.
from xcdyoutubekit.
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
from xcdyoutubekit.
@kbex-dev I tried your code, but I see it still slow to load a video.
from xcdyoutubekit.
@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?
from xcdyoutubekit.
@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'
from xcdyoutubekit.
@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
from xcdyoutubekit.
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.
from xcdyoutubekit.
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 π
from xcdyoutubekit.
The same for me.
The caching takes up several minutes.
from xcdyoutubekit.
Related Issues (20)
- Error Domain=XCDYouTubeVideoErrorDomain Code=-3 "(null)" HOT 4
- Can't get the streamUrl of Live Stream HOT 11
- CP=βThis is not a P3P policy! See http://support.google.com/accounts/answer/151657?hl=en for more info.β
- No longer works: XCDYouTubeVideoErrorDomain error -3 HOT 22
- Unable to play youtube video in iOS app HOT 10
- getVideoWithIdentifier return XCDYouTubeVideoErrorDomain error HOT 25
- streamURL = nil for "LIVE NOW" videos(youtube). HOT 16
- (iOS) XCDYouTubeVideoErrorDomain: -2 with empty User Info for upcoming live stream HOT 2
- XCDYouTubeRequestTypeGetVideoInfo is resulting in a 404 response
- Error XCDYouTubeVideoErrorDomain -2 when i try open video HOT 23
- Error playing video HOT 11
- VIDEO NOT PLAYING (CHECK THIS BEFORE CREATING NEW) HOT 23
- Get StreamUrls from Id is nil HOT 1
- [XCDYouTubeKit] Failed to decode response Code: -3 HOT 7
- Live video plays for last 2:00:00 hours only.
- Cannot play video with XCDYouTubeVideoErrorDomain Code: -2
- live video
- The following content is not available on this app. HOT 1
- Emergency fix HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xcdyoutubekit.