Giter Site home page Giter Site logo

Comments (13)

atulvuliv avatar atulvuliv commented on August 14, 2024 6

Add player vars while initializing youtube sdk:

NSDictionary *playerVars = @{
                             @"origin" : @"http://www.youtube.com",
                             };
[self.playerView loadWithVideoId:@"KOvoD1upTxM" playerVars:playerVars];

Enjoy!

from youtube-ios-player-helper.

JV17 avatar JV17 commented on August 14, 2024

One option could be to just skip the video if you get an error message or load new one. You can do this by intercepting the YTPlayerView requests.. Example here!

from youtube-ios-player-helper.

Kowaio avatar Kowaio commented on August 14, 2024

Hi @JV17,

About this matter, I was wondering how you could detect that the content is forbidden in order to display a custom message inside the app when this is the case.

Indeed, I don't receive a callback from this delegate "- (void)playerView:(YTPlayerView *)playerView receivedError:(YTPlayerError)error", currently.

Thanks a lot for your help.

Best,

from youtube-ios-player-helper.

JV17 avatar JV17 commented on August 14, 2024

@Kowaio I will just check what it will get returned within the error or as mentioned above and then just trigger a function that will display this message everytime you get that response.

from youtube-ios-player-helper.

JALsnipe avatar JALsnipe commented on August 14, 2024

Your video is playing back fine for me using the latest YTPlayerView classes.

- (void)viewDidLoad {
    [super viewDidLoad];

    NSDictionary *playerVars = @{
                                 @"playsinline" : @1,
                                 @"showinfo" : @0,
                                 @"rel" : @0,
                                 @"modestbranding" : @1,
                                 @"controls" : @1
                                 };

    [self.playerView loadWithVideoId:@"ASM7f1E-dy8" playerVars:playerVars];

}

Logging:

2015-01-28 15:37:55.081 TestApp[2520:348788] YTPlayerView : playerViewDidBecomeReady
2015-01-28 15:37:55.082 TestApp[2520:348788] quality levels available:- (
    7
)
2015-01-28 15:37:55.182 TestApp[2520:348788] YTPlayerView : didChangeToState
2015-01-28 15:37:55.622 TestApp[2520:348788] YTPlayerView : didChangeToQuality
2015-01-28 15:37:55.623 TestApp[2520:348788] kYTPlaybackQualityMedium
2015-01-28 15:38:00.113 TestApp[2520:348788] YTPlayerView : didChangeToQuality
2015-01-28 15:38:00.115 TestApp[2520:348788] kYTPlaybackQualityMedium
2015-01-28 15:38:00.135 TestApp[2520:348788] YTPlayerView : didChangeToState
2015-01-28 15:38:00.136 TestApp[2520:348788] Started playback

from youtube-ios-player-helper.

Kowaio avatar Kowaio commented on August 14, 2024

Hello @JALsnipe,

Mine was this one: JrGBmjtOKlM

However, I think that it cannot be played on mobile devices due to some restriction of the author. I might be wrong though.

@JV17: I succeeded to detect it on the didChangeToState callback by checking the "kYTPlayerStateUnstarted". Thanks again for your help.

Best,

from youtube-ios-player-helper.

JALsnipe avatar JALsnipe commented on August 14, 2024

Thanks for the new URL. It doesn't appear that I get any error callback when trying to load that video:

2015-01-28 15:50:28.017 TestApp[2529:350224] YTPlayerView : playerViewDidBecomeReady
2015-01-28 15:50:28.018 TestApp[2529:350224] quality levels available:- (
    7
)
2015-01-28 15:50:28.096 TestApp[2529:350224] YTPlayerView : didChangeToState
2015-01-28 15:50:28.573 TestApp[2529:350224] YTPlayerView : didChangeToState
2015-01-28 15:50:28.573 TestApp[2529:350224] Player in Unstarted State

Maybe one of the other experts can chime in, but it looks like the class tries to play the video, something in the iFrame is blocking it, and the player returns to the unstarted state. I don't think there's any way to get around this embedded/mobile blocking

from youtube-ios-player-helper.

Kowaio avatar Kowaio commented on August 14, 2024

@JALsnipe: Yes indeed. I didn't received any error callback as well. Since I needed to detect it either way, the "Unstarted" state kind of does the trick in my case. For now...

But yeah, I think that this is coming from YT API and can't be overpassed.

from youtube-ios-player-helper.

thidayatullah avatar thidayatullah commented on August 14, 2024

The MAIN Problem is the video can be played on Android!!

So my company is developing an app for iOS and Android, basically it's an app to play curated video from Youtube.
And now I get this problem when certain video is playable on Android app but not in iOS app. If it is caused by restriction of the video how is it possible to be played on Android??

Here is my video "gKHQ715IMyc"

from youtube-ios-player-helper.

swl367 avatar swl367 commented on August 14, 2024

@atulvuliv thanks, that did it for me.

from youtube-ios-player-helper.

mayuritalaviya-nv avatar mayuritalaviya-nv commented on August 14, 2024

@atulvuliv
Thanks, your replay save my time.

from youtube-ios-player-helper.

ibhavin avatar ibhavin commented on August 14, 2024

@atulvuliv that doesn't work for me :(

for this videoId: 9VoHLolUaPc

from youtube-ios-player-helper.

umairali332 avatar umairali332 commented on August 14, 2024

Hey guys!

Any update on this issue why some videos are not playing in this video player whereas same videos being played using Android player.

for me this video is not being played. 6fvYcRdhuBE

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.