Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Can I mute for youtube-ios-player-helper?

$
0
0

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:

  1. 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?


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>