{"action":"created","issue":{"url":"https://api.github.com/repos/youtube/youtube-ios-player-helper/issues/109","labels_url":"https://api.github.com/repos/youtube/youtube-ios-player-helper/issues/109/labels{/name}","comments_url":"https://api.github.com/repos/youtube/youtube-ios-player-helper/issues/109/comments","events_url":"https://api.github.com/repos/youtube/youtube-ios-player-helper/issues/109/events","html_url":"https://github.com/youtube/youtube-ios-player-helper/issues/109","id":81458894,"number":109,"title":"OAuth redirect when playing some Live Events","user":{"login":"JALsnipe","id":4513736,"avatar_url":"https://avatars.githubusercontent.com/u/4513736?v=3","gravatar_id":"","url":"https://api.github.com/users/JALsnipe","html_url":"https://github.com/JALsnipe","followers_url":"https://api.github.com/users/JALsnipe/followers","following_url":"https://api.github.com/users/JALsnipe/following{/other_user}","gists_url":"https://api.github.com/users/JALsnipe/gists{/gist_id}","starred_url":"https://api.github.com/users/JALsnipe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JALsnipe/subscriptions","organizations_url":"https://api.github.com/users/JALsnipe/orgs","repos_url":"https://api.github.com/users/JALsnipe/repos","events_url":"https://api.github.com/users/JALsnipe/events{/privacy}","received_events_url":"https://api.github.com/users/JALsnipe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-05-27T13:58:54Z","updated_at":"2015-06-02T12:35:24Z","closed_at":null,"body":"Relevant StackOverflow link: http://stackoverflow.com/questions/30482280/ytplayer-will-redirect-to-oauth2-url-and-shows-please-stand-by\r\n\r\nI'm trying to play this Live Event in the YTPlayerView: https://www.youtube.com/watch?v=w-T2LJ_qLiw\r\n\r\nAt first, the webview tries to load the video URL, which is normal:\r\n\r\nhttps://www.youtube.com/embed/w-T2LJ_qLiw?modestbranding=1&showinfo=0&rel=0&playsinline=1&controls=1&enablejsapi=1\r\n\r\nThen, the player tries to load this weird OAuth URL:\r\n\r\nhttps://accounts.google.com/o/oauth2/postmessageRelay?parent=https%3A%2F%2Fwww.youtube.com#rpctoken={TOKEN}&forcesecure=1\r\n\r\nAfter that, the player tries to load this static/proxy.html URL:\r\n\r\nhttps://content.googleapis.com/static/proxy.html?jsh=m%3B%2F_%2Fscs%2Fabc-static%2F_%2Fjs%2Fk%3Dgapi.gapi.en.dPxK-DAj_pE.O%2Fm%3D__features__%2Fam%3DAAQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAItRSTN0fuoBkyFaoHWfzWWLct0BxZgQSQ#parent=https%3A%2F%2Fwww.youtube.com&rpctoken={TOKEN}\r\n\r\nBoth URLs take the user out of the app and into Safari.  I have tried adding a regex to stop the webview from kicking the user out to safari, similar to the way ads are handled:\r\n\r\n```obj-c\r\nNSString static *const kYTPlayerOAuthRegexPattern = @\"^http(s)://accounts.google.com/o/oauth2/(.*)$\";\r\nNSString static *const kYTPlayerStaticProxyRegexPattern = @\"^https://content.googleapis.com/static/proxy.html(.*)$\";\r\n\r\n// ...\r\n\r\n- (BOOL)handleHttpNavigationToUrl:(NSURL *) url {\r\n    // Usually this means the user has clicked on the YouTube logo or an error message in the\r\n    // player. Most URLs should open in the browser. The only http(s) URL that should open in this\r\n    // UIWebView is the URL for the embed, which is of the format:\r\n    //     http(s)://www.youtube.com/embed/[VIDEO ID]?[PARAMETERS]\r\n    \r\n    // ...\r\n    \r\n    NSRegularExpression *oauthRegex =\r\n    [NSRegularExpression regularExpressionWithPattern:kYTPlayerOAuthRegexPattern\r\n                                              options:NSRegularExpressionCaseInsensitive\r\n                                                error:&error];\r\n    NSTextCheckingResult *oauthMatch =\r\n    [oauthRegex firstMatchInString:url.absoluteString\r\n                           options:0\r\n                             range:NSMakeRange(0, [url.absoluteString length])];\r\n    \r\n    NSRegularExpression *staticProxyRegex =\r\n    [NSRegularExpression regularExpressionWithPattern:kYTPlayerStaticProxyRegexPattern\r\n                                              options:NSRegularExpressionCaseInsensitive\r\n                                                error:&error];\r\n    NSTextCheckingResult *staticProxyMatch =\r\n    [staticProxyRegex firstMatchInString:url.absoluteString\r\n                           options:0\r\n                             range:NSMakeRange(0, [url.absoluteString length])];\r\n    \r\n    if (ytMatch || adMatch || oauthMatch || staticProxyMatch) {\r\n        return YES;\r\n    } else {\r\n        [[UIApplication sharedApplication] openURL:url];\r\n        return NO;\r\n    }\r\n}\r\n\r\n```\r\n\r\nBut even after forcing the video to load, I just get \"An error has occurred\" with the `receivedError` delegate not called.\r\n\r\n![screen shot 2015-05-27 at 9 56 35 am](https://cloud.githubusercontent.com/assets/4513736/7837721/d1915e8e-0456-11e5-90e7-9c5913a42866.png)\r\n\r\nIs OAuth or HTTPS required for some live events?  Is this new live event not supported by the iFrame API?"},"comment":{"url":"https://api.github.com/repos/youtube/youtube-ios-player-helper/issues/comments/107938632","html_url":"https://github.com/youtube/youtube-ios-player-helper/issues/109#issuecomment-107938632","issue_url":"https://api.github.com/repos/youtube/youtube-ios-player-helper/issues/109","id":107938632,"user":{"login":"dewsxc","id":4928293,"avatar_url":"https://avatars.githubusercontent.com/u/4928293?v=3","gravatar_id":"","url":"https://api.github.com/users/dewsxc","html_url":"https://github.com/dewsxc","followers_url":"https://api.github.com/users/dewsxc/followers","following_url":"https://api.github.com/users/dewsxc/following{/other_user}","gists_url":"https://api.github.com/users/dewsxc/gists{/gist_id}","starred_url":"https://api.github.com/users/dewsxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dewsxc/subscriptions","organizations_url":"https://api.github.com/users/dewsxc/orgs","repos_url":"https://api.github.com/users/dewsxc/repos","events_url":"https://api.github.com/users/dewsxc/events{/privacy}","received_events_url":"https://api.github.com/users/dewsxc/received_events","type":"User","site_admin":false},"created_at":"2015-06-02T12:35:24Z","updated_at":"2015-06-02T12:35:24Z","body":"Any video is live event. Like \"nrYHu7hmMK0\", \"wpZNaYN29xs\" etc."}}