0xced / XCDYouTubeKit

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

Video not playing with Amazon URL. #329

Closed kuldeep13990 closed 7 years ago

kuldeep13990 commented 7 years ago

I am trying to play video from amazon URL but this error occurs.

Video operation finished with error: Invalid parameters.

is it possible to play custom url rather than youtube video id?

joshgare commented 7 years ago

I feel this is more for StackOverflow rather than GitHub. However this should work for you:

XCDYouTubeVideoPlayerViewController *videoPlayerViewController = [[XCDYouTubeVideoPlayerViewController alloc] initWithContentURL:[NSURL URLWithString:@"URL"]];

kuldeep13990 commented 7 years ago

@JJGEight thanks for reply. but that is not working as you mentioned above, it will throw exception.

joshgare commented 7 years ago

@kuldeep13990 you can just edit XCDYouTubeVideoPlayerViewController and comment out the following to stop the exception and to inherit make XCDYouTubeVideoPlayerViewController inherit from MPMoviePlayerViewController.

- (instancetype) initWithContentURL:(NSURL *)contentURL
{
    @throw [NSException exceptionWithName:NSGenericException reason:@"Use the `initWithVideoIdentifier:` method instead." userInfo:nil];
} // LCOV_EXCL_LINE

Probably should have added this before, apologies.

0xced commented 7 years ago

The exception is there you tell you that you are not using XCDYouTubeVideoPlayerViewController properly. If you already have a movie URL to play, you simply don’t need XCDYouTubeKit at all, just use an AVPlayerViewController.