[jira] [Comment Edited] (CB-11856) Can't change volume on iOS while playing through avPlayer
[ https://issues.apache.org/jira/browse/CB-11856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15493047#comment-15493047 ] Igor Kravchuk edited comment on CB-11856 at 9/15/16 11:24 AM: -- I found a solution. In the method lacks a setVolume for avPlayer {code} - (void)setVolume:(CDVInvokedUrlCommand*)command { NSString* callbackId = command.callbackId; #pragma unused(callbackId) NSString* mediaId = [command argumentAtIndex:0]; NSNumber* volume = [command argumentAtIndex:1 withDefault:[NSNumber numberWithFloat:1.0]]; if ([self soundCache] != nil) { CDVAudioFile* audioFile = [[self soundCache] objectForKey:mediaId]; if (audioFile != nil) { audioFile.volume = volume; if (audioFile.player) { audioFile.player.volume = [volume floatValue]; } // ADDED BELOW if (avPlayer.currentItem && avPlayer.currentItem.asset) { float customVolume = [volume floatValue]; [avPlayer setVolume:customVolume]; } [[self soundCache] setObject:audioFile forKey:mediaId]; } } // don't care for any callbacks } {code} was (Author: igor.kravchuk): {code} - (void)setVolume:(CDVInvokedUrlCommand*)command { NSString* callbackId = command.callbackId; #pragma unused(callbackId) NSString* mediaId = [command argumentAtIndex:0]; NSNumber* volume = [command argumentAtIndex:1 withDefault:[NSNumber numberWithFloat:1.0]]; if ([self soundCache] != nil) { CDVAudioFile* audioFile = [[self soundCache] objectForKey:mediaId]; if (audioFile != nil) { audioFile.volume = volume; if (audioFile.player) { audioFile.player.volume = [volume floatValue]; } // ADDED BELOW if (avPlayer.currentItem && avPlayer.currentItem.asset) { float customVolume = [volume floatValue]; [avPlayer setVolume:customVolume]; } [[self soundCache] setObject:audioFile forKey:mediaId]; } } // don't care for any callbacks } {code} > Can't change volume on iOS while playing through avPlayer > - > > Key: CB-11856 > URL: https://issues.apache.org/jira/browse/CB-11856 > Project: Apache Cordova > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: Plugin Media >Reporter: Igor Kravchuk >Priority: Blocker > > When ios media playing from a remote resource, used the avPlayer and there is > no way to change the volume. > If media playing from local storage - volume control works. > On Androind no such problem. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Comment Edited] (CB-11856) Can't change volume on iOS while playing through avPlayer
[ https://issues.apache.org/jira/browse/CB-11856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15493047#comment-15493047 ] Igor Kravchuk edited comment on CB-11856 at 9/15/16 11:23 AM: -- {code} - (void)setVolume:(CDVInvokedUrlCommand*)command { NSString* callbackId = command.callbackId; #pragma unused(callbackId) NSString* mediaId = [command argumentAtIndex:0]; NSNumber* volume = [command argumentAtIndex:1 withDefault:[NSNumber numberWithFloat:1.0]]; if ([self soundCache] != nil) { CDVAudioFile* audioFile = [[self soundCache] objectForKey:mediaId]; if (audioFile != nil) { audioFile.volume = volume; if (audioFile.player) { audioFile.player.volume = [volume floatValue]; } // ADDED BELOW if (avPlayer.currentItem && avPlayer.currentItem.asset) { float customVolume = [volume floatValue]; [avPlayer setVolume:customVolume]; } [[self soundCache] setObject:audioFile forKey:mediaId]; } } // don't care for any callbacks } {code} was (Author: igor.kravchuk): {code:swift} - (void)setVolume:(CDVInvokedUrlCommand*)command { NSString* callbackId = command.callbackId; #pragma unused(callbackId) NSString* mediaId = [command argumentAtIndex:0]; NSNumber* volume = [command argumentAtIndex:1 withDefault:[NSNumber numberWithFloat:1.0]]; if ([self soundCache] != nil) { CDVAudioFile* audioFile = [[self soundCache] objectForKey:mediaId]; if (audioFile != nil) { audioFile.volume = volume; if (audioFile.player) { audioFile.player.volume = [volume floatValue]; } // ADDED BELOW if (avPlayer.currentItem && avPlayer.currentItem.asset) { float customVolume = [volume floatValue]; [avPlayer setVolume:customVolume]; } [[self soundCache] setObject:audioFile forKey:mediaId]; } } // don't care for any callbacks } {code} > Can't change volume on iOS while playing through avPlayer > - > > Key: CB-11856 > URL: https://issues.apache.org/jira/browse/CB-11856 > Project: Apache Cordova > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: Plugin Media >Reporter: Igor Kravchuk >Priority: Blocker > > When ios media playing from a remote resource, used the avPlayer and there is > no way to change the volume. > If media playing from local storage - volume control works. > On Androind no such problem. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Comment Edited] (CB-11856) Can't change volume on iOS while playing through avPlayer
[ https://issues.apache.org/jira/browse/CB-11856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15493047#comment-15493047 ] Igor Kravchuk edited comment on CB-11856 at 9/15/16 11:23 AM: -- {code:swift} - (void)setVolume:(CDVInvokedUrlCommand*)command { NSString* callbackId = command.callbackId; #pragma unused(callbackId) NSString* mediaId = [command argumentAtIndex:0]; NSNumber* volume = [command argumentAtIndex:1 withDefault:[NSNumber numberWithFloat:1.0]]; if ([self soundCache] != nil) { CDVAudioFile* audioFile = [[self soundCache] objectForKey:mediaId]; if (audioFile != nil) { audioFile.volume = volume; if (audioFile.player) { audioFile.player.volume = [volume floatValue]; } // ADDED BELOW if (avPlayer.currentItem && avPlayer.currentItem.asset) { float customVolume = [volume floatValue]; [avPlayer setVolume:customVolume]; } [[self soundCache] setObject:audioFile forKey:mediaId]; } } // don't care for any callbacks } {code} was (Author: igor.kravchuk): {code:swift} - (void)setVolume:(CDVInvokedUrlCommand*)command { NSString* callbackId = command.callbackId; #pragma unused(callbackId) NSString* mediaId = [command argumentAtIndex:0]; NSNumber* volume = [command argumentAtIndex:1 withDefault:[NSNumber numberWithFloat:1.0]]; if ([self soundCache] != nil) { CDVAudioFile* audioFile = [[self soundCache] objectForKey:mediaId]; if (audioFile != nil) { audioFile.volume = volume; if (audioFile.player) { audioFile.player.volume = [volume floatValue]; } if (avPlayer.currentItem && avPlayer.currentItem.asset) { float customVolume = [volume floatValue]; [avPlayer setVolume:customVolume]; } [[self soundCache] setObject:audioFile forKey:mediaId]; } } // don't care for any callbacks } {code} > Can't change volume on iOS while playing through avPlayer > - > > Key: CB-11856 > URL: https://issues.apache.org/jira/browse/CB-11856 > Project: Apache Cordova > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: Plugin Media >Reporter: Igor Kravchuk >Priority: Blocker > > When ios media playing from a remote resource, used the avPlayer and there is > no way to change the volume. > If media playing from local storage - volume control works. > On Androind no such problem. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org