diff --git a/README.md b/README.md index 4438eda..91b46f7 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ cordova plugin add https://github.com/JonSmart/CordovaYoutubeVideoPlayer YoutubeVideoPlayer.openVideo('YOUTUBE_VIDEO_ID', function(result) { console.log('YoutubeVideoPlayer result = ' + result); }); ``` -For Android 5.0+ you will need to add the following to config.xml +For Android 5.0+ and iOS you will need to add the following to config.xml ```xml diff --git a/platforms/ios/YoutubeVideoPlayerProject/Plugins/com.bunkerpalace.cordova.YoutubeVideoPlayer/YoutubeVideoPlayer.m b/platforms/ios/YoutubeVideoPlayerProject/Plugins/com.bunkerpalace.cordova.YoutubeVideoPlayer/YoutubeVideoPlayer.m index 30d8163..1a2f3d6 100644 --- a/platforms/ios/YoutubeVideoPlayerProject/Plugins/com.bunkerpalace.cordova.YoutubeVideoPlayer/YoutubeVideoPlayer.m +++ b/platforms/ios/YoutubeVideoPlayerProject/Plugins/com.bunkerpalace.cordova.YoutubeVideoPlayer/YoutubeVideoPlayer.m @@ -8,9 +8,19 @@ #import "YoutubeVideoPlayer.h" #import "XCDYouTubeKit.h" #import +#import @implementation YoutubeVideoPlayer +- (void)pluginInitialize +{ + NSString *api_key = [self.commandDelegate.settings cordovaSettingForKey:@"YouTubeDataApiKey"]; + + if (api_key != nil) { + [XCDYouTubeClient setInnertubeApiKey: api_key]; + } +} + - (void)openVideo:(CDVInvokedUrlCommand*)command { diff --git a/plugin.xml b/plugin.xml index 93f21b2..1dcc49a 100755 --- a/plugin.xml +++ b/plugin.xml @@ -1,6 +1,6 @@ - + CordovaYoutubeVideoPlayer @@ -56,8 +56,15 @@ - - + + + + + + + + +