youtube / youtube-ios-player-helper

Lightweight helper library that allows iOS developers to add inline playback of YouTube videos through a WebView
Other
1.64k stars 680 forks source link

URL contains ytscframe in the path. #403

Open HyunjoonKo opened 4 years ago

HyunjoonKo commented 4 years ago

When the player is ready to play and starts playing, sometimes it calls this URL: ‪https://www.youtube.com/ytscframe

The URL is not registered in the Regex Pattern in - (BOOL)handleHttpNavigationToUrl:(NSURL *)url, so the app goes outside. (Youtube app or Safari browser)

So, if there is an ytscframe in the path of the URL, you should cancel the loading of WKWebView as follows:

// in YTPlayerView.m
- (BOOL)handleHttpNavigationToUrl:(NSURL *)url {
    // ...
    if ([[[url.path stringByReplacingOccurrencesOfString:@"/" withString:@""] lowercaseString] isEqualToString:@"ytscframe"]) {
        return NO;
    }
    // ...
}

I hope this helped if anyone was having this problem. And we hope that the issue will be fixed in the next release.

brol1dev commented 3 years ago

I haven't been able to reproduce this issue. Is this happening to you with a specific video? Can you provide more info to reproduce the issue?

Thank you.

HyunjoonKo commented 3 years ago

@rcvrgs Hi. I haven't been able to find a path to reproduce that problem. But it happens often. Others than me seem to be experiencing the same phenomenon.