Comments (4)
This is a difficult problem to solve that I've been struggling with recently. There are videos that trigger kYTPlayerStateUnstarted, then kYTPlayerStateBuffering then kYTPlayerStatePlaying, and there are videos that report kYTPlayerStateBuffering and then kYTPlayerStateUnstarted that never play. There are videos that report kYTPlayerStateBuffering and then never play. Its a nightmare. I would recommend avoiding using kYTPlayerStateUnstarted to detect if a video is not going to play. Infact, none of the kYTPlayerState* events can be used to do this reliably, so you are better off timing the whole load and then bailing out if YT doesn't report kYTPlayerStatePlaying after 30 seconds or so.
from youtube-ios-player-helper.
ETA: this is particularly difficult around music videos with all the rights and restrictions, sometimes the embedded YT player doesn't throw an error if rights restrictions prevent the video from playing. You'll just get a kYTPlayerStateBuffering state that never ends (and never swaps to kYTPlayerStateUnstarted)
from youtube-ios-player-helper.
Thanks for confirming the problem Chris. I've seen other apps that have found a way to decide more quickly if a video will play or not and a couple that have resolved the restrictions problem --at least for some videos that I cannot play. I'm wondering if there's a better YT player or another way to solve the error handling and restrictions issues. Waiting for 30 seconds is too long especially if the user just happens to be on a slow connection. Any other ideas are most welcome!
from youtube-ios-player-helper.
You can use something like XCDYouTubeClient that extracts the URL directly to the .mp4, and play it directly via MPMoviePlayerController. But... this violates YouTube's terms of service.
The choice depends if you care I guess :-)
from youtube-ios-player-helper.
Related Issues (20)
- A Quality Video of Streaming Youtube's Video Not Properly
- Crash: [AVPlayerController boolValue]: unrecognized selector sent to instance
- YouTubeiOSPlayerHelper - When calls the 'Load' method (Xcode 14.2 - Target iOS 15)
- https://youtu.be/kXz8mD3Q_Lk
- youtube-ios-player-helper multiple audio selection
- Give us the bulk like functionality YOUTUBE!
- YouTube
- Youtube playsinline does not work for iPad
- It will lead App crash after update xcode
- YouTube
- Live label not showing on player for iphone.
- memory issue
- Fix Nullabilty warnings: Implicit conversion from nullable pointer 'X' to non-nullable pointer type 'Y' HOT 1
- Infinite loader when trying to play video
- WebKit`WebKit::VideoFullscreenManagerProxy::didCleanupFullscreen App Crash
- i'm HOT 2
- Privacy manifest HOT 1
- Memory leak issue when calling StopViedo()
- Youtube
- Collapse the parent view of YTPlayerView when picture in Picture is enabled
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 youtube-ios-player-helper.