[ 
https://issues.apache.org/jira/browse/CB-11856?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Igor Kravchuk updated CB-11856:
-------------------------------
    Comment: was deleted

(was: - (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 THIS

            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
})

> 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

Reply via email to