youtube / youtube-ios-player-helper

Lightweight helper library that allows iOS developers to add inline playback of YouTube videos through a WebView
Other
1.65k stars 683 forks source link

`YTPlayerView` `loadWithVideoId` do not work since version 0.1.5 #160

Open martinprot opened 8 years ago

martinprot commented 8 years ago

I declare @property (nonatomic, weak) IBOutlet YTPlayerView *playerView;

Then, in code:

        NSString *youtubeId = @"VsabFEisZ2Y";
        [_playerView loadWithVideoId:youtubeId];

This works on 0.1.4 But on 0.1.5, an error message appears Received error rendering template: Error Domain=NSCocoaErrorDomain Code=258 "Le nom de fichier n’est pas valide." (The error message is localized in french, which means : the file name is not valid.

JALsnipe commented 8 years ago

Duplicate of #15.

ikbenben commented 8 years ago

@JALsnipe I'm having this issue too with 0.1.5 and I agree it is a duplicate but it is new in the sense that it wasn't an issue in 0.1.4 so #15 no longer applies (at least the way I look at it).

The issue is that the YTPlayerView-iframe-player.html file is not being copied over anymore. I reverted back to 0.1.4 and now I see the html page and it works again

JALsnipe commented 8 years ago

@ikbenben There's related discussion about the missing asset in https://github.com/youtube/youtube-ios-player-helper/issues/157

ishaq commented 8 years ago

+1

blackscomber commented 8 years ago

I have a same issue with 1.0.5. "~~ Received error rendering template: Error Domain=NSCocoaErrorDomain Code=258 "The file name is invalid." I refreshed pods cache and updated all pods, but it doesn't seem to be fixed. :(

kmiloaguilar commented 8 years ago

Same issue over here, this is really bad.

tbrannam commented 8 years ago

Master branch has patch - for cocoapods users, a new podfile & version tag should be released

For the time being change your pod reference to point to the master branch

pod 'youtube-ios-player-helper', :git=>'https://github.com/youtube/youtube-ios-player-helper', :commit=>'head'

peledkfir commented 8 years ago

@tbrannam thanks a lot !!

johnyycm commented 8 years ago

@tbrannam this works for me

flamesoft commented 8 years ago

The changes for Podfile didn't help me.

Finally I made it work in these steps.

  1. Remove youtube-ios-player-helper from Podfile
  2. Run 'pod update'
  3. Copy YTPlayerView.m, YTPlayerView.h to the project. Copy the YTPlayerView-iframe-player.html to the project folder and add it into the "Supporting Files" group.
  4. In YTPlayerView.m Change from this:
NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player"
                                                 ofType:@"html"
                                            inDirectory:@"Assets"];

To:


NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player"
                                                 ofType:@"html"];
Sarath7CStudio commented 8 years ago

Even i had same problem,

replace the code below: NSString *path = [[NSBundle bundleForClass:[YTPlayerView class]] pathForResource:@"YTPlayerView-iframe-player" ofType:@"html" inDirectory:@"Assets"];

To:

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

chitvan832 commented 7 years ago

i am working in Swift 3 and have dragged .h , .m and the html file in my project and used bridging.

following error is coming :

Received error rendering template: Error Domain=NSCocoaErrorDomain Code=261 "The file “YTPlayerView-iframe-player.html” couldn’t be opened using text encoding Unicode (UTF-8)." UserInfo={NSFilePath=/Users/sierra4/Library/Developer/CoreSimulator/Devices/FA9E5F10-4799-4CB2-87E9-1566B759A754/data/Containers/Bundle/Application/CA9A132E-4EA8-4036-8B0E-FFF9DC32BC63/DemoYoutube.app/YTPlayerView-iframe-player.html, NSStringEncoding=4}

abhanegi commented 7 years ago

@flamesoft I didn't get "YTPlayerView-iframe-player.html" from where I have to find it ?

flamesoft commented 7 years ago

@abhanegi Download the youtube-ios-player-helper-master project from https://github.com/youtube/youtube-ios-player-helper. Then you will find it in the Assets.bundle.

Urvish-modi commented 6 years ago

Please check you have added Assets framework in app. I add it and it works for me.