0xced / XCDYouTubeKit

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

XCDYouTubeVideo should always be returned if possible #321

Open peterpaulis opened 7 years ago

peterpaulis commented 7 years ago

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 commented 7 years ago

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

SoneeJohn commented 7 years ago

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

peterpaulis commented 7 years ago

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

SoneeJohn commented 7 years ago

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

peterpaulis commented 7 years ago

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

SoneeJohn commented 7 years ago

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