{"action":"opened","issue":{"url":"https://api.github.com/repos/paramaggarwal/react-native-youtube/issues/17","labels_url":"https://api.github.com/repos/paramaggarwal/react-native-youtube/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/paramaggarwal/react-native-youtube/issues/17/comments","events_url":"https://api.github.com/repos/paramaggarwal/react-native-youtube/issues/17/events","html_url":"https://github.com/paramaggarwal/react-native-youtube/issues/17","id":105055768,"number":17,"title":"Add setVolume","user":{"login":"alejomendoza","id":5351127,"avatar_url":"https://avatars.githubusercontent.com/u/5351127?v=3","gravatar_id":"","url":"https://api.github.com/users/alejomendoza","html_url":"https://github.com/alejomendoza","followers_url":"https://api.github.com/users/alejomendoza/followers","following_url":"https://api.github.com/users/alejomendoza/following{/other_user}","gists_url":"https://api.github.com/users/alejomendoza/gists{/gist_id}","starred_url":"https://api.github.com/users/alejomendoza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alejomendoza/subscriptions","organizations_url":"https://api.github.com/users/alejomendoza/orgs","repos_url":"https://api.github.com/users/alejomendoza/repos","events_url":"https://api.github.com/users/alejomendoza/events{/privacy}","received_events_url":"https://api.github.com/users/alejomendoza/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-05T23:20:57Z","updated_at":"2015-09-05T23:20:57Z","closed_at":null,"body":"I was playing around with this today, unfortunately I couldn't make it work.\r\n\r\n```javascript\r\n\r\n// on the YTPlayerView.h\r\n\r\n- (void)setVolume:(NSNumber *)volume;\r\n\r\n// on the YTPlayerView.m\r\n\r\n- (void)setVolume:(NSNumber *)volume{\r\n    NSString *command = [NSString stringWithFormat:@\"player.setVolume(%@);\", volume];\r\n    [self stringFromEvaluatingJavaScript:command];\r\n}\r\n\r\n// on the RCTYouTubeManager.m\r\n\r\nRCT_EXPORT_METHOD(setVolume:(NSNumber *)reactTag volume:(NSNumber *)volume)\r\n{\r\n    [self.bridge.uiManager addUIBlock:\r\n     ^(__unused RCTUIManager *uiManager, RCTSparseArray *viewRegistry){\r\n         RCTYouTube *youtube = viewRegistry[reactTag];\r\n         if ([youtube isKindOfClass:[RCTYouTube class]]) {\r\n             [youtube setVolume:volume];\r\n         } else {\r\n             RCTLogError(@\"Cannot seek: %@ (tag #%@) is not RCTYouTube\", youtube, reactTag);\r\n         }\r\n     }];\r\n}\r\n\r\n// on react native component\r\n\r\nsetVolume(volume){\r\n        NativeModules.YouTubeManager.setVolume(\r\n            React.findNodeHandle(this.refs.youtubeplayer),\r\n            volume * 100\r\n        );  \r\n    },\r\n\r\n\r\n```"}}