0xced / XCDYouTubeKit

YouTube video player for iOS, tvOS and macOS
MIT License
2.92k stars 626 forks source link

Suddenly i have NSLocalizedDescription = "unsupported URL" on all videos #461

Closed keegho closed 4 years ago

keegho commented 4 years ago

It has been a couple of days that i have this error when playing my videos on youtube from the app. What happened? I'm using the latest version 2.8.3 using cocoapods. What could the reason be?

The id's are extracted correctly and everything was fine and suddenly i'm getting complains from users in the app that the videos are not playing any more. I said maybe it was the version of the XCDYouTubeKit library so i updated to the latest on xcode and tried to play the files and i still get this error.

My videos are unlisted on YouTube this could be a reason? Maybe youtube changed something in their links? Can anybody help me please.

User Info: { NSLocalizedDescription = "unsupported URL"; NSUnderlyingError = "Error Domain=NSURLErrorDomain Code=-1002 \"unsupported URL\" UserInfo={NSUnderlyingError=0x6000009bd0b0 {Error Domain=kCFErrorDomainCFNetwork Code=-1002 \"(null)\"}, NSErrorFailingURLStringKey=/yts/jsbin/player_ias-vflbDJ8ds/en_US/base.js, NSErrorFailingURLKey=/yts/jsbin/player_ias-vflbDJ8ds/en_US/base.js, NSLocalizedDescription=unsupported URL}"; }

XCDYouTubeClient.default().getVideoWithIdentifier(self.extractYoutubeId(fromLink: url)) { (video: XCDYouTubeVideo?, err: Error?) in
                    if err != nil {
                        print(err?.localizedDescription)
                        return
                    }
                    if let streamURL = (video?.streamURLs[XCDYouTubeVideoQualityHTTPLiveStreaming] ??
                                        video?.streamURLs[XCDYouTubeVideoQuality.HD720.rawValue] ??
                        video?.streamURLs[XCDYouTubeVideoQuality.medium360.rawValue] ??
                        video?.streamURLs[XCDYouTubeVideoQuality.small240.rawValue]) {
                        self.playerViewController?.player = AVPlayer(url: streamURL)
                        self.playerViewController.player?.play()
                    } else {
                       // self.dismissViewControllerAnimated(true, completion: nil)
                    }
                }
SoneeJohn commented 4 years ago

Can you give an example URL that is showing this issue?

keegho commented 4 years ago

@SoneeJohn https://www.youtube.com/watch?v=CINIx6d0gJ0

SoneeJohn commented 4 years ago

@keegho Screen Shot 2020-01-29 at 4 02 07 PM

Can you try the demo app? It's working fine on my end. Ensure to clean the project first

keegho commented 4 years ago

The strange thing is that i'm building a new app called "TWG" and i'm using the same library, version and code and it is working fine on our new application. But the one in the store our old app called "SHAGA3APP" of it stopped working and the new version i'm trying to upload for "SHAGA3APP" have same issue even after updating the library. The only difference between the TWG app and the "SHAGA3APP" that "TWG" is added using swift dependency manager and "SHAGA3APP" using cocoapods and when i tried to use swift packed manager i had an error of 25 duplicate file even after removing the library from cocoapods pod file and pod installing it again. The problem that i cannot track the issue. I will try to clean and see.

keegho commented 4 years ago

@SoneeJohn Hello i resolved the issue. I removed the pod and used swift package manager and was able to remove the duplicate files and it worked. I don't know what was wrong using cocoapods.

SoneeJohn commented 4 years ago

Great! I am glad you solved the issue.