XCDYouTubeKit icon indicating copy to clipboard operation
XCDYouTubeKit copied to clipboard

XCDYouTubeVideo should always be returned if possible

Open peterpaulis opened this issue 7 years ago • 6 comments

Even in case of an error, the XCDYouTubeVideo should always be returned, as it contains the

thumbnail and title, which can be used by the UI to display

peterpaulis avatar Mar 09 '17 12:03 peterpaulis

pls marge https://github.com/0xced/XCDYouTubeKit/pull/201

peterpaulis avatar Mar 09 '17 12:03 peterpaulis

@peterpaulis I believe that could create some confusion. For example, if you try to fetch a private video or a video that was deleted then how would you get the thumbnail and the title?

Below is an example of the how a XCDYouTubeVideo would be initialized with a private video. Note the NSDictionary keys and values.

screen shot 2017-03-09 at 9 08 26 am

Instead, what I believe should happen is that in the event that it fetches a video in which it cannot get any additional streams then it should return the aforementioned values (if they exists) in the userInfo of the NSError object.

SoneeJohn avatar Mar 09 '17 13:03 SoneeJohn

in the change i propose the error video is returned within the userInfo of the error... so it would not conflict anything or existing versions...

peterpaulis avatar Mar 09 '17 13:03 peterpaulis

@peterpaulis That's a good idea. However, have come across a video that had no streams but still had the title and thumbnail values? I've been looking at the various unit tests and I haven't been able to produce something similar to that behavior.

I understand that this could be a good fallback option I just haven't come across a video in which that would work. i.e. (Not have a nil XCDYouTubeVideo)

SoneeJohn avatar Mar 09 '17 13:03 SoneeJohn

Yes, this can happen fairly often, like with the Vevo content

peterpaulis avatar Mar 09 '17 17:03 peterpaulis

@peterpaulis I will admit I haven't tested that 🙂

SoneeJohn avatar Mar 09 '17 18:03 SoneeJohn