2 Replies
      Latest reply on Jul 23, 2018 9:03 AM by TheCD
      Pyari Devi Level 1 Level 1 (0 points)

        I have a music app and have been using MPVolumeView to change volume of media player in my application. Volume changes happens at runtime when user asked our server to change the volume so the volume value varies based on the request. I am using the below code snippet to make it happen.

         

        let volumeSlider = (MPVolumeView().subviews.filter { NSStringFromClass($0.classForCoder) == "MPVolumeSlider" }.first as! UISlider)  

            volumeSlider.setValue(value, animated: false)

         

        The  above code was working fine till iOS 11.3 irrespective of whether the device is connected to external accessory such as BT device or not.

         

         

        But it is not working in iOS 11.4 when BT device is connected to iPhone.

        As per analysis, i got the below logs in the terminal whenever the above code executed.

         

         

        <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_None

         

         

        I also noticed that MPVolumeSliderView.value is getting set with the new value  in the logs but the effect of the sound volume doesn't changed.

         

        Please let me know what i am missing if i want to change the volume while BT device is connected.