youtube-ios-player-helper icon indicating copy to clipboard operation
youtube-ios-player-helper copied to clipboard

URL contains ytscframe in the path.

Open HyunjoonKo opened this issue 4 years ago • 2 comments

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.

HyunjoonKo avatar Aug 03 '20 04:08 HyunjoonKo

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.

brol1dev avatar Oct 01 '20 20:10 brol1dev

@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.

  • https://www.reddit.com/r/redditmobile/comments/gssvpm/ios20201703_any_youtube_videos_that_are_played_in/
  • https://www.reddit.com/r/help/comments/havlo8/youtube_opens_empty_link_when_i_click_on_a_video/

HyunjoonKo avatar Oct 05 '20 04:10 HyunjoonKo