Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when integrating with youtube-ios-player-helper third party library on iOS

I am trying to play a YouTube video with the youtube-ios-player-helper library, but I am encountering an error at runtime:

Received error rendering template: Error Domain=NSCocoaErrorDomain Code=258 "The operation couldn't be completed. (Cocoa error 258.)"
like image 244
Ashiwani Avatar asked May 20 '14 05:05

Ashiwani


People also ask

What is YouTube iOS player helper?

The youtube-ios-player-helper is an open source library that helps you embed a YouTube iframe player into an iOS application.


2 Answers

In YTPlayerView.m

Edit:

NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player"
                                                 ofType:@"html"
                                            inDirectory:@"Assets"];

To:

NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player"
                                                 ofType:@"html"];

Hope to help you!

like image 63
Love Thailand Avatar answered Nov 13 '22 17:11

Love Thailand


You need copy Assets/YTPlayerView-iframe-player.html to main bundle to fix this issue.

or just put into bundle, and replace where App starts to look for

/*NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player"
     ofType:@"html"
     inDirectory:@"Assets"];*/

NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player" ofType:@"html"];
like image 33
János Avatar answered Nov 13 '22 16:11

János