I'm using youtube-ios-player-helper to play youtube video in my application. I'd like to be able to mute. Here is what I did:
Add setVolume() and mute() function in YTPlayerView
-(void)setVolume:(int)volume { if ( volume < 0 ) volume = 0; else if ( volume > 100 ) volume = 100; NSString *command = [NSString stringWithFormat:@"player.setVolume(%d);", volume]; [self stringFromEvaluatingJavaScript:command];}-(void)mute { NSString *command = [NSString stringWithFormat:@"player.mute();"]; [self stringFromEvaluatingJavaScript:command];}
Then I call setVolume:0 or mute functions in my app. But the sound can't be turned off. The volume is still 100.
Did anybody turn off the sound successfully?