Git Product home page Git Product logo

Comments (4)

cdrx avatar cdrx commented on August 16, 2024

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.

cdrx avatar cdrx commented on August 16, 2024

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.

tyronet avatar tyronet commented on August 16, 2024

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.

cdrx avatar cdrx commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.